[Optimization] Improve map download netcode
Posted: Tue Mar 12, 2019 1:06 pm
The network code used to download multiplayer maps can be optimized, resulting in generally faster map downloads.
Here in Germany, many ISPs offer highly asymmetric DSL lines, like 16MBit/s down, 0.5MBit/s up. Because the factorio network code uses about 4 times the number of packages in upload direction than needed, factorio quickly saturates the upload bandwidth available. For me, this leads to degraded map download speeds, even if the server is hosted on an uncongested symmetrical Gigabit connection.
To show the current state, I’ve created two screenshots of my system monitor, while it displays network metrics:
Purely as a reference, this is my current download speed when loading a regular, big file somewhere from the internet. From top to bottom it is data rate, packet rate, error rate. Here, the download line is saturated, while the upload line is not. The same situation, but using factorio to download a larger multiplayer map. For me, the download rate is capped at about 660 KiB/s, regardless of the used server. I have never seen higher download rates in factorio.
When you compare the packet rates, you can see that a regular download uses about 540-580 packets/s for TCP ACKs. Factorio somehow takes over 1800 packets/s, which is even more than the received package rate.
My suggestion is to reduce the number of acknowledgement packages sent, if you can control this. This will lead to less upload congestion and in turn, improve the map download speed for everyone with such asymmetrical network connections.
Here in Germany, many ISPs offer highly asymmetric DSL lines, like 16MBit/s down, 0.5MBit/s up. Because the factorio network code uses about 4 times the number of packages in upload direction than needed, factorio quickly saturates the upload bandwidth available. For me, this leads to degraded map download speeds, even if the server is hosted on an uncongested symmetrical Gigabit connection.
To show the current state, I’ve created two screenshots of my system monitor, while it displays network metrics:
Purely as a reference, this is my current download speed when loading a regular, big file somewhere from the internet. From top to bottom it is data rate, packet rate, error rate. Here, the download line is saturated, while the upload line is not. The same situation, but using factorio to download a larger multiplayer map. For me, the download rate is capped at about 660 KiB/s, regardless of the used server. I have never seen higher download rates in factorio.
When you compare the packet rates, you can see that a regular download uses about 540-580 packets/s for TCP ACKs. Factorio somehow takes over 1800 packets/s, which is even more than the received package rate.
My suggestion is to reduce the number of acknowledgement packages sent, if you can control this. This will lead to less upload congestion and in turn, improve the map download speed for everyone with such asymmetrical network connections.