yarrick / iodine

Official git repo for iodine dns tunnel
https://code.kryo.se/iodine
ISC License
6.26k stars 508 forks source link

simple speed boost for legacy mode #21

Open Masaq- opened 8 years ago

Masaq- commented 8 years ago

Throughput is increased in legacy mode by dropping packets if the client is not ready to send immediately. Upstream packets must conform to the ping-pong traffic pattern or be dropped, and TCP recovers gracefully from intentional packet loss by sending some segments out of order. This is tremendously beneficial on Wi-Fi, where latency is variable, if the only available DNS server will only tolerate legacy mode. Personally I have seen this simple change double my download speed.

Masaq- commented 8 years ago

Why this patch works:

Performance is strongly coupled to low ping times, as iodine requires confirmation for every data fragment before moving on to the next.

Without this patch, throughput in bytes per second is approximately (fragment size)*(1000/(average ping))

With this patch, throughput in bytes per second is approximately (fragment size)*(1000/(minimum ping))

Without this patch, the client queues packets for quick transmission during periods of low ping and delayed transmission during periods of high ping.

With this patch, the client discards packets during periods of high ping, eliminating delay in favor of packet loss, and resulting in a bias toward transmission during periods of low ping.

Unless ping time is constant, then average ping and minimum ping are the same, and no change occurs.

I see double speed with this patch because my average ping is double my minimum ping.