0
Does the linux kernel create a buffer for every TCP connection, for example when we have 1000 tcp connections the kernel creates 1000 socket buffer and stores the packets of individual flow on its socket buffer? OR all the TCP flows share a single large TCP socket buffer. Which means all the packets are stored in the shared TCP socket buffer.
Thanks Amer
Thank you for this helpful information, Does the outbound application-level buffer share by all the outgoing flows of this application or each flow has its own buffer. Based on the example, we will have 1000 tcp socket buffer or a single shared tcp socket buffer, assuming the application is tcp-based. – amer m – 2016-06-03T11:06:21.333
The application itself can use shared buffers, but the kernel will have a separate outbound buffer for each connection that holds unacknowleged data. If memory is tight, you can shrink the size of the kernel's buffering and do more of the buffering in the application, where you can implement buffer sharing. TCP throughput may suffer a bit, but that might not be that important depending on your use case. – David Schwartz – 2016-06-03T17:15:25.067
From your explanation I understand that the TCP congestion window is running on the application-level TCP buffer were this buffer is shared by all the the flows that initiated from the same application, such as all FTP flows share the same outgoing tcp buffer. Does this seem has a conflict with the concept that the kernel creates a tcp socket buffer for every tcp connection !!? Thank you – amer m – 2016-06-04T11:22:32.577
No, no no. You completely misunderstood me. The kernel runs the TCP congestion window using only its buffer, which cannot be shared. An application can use shared buffers if it wants to, but most don't. – David Schwartz – 2016-06-04T15:20:15.113
In journal of linux network stack, there are IP stack, Qdisc buffers and Ring buffer. I have misunderstanding between the TCP buffer where the congestion window is running and the TCP socket send queue ( buffer) or TCP socket receive queue where I think the kernel is creating one queue per TCP connection BUT I do not have any resource has stated that. May you please clarify this to me? Thank you – amer m – 2016-06-04T15:42:50.370
There is a kernel send and receive queue per TCP connection. It holds application data, not packets. The send queue holds data that has not yet been acknowledged by the other side. The receive queue holds data that has not yet been accepted by the local application. The TCP congestion algorithms and such use those queues. – David Schwartz – 2016-06-04T16:13:44.927