Reduce ResourcePackChunkData chunk size to 128 KB

while this is slightly less bandwidth efficient (1 in 92 datagrams not full vs 1 in 733), this is significantly less memory-hard.
I made this decision looking at the memory pressures that 1MB chunks exert - especially on RakNet. Client-side, these resource pack chunks all hang around in RakNet memory until the whole thing is received, and it's a lot more costly to receive 733 datagrams than it is to receive 92, especially since it's much more likely that some of the 733 will disappear along the way.
If, for example, the first couple of hundred KB split parts arrived out of 1MB, and then one of the parts got lost, all the already-received parts would hang around in memory not getting processed. With smaller chunks this is much less of a problem.
I explored taking the chunk size all the way down to 1KB to reduce the bandwidth waste caused by split packets (split headers), but this made resource pack downloading unbearably slow, so it wasn't acceptable.
This commit is contained in:
Dylan K. Taylor 2020-05-31 19:29:26 +01:00
parent 11cedc4011
commit 0d4e473bdd

View File

@ -217,7 +217,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
public const SPECTATOR = 3;
public const VIEW = Player::SPECTATOR;
private const RESOURCE_PACK_CHUNK_SIZE = 1048576; //1MB
private const RESOURCE_PACK_CHUNK_SIZE = 128 * 1024; //128KB
/**
* Validates the given username.