$tcpinfo_snd_cwnd
$tcpinfo_snd_cwnd returns the TCP send congestion window size in bytes. — NGINX Core (HTTP)
Description
The $tcpinfo_snd_cwnd variable in NGINX provides the current TCP send congestion window size for a connection, which is critical for understanding the flow and responsiveness of data transmission over the network. This variable is relevant in scenarios where NGINX is used as a reverse proxy or load balancer, as it allows for real-time monitoring of TCP metrics, which can be crucial for performance tuning and optimization. The congestion window size indicates the amount of data that can be sent before waiting for an acknowledgment from the receiver, influencing the overall network throughput. The value of $tcpinfo_snd_cwnd is set during an active TCP connection (i.e., when TCP is the transport layer) and reflects changes in the congestion window size as data is being transmitted. The typical values range widely depending on network conditions, load, and configuration; they can be very small equivalent to a few TCP packets, or quite large if the network path is reliable and has sufficient bandwidth. Monitoring this variable can help administrators identify potential performance bottlenecks and adjust their server configurations accordingly.
Config Example
location /status {
default_type text/plain;
add_header Content-Length 0;
return 200 "Current congestion window size: $tcpinfo_snd_cwnd bytes\n";
}Subsystem
httpCacheable
NoContexts
http, server, locationThis variable is only available in TCP connections and will not be set in UDP-based configurations.
Make sure the NGINX version used supports TCPINFO; otherwise, this variable may not be available or produce accurate results.