Description of So_rcvlowat and So_sndlowat in GNU Linux

Source: Internet
Author: User
Tags epoll readable

/********************************************************************* * 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 socket interfaces. The data in the receive buffer must reach the specified number, and the kernel notifies the process "readable." For example, trigger Select or Epoll. Returns "Socket interface readable".

Send low tide limit: For TCP socket interface, and receive low tide limit a reason.


Understanding receiving low tide limit: Assuming that 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 that the accept buffer receives data from many other send-side send buffers. is sure to cause a buffer overflow to be accepted, so setting a threshold to accept the low tide, when the epoll to hear the data of a socket's acceptance buffer is more than the acceptance of the low tide limit, then trigger read-ready, so that the Epoll loop back, start processing read I/O events.


Receive low tide limit: Default 1 bytes


Understanding Send low tide limit: Assuming that the application does not call send () to copy the data in the application buff into the socket send buffer, the data in the send buffer is sent by the kernel through the TCP protocol. The data of the last socket send buffer is getting less and more and the remaining space is available. Finally, the sending buffer is exceeded to send the low ebb limit. Then Epoll hear this socket can be written. Causes the Epoll loop to return. Start processing write I/O events.


Send low tide limit: Default 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)


Description of So_rcvlowat and So_sndlowat in GNU Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.