The choice of DNS protocol for UDP and TCP is usually in the following two cases:
(1) If the DNS client program knows in advance that the length of the response message is greater than 512B, it should use a TCP connection ;
NOTICE: When the primary domain name server and the secondary domain name server perform zone transfer, the amount of data is usually relatively large. All DNS regulations stipulate that the zone transfer uses the TCP protocol.
(2) If the parsing program does not know the length of the response message, it generally uses the UDP protocol to send the DNS query message. If the length of the DNS response message is greater than 512B, the server will truncate the response message. In this case, the DNS client The program usually resends the original query request using TCP so that it can receive a complete response from the DNS server in the future.
To sum up: The DNS client program usually uses UDP to connect with the DNS server program without knowing it (does not know whether the length of the DNS response message exceeds 512B), and uses TCP to connect with the knowledge .When using locks to ensure on-site security, there may be situations where liveness failures may occur , including starvation, loss of signals, and livelocks and deadlocks . [In addition to deadlock, multi-threading encounters the most active problem]
Starvation : Refers to the permanent denial of resources that a thread needs to access , so that it can no longer continue. Solving the starvation problem requires balancing thread competition for resources, such as thread priority, task weight, and execution cycle.
Livelock : Although the thread is not blocked , it keeps trying to retry but always fails due to a certain condition not being met. Solving the livelock problem requires introducing some randomness to the retry mechanism . For example, if a collision is detected, then pause for a random amount of time to retry, which greatly reduces the chance of a collision.
7 Function overloading
When a friend function is overloaded, the parameter list is 1, indicating that it is 1 yuan, and it is 2, indicating that it is a 2-elementmember function .
The number of ip addresses , the more the system ip number, the more the number of established connections.
Memory, let's talk about it from the perspective of the configuration file. Open the configuration file with vim: #vim /etc/sysctl.conf
net.ipv4.tcp_mem[0]: Below this value, TCP has no memory pressure.
net.ipv4.tcp_mem[1]: At this value, the memory pressure phase is entered.
net.ipv4.tcp_mem[2]: Above this value, TCP refuses to allocate the socket. The above unit of memory is a page, not a byte . Memory size affects network
The maximum number of handles affects the upper limit ofnetwork operations in vfs. The role of the network card is to encapsulate and unencapsulate data, and does not involve concurrency
Memory size, IP address and the maximum number of file handles will affect the number of concurrent connections to the Linux server