To understand TCP several state of the students, we should all know, TCP active disconnected side will appear TIME_WAIT state, TIME_WAIT state will keep the MSL 2 time, this is mainly used to prevent, take the initiative to open a party sent to the LAST lost a FIN ACK, lead to passive passive close one LAST – ACK timer timeout retransmission FIN, avoid the TCP state of chaos. However, in the case of high server concurrency, this default mechanism may cause the server to maintain a large amount of TIME_WAIT state, resulting in a large waste of resources, which may affect subsequent connection and request processing. To solve this phenomenon, we can modify the configuration of the server. Here we take the configuration of a Linux server on Aliyun as an example.
[root@izbp1dnvbin1s4fqqr8izfz ~]# cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
fs.file-max = 1000000
net.core.somaxconn = 2048
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 4096 16777216
net.ipv4.tcp_wmem = 4096 4096 16777216
net.ipv4.tcp_mem = 786432 2097152 3145728
net.ipv4.tcp_max_syn_backlog = 16384
net.core.netdev_max_backlog = 20000
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_max_orphans = 131072
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_max_tw_buckets = 40000
vm.swappiness = 0
net.ipv4.neigh.default.gc_stale_time=120
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.default.arp_announce = 2
Net. Ipv4.com.lo. Arp_announce =2
net. Ipv4.com.conf.all. Arp_announce =2
net Net ipv4.tcp_fin_TIMEOUT (FIN timeout), net ipv4.tcp_TW_reuse (time_wait state socket reuse to allow socket to be used for a new TCP connection, default 0, Net ipv4.tcp_tw_recycle(fast recovery of time-wait sockets in TCP connections, default is 0, close), and then use the /sbin/ sysctL-p command to make the configuration work.
[root@izbp1dnvbin1s4fqqr8izfz ~]# cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
fs.file-max = 1000000
net.core.somaxconn = 2048
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 4096 16777216
net.ipv4.tcp_wmem = 4096 4096 16777216
net.ipv4.tcp_mem = 786432 2097152 3145728
net.ipv4.tcp_max_syn_backlog = 16384
net.core.netdev_max_backlog = 20000
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_max_orphans = 131072
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_max_tw_buckets = 40000
vm.swappiness = 0
net.ipv4.neigh.default.gc_stale_time=120
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.default.arp_announce = 2
Net. Ipv4.com.lo. Arp_announce =2
net. Ipv4.com.conf.all. Arp_announce =2
net Net ipv4.tcp_fin_TIMEOUT (FIN timeout), net ipv4.tcp_TW_reuse (time_wait state socket reuse to allow socket to be used for a new TCP connection, default 0, Net ipv4.tcp_tw_recycle(fast recovery of time-wait sockets in TCP connections, default is 0, close), and then use the /sbin/ sysctL-p command to make the configuration work.
Read More:
- TIDB-kafka server: Message was too large, server rejected it to avoid allocation error
- Solutions to the problem that Ubuntu is stuck when copying large files and can’t mount mobile hard disk normally
- Java long type error: error: integer number too large
- How to Fix IDM has been Registered with a Fake Serial Number
- TCP error code 10061: unable to connect because the target machine actively refused http://localhost :8732/Design_ Time_ Addresses/TeacherHelperServic
- Solutions to problems encountered when installing isc-dhcp-server on debian9.6
- Creating Server TCP listening socket 127.0.0.1:6379: bind: No error。。。 Solutions to problems encountered in startup
- socket.error : [errno 10048] and view PID process number and port number
- JDBC connect to Sql Server to connect to the database–The TCP/IP connection to the host localhost, port 1433 has failed
- After switching the tidb database, an error could not commit JDBC transaction appears from time to time
- The import Maven project appears http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException Solutions
- The file server reports an error of 413, and the file uploaded by nginx reports an error of 413 request entity too large
- HTTP 405 Error: Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
- How to get the current time in java time string
- Error: RPC failed; HTTP 504 curl 22 the requested URL returned error: 504 gateway time out
- MySQL error 1205 (HY000): lock wait timeout exceeded; try restarting transaction
- The difference between sleep() and wait() in Java
- The time of the time database displayed by the front end is inconsistent
- Lock wait timeout exceeded — transaction and index
- SQL Server import MDF and LDF files appear: unable to open physical file “D:\ XX.mdf “。 Operating system error 5: “5 (access denied. )”Solutions