nginx streams your tokens fine. HAProxy holds them for 206ms.

A recent performance analysis investigates the common assumption that nginx buffers Server-Sent Events (SSE) streams, often leading developers to disable proxy_buffering. The study, which utilized a controlled benchmarking harness, reveals that nginx does not inherently buffer token streams. In contrast, HAProxy in its default configuration introduces a significant 206ms latency for the first token, coalescing small frames into larger bursts. The author demonstrates that the widely recommended 'X-Accel-Buffering: no' header is an nginx-specific convention that has no effect on HAProxy. While proxy_buffering can cause minor latency in specific bulk-payload scenarios, it is not the primary cause of token-streaming delays. The findings emphasize that for LLM token streaming, HAProxy's default behavior is the actual bottleneck, rather than the commonly blamed nginx settings. The author provides a detailed methodology to ensure measurement accuracy, highlighting the importance of testing with realistic payload sizes.
This is a summary. Read the full article at the original source:
Dev.toRelated stories
The article on Habr explores the historical reasons that allowed Tsaritsyn (now Volgograd) to become a key industrial center of the Lower Volga region…
We launched a reference guide — and a week later found out that the main answer in it was wrong
A development team created a regulatory reference guide in just two weeks, only to discover a critical error in the system's core answer seven days af…
The author shares their experience using generative AI tools for rapid software development, a process they call 'vibecoding.' Despite the high speed…



