Several issues related to network

How much tcp connection 1 machine supports up to

First, a connection is composed of [local ip, local port, remote ip, remote port], as a server, the first two are the same.

Then a port, IPv4 address, the number of ports 32 th * (2 ^ 16) = 48 th 2 2

In addition, the need to modify the file handle size. ulimit is the handle size of a process. 1024 default.

2 too many connections may have any effect

Too many connections tcp recycling problems of time wait, i.e., the server closes the connection active.

Vi /etc/sysctl.conf file can be modified, modify the timeout, socket recycling, reuse tcp, open syn cookies. 4 way.

3 cpu0 show busy

Soft interrupt too high, and most are concentrated in the same CPU.

Processing software, RPS, by hash convection load to a different cpu, the problem is not able to make good progress and handling cpu cpu is a break with the cpu, causing cache miss. To solve this problem, later versions of linux, there is a RFS of programs to prevent cache miss. But legend has it not easy to use.

Supports multi-queue card purchase hardware, software interrupt can completely solve the problem of concentrated in a single cpu0 (see release).

From this topic from another perspective: When your card is not played, cpu full load, in addition to a look with pidstat is not a procedural issue, or cs problem, you can also see if it is caused by too much cpu0 soft interrupt.

4 time wait and close wait difference

time wait is actively closed, this is to ensure that the impact of the new connection data from the old connections. Usually 2msl. And resources will be occupied.

Solution, 1 try not to take the initiative to disconnect.

2 In addition, close the socket linger option.

close wait each other off. At this point, we need to adjust once close to proactively shut down.

5 layers of experience to write the file cache

Normal call: 1 story, if it is DIO, it is 0 layer.


4236553-8173e2b49923ab80.png
image.png

What is 6 tcp sliding window

Sliding window receiving window size is used by the data terminal, used to inform the receiving side of the transmission side buffer size, in order to control the size of the data transmitted by the sender, so as to achieve the purpose of flow control

7 Why have a network card interrupt

It can be considered a "wake-up" CPU processing card data, otherwise the card buffer overflow, leading to drop data.

There is also a DMA manner.

8 bio What are the benefits, what with bio

The number of connected mode applies to relatively small BIO and fixed architecture, server resources in this way is relatively high, limited concurrent applications, the JDK1.4 previously only option, but the program intuitive and easy to understand.

Reproduced in: https: //www.jianshu.com/p/24ca9a2b3177

Guess you like

Origin blog.csdn.net/weixin_34314962/article/details/91060333