3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-06 00:00:47 +01:00

Lower the explicit flush count

Initial testing suggests this makes flush consolidation stable, although
the CPU usage will be increased as we are more aggressive in flushing
messages to the channels.
Dieser Commit ist enthalten in:
Andrew Steinborn 2019-08-08 18:39:22 -04:00
Ursprung ca3426033f
Commit 7cb86067bc
3 geänderte Dateien mit 6 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -4,13 +4,13 @@ import static com.velocitypowered.proxy.VelocityServer.GSON;
import static com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants.HANDSHAKE_HOSTNAME_TOKEN;
import static com.velocitypowered.proxy.network.Connections.FLOW_HANDLER;
import static com.velocitypowered.proxy.network.Connections.FLUSH_CONSOLIDATION;
import static com.velocitypowered.proxy.network.Connections.FLUSH_CONSOLIDATION_AMOUNT;
import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER;
import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER;
import static com.velocitypowered.proxy.network.Connections.HANDLER;
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER;
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER;
import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT;
import static io.netty.handler.flush.FlushConsolidationHandler.DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES;
import com.google.common.base.Preconditions;
import com.velocitypowered.api.network.ProtocolVersion;
@ -85,7 +85,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
protected void initChannel(Channel ch) throws Exception {
ch.pipeline()
.addLast(FLUSH_CONSOLIDATION, new FlushConsolidationHandler(
DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES, true))
FLUSH_CONSOLIDATION_AMOUNT, true))
.addLast(READ_TIMEOUT,
new ReadTimeoutHandler(server.getConfiguration().getReadTimeout(),
TimeUnit.MILLISECONDS))

Datei anzeigen

@ -17,6 +17,8 @@ public class Connections {
public static final String READ_TIMEOUT = "read-timeout";
public static final String FLUSH_CONSOLIDATION = "flush-consolidation";
public static final int FLUSH_CONSOLIDATION_AMOUNT = 10;
private Connections() {
throw new AssertionError();
}

Datei anzeigen

@ -1,6 +1,7 @@
package com.velocitypowered.proxy.network;
import static com.velocitypowered.proxy.network.Connections.FLUSH_CONSOLIDATION;
import static com.velocitypowered.proxy.network.Connections.FLUSH_CONSOLIDATION_AMOUNT;
import static com.velocitypowered.proxy.network.Connections.FRAME_DECODER;
import static com.velocitypowered.proxy.network.Connections.FRAME_ENCODER;
import static com.velocitypowered.proxy.network.Connections.LEGACY_PING_DECODER;
@ -8,7 +9,6 @@ import static com.velocitypowered.proxy.network.Connections.LEGACY_PING_ENCODER;
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER;
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER;
import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT;
import static io.netty.handler.flush.FlushConsolidationHandler.DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES;
import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.connection.MinecraftConnection;
@ -40,7 +40,7 @@ public class ServerChannelInitializer extends ChannelInitializer<Channel> {
protected void initChannel(final Channel ch) {
ch.pipeline()
.addLast(FLUSH_CONSOLIDATION, new FlushConsolidationHandler(
DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES, true))
FLUSH_CONSOLIDATION_AMOUNT, true))
.addLast(READ_TIMEOUT,
new ReadTimeoutHandler(this.server.getConfiguration().getReadTimeout(),
TimeUnit.MILLISECONDS))