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 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

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.