Linux Performance Tuning 14: Adjusting socket buffer talking about linux Performance Tuning 13: Performance Analysis Related Concepts http://www.bkjia.com/ OS /201307/229890.html applications through socket system calls and remote host communication, each socket has a read/write buffer. The read buffer zone stores the data sent from the remote host. If the buffer zone is full, the data is discarded, and the write buffer period stores the data to be sent to the remote host. If the write buffer zone is slow, then the system application will be blocked when writing data. We can see that the buffer zone has a size. BDP provides a simple method to calculate the theoretically optimal TCP socket buffer size (which stores the data waiting for transmission and waiting for the application to receive ). If the buffer is too small, the TCP window cannot be fully opened, which will limit the performance. If the buffer area is too large, valuable memory resources will be wasted. If the buffer size you set is suitable, you can use the available bandwidth BDP = bandwidth * latency (in bytes) bandwidth * latency/8*2 ^ 20 = *** B bandwidth: Mebibites latency: s (RTT) Note: core must be adjusted before tcp adjustment. For tcp, udp cannot exceed the core limit. Default Value: net. core. rmem_max = 131071 128Knet. core. rmem_default = 123168net. core. wmem_max = 131071net. core. wmem_default = 124928. net. ipv4.tcp _ rmem = 4096 87380 2691072net. ipv4.tcp _ wmem = 4096 16384 2691072 example: bandwidth: 1.5 M 500 M latency: ms 3000ms1. 5*0.5/8*2 ^ 20 ====== net. ipv4.tcp _ wmem100 * 3/8*2 ^ 20 ====== net. ipv4.tcp _ wmem