/********************************************************************* * Author:samson * date:07/12/2015 * Test PL Atform: * GCC (Ubuntu 4.8.2-19ubuntu1) 4.8.2 * GNU bash, 4.3.11 (1)-release (X86_64-PC-LINUX-GNU) * Nginx Version: * Nginx 1.6.2 * nginx 1.8.0 * *******************************************************************/
So_rcvlowat So_sndlowat
Each set of interfaces has a receiving low tide limit and a send low ebb limit.
Receive low tide limit: For TCP sockets, the data in the receive buffer must reach the specified number, and the kernel notifies the process "readable". For example, trigger Select or Epoll, return "socket interface readable".
Send low tide limit: For TCP socket interface, and receive low tide limit a reason.
Understanding receiving low tide limit: If the application does not call recv () to read the data of the socket's accept buffer, the accept buffer data will keep the note in the accept buffer, so the accept buffer will certainly result in the acceptance buffer overflow as it receives more data from the send-side send buffer. So set a threshold to accept that when the Epoll hears that the data in the receiving buffer of a socket exceeds the threshold of acceptance, the read-ready is triggered, allowing the Epoll loop to return and start processing the read I/O event.
Receive low tide limit: Default is 1 bytes
Understanding Send low tide limit: If the application does not call send () to copy the data in the application buff into the socket send buffer, the data of the send buffer is sent out by the kernel through the TCP protocol, and the data of the last socket send buffer is reduced. The amount of free space available is increasing, and finally exceeding the send buffer's sending low-tide limit, the Epoll hears the socket writable, allowing the Epoll loop to return and start processing write I/O events.
Send low tide limit: Default is 2048 bytes
The corresponding settings in Nginx:
Ngx_send_lowat settings
The setsockopt provided by GNU Linux is set and sent in the Ngx_send_lowat function in Nginx's src/event/ngx_event.c code: setsockopt (C->FD, Sol_ SOCKET, So_sndlowat, (const void *) &sndlowat, sizeof (int)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Description of So_rcvlowat and So_sndlowat in GNU Linux