scratchfoundation / scratch-link

Device interoperability layer for Windows and MacOS
BSD 3-Clause "New" or "Revised" License
102 stars 83 forks source link

Scratch Link communication latency is increased due to Nagle's algorithm #153

Closed cwillisf closed 4 years ago

cwillisf commented 4 years ago

Expected Behavior

Scratch Link should pass messages between a client (usually Scratch) and a hardware peripheral with minimal latency.

Actual Behavior

Most operating systems combine small packets in order to increase throughput; this is known as Nagle's algorithm. Since Scratch Link communication is generally over a loopback connection we don't generally need to worry about throughput, but latency is certainly a concern. We should consider disabling Nagle's algorithm to improve latency.

See also: https://en.wikipedia.org/wiki/Nagle%27s_algorithm#Interactions_with_real-time_systems

Thanks to @terado0618 for bringing this up!