scratchfoundation/scratch-link

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

cwillisf opened this issue · 0 comments

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!