Rules for determining the size of the TCP and UDP socket sending and receiving buffer in Linux

Source: Internet
Author: User

1. Default Value of TCP sending and receiving buffer

[Root @ qljt core] # Cat/proc/sys/NET/IPv4/tcp_rmem
4096 87380 4161536

87380: Default Value of the TCP receiving buffer

 

[Root @ qljt core] # Cat/proc/sys/NET/IPv4/tcp_wmem
4096 16384 4161536

16384: Default Value of the TCP sending Buffer

 

2. Maximum Value of TCP or UDP sending and receiving buffer

[Root @ qljt core] # Cat/proc/sys/NET/CORE/rmem_max
131071

131071: half of the maximum configurable value of the TCP or UDP receiving buffer.

That is to say, when setsockopt (S, sol_socket, so_rcvbuf, & rcv_size, & optlen); is called, if rcv_size exceeds 131071

Getsockopt (S, sol_socket, so_rcvbuf, & rcv_size, & optlen); the value equals 131071*2 = 262142.

 

[Root @ qljt core] # Cat/proc/sys/NET/CORE/wmem_max
131071

131071: the maximum value of the TCP or UDP sending buffer can be set to half.

The same principle as above

 

3. Default Value of UDP sending and receiving buffer

[Root @ qljt core] # Cat/proc/sys/NET/CORE/rmem_default
111616: Default Value of UDP receiving buffer

 

[Root @ qljt core] # Cat/proc/sys/NET/CORE/wmem_default
111616

111616: Default Value of UDP sending Buffer

 

4. Minimum value of the TCP or UDP sending and receiving buffer

The minimum value of the TCP or UDP receiving buffer is 256 bytes, which is determined by the kernel macro;

The minimum value of the TCP or UDP sending buffer is 2048 bytes, which is determined by the kernel macro.

 

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.