May 14, 2021 Swoole
ulimit -n to be adjusted to 100,000 or more. U limit -n 100,000 can be modified by executing at the command line. If it cannot be modified, you need to set /etc/security/limits.conf to join
* soft nofile 262140
* hard nofile 262140
root soft nofile 262140
root hard nofile 262140
* soft core unlimited
* hard core unlimited
root soft core unlimited
root hard core unlimited
Swoole uses unix socket dgram for inter-process communication, which needs to be adjusted if the volume of requests is large.
The system defaults to 10 and can be set to 100 or larger.
Or increase the number of worker processes and reduce the number of requests allocated by a single worker process.
Modify this parameter to increase the memory size of the socket cache
net.ipv4.tcp_mem = 379008 505344 758016
net.ipv4.tcp_wmem = 4096 16384 4194304
net.ipv4.tcp_rmem = 4096 87380 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
Whether it's socket reuse, the purpose of this function is that the listening port can be quickly reused when the server restarts. If this parameter is not set, the server restarts with a failure to start if the port is not released in time
With socket quick recycling, the short connection server needs to turn this parameter on
This kernel parameter needs to be adjusted when using message queues as a means of communication between processes
Set kernel parameters
kernel.core_pattern = /data/core_files/core-%e-%p-%t
View the limits of the current coredump file with the ulimit -c command
ulimit -c
If it is 0, you need to modify /etc/security/limits.conf to set the limit.
When core-dump is turned on, the process is exported to the file in the event of an exception to the program. It is of great help to investigate procedural issues
For example: modify net.unix.max after the use of the net.dgram?qlen
cat /proc/sys/net/unix/max_dgram_qlen
If the modification is successful, here is the value of the new setting.