Lower compression level to avoid overloading the thread. Fixes BUKKIT-2963

When sending chunks to a player we use their writer thread to do chunk
compression to avoid blocking the main thread with this work. However,
after a teleport or respawn there are a large number of chunk packets to
process. This causes the thread to spend a long period handling compression
while we continue dumping more chunk packets on it to handle. The result of
this is a noticable delay in getting responses to commands and chat
immediately after teleporting.

Switching to a lower compression level reduces this load and makes our
behavior more like vanilla. We do, however, still give this thread more
work to do so there will likely still be some delay when comparing to
vanilla. The only way to avoid this would be to put chunk compression back
on the main thread and give everyone on the server a poorer experience
instead.
Dieser Commit ist enthalten in:
Travis Watkins 2012-11-18 08:45:54 -06:00
Ursprung 028860399b
Commit 1044c32a54

Datei anzeigen

@ -22,7 +22,8 @@ public class Packet56MapChunkBulk extends Packet {
static final ThreadLocal<Deflater> localDeflater = new ThreadLocal<Deflater>() { static final ThreadLocal<Deflater> localDeflater = new ThreadLocal<Deflater>() {
@Override @Override
protected Deflater initialValue() { protected Deflater initialValue() {
return new Deflater(Deflater.BEST_COMPRESSION); // Don't use higher compression level, slows things down too much
return new Deflater(6);
} }
}; };
// CraftBukkit end // CraftBukkit end