Increase socket size, cache direct buffers

This commit is contained in:
TheMode 2021-08-05 15:42:16 +02:00
parent 7ba8189a28
commit aa2a6522dc
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ public final class Server {
public static final Logger LOGGER = LoggerFactory.getLogger(Server.class);
public static final int WORKER_COUNT = Integer.getInteger("minestom.workers",
Runtime.getRuntime().availableProcessors() * 2);
public static final int SOCKET_BUFFER_SIZE = Integer.getInteger("minestom.buffer-size", 65535);
public static final int SOCKET_BUFFER_SIZE = Integer.getInteger("minestom.buffer-size", 262_143);
public static final int MAX_PACKET_SIZE = 2_097_151; // 3 bytes var-int
public static final boolean NO_DELAY = true;

View File

@ -191,6 +191,6 @@ public final class PacketUtils {
public static ByteBuffer allocateTrimmedPacket(@NotNull ServerPacket packet) {
final var temp = PacketUtils.createFramedPacket(packet);
return ByteBuffer.allocate(temp.position()).put(temp.flip());
return ByteBuffer.allocateDirect(temp.position()).put(temp.flip());
}
}