Home >Backend Development >PHP Tutorial >How to correctly set the ulimit value of Linux, linuxulimit value_PHP tutorial
There is a max_conn parameter when learning swoole,
max_conn
Description: The maximum number of TCP connections allowed to be maintained by the server
Note: After setting this parameter, when the number of existing connections on the server reaches this value, new connections will be rejected. In addition, the value of this parameter cannot exceed the value of the operating system ulimit -n, and this value should not be set too large, because swoole_server will apply for a large piece of memory at one time for storage Information about each connection. This value will also affect the maximum number of concurrency of the server . In fact, Linux has a file handle limit, and the default value of Linux is not very high, usually 1024. The production server can easily reach this number.
The steps to correctly set the ulimit -n value of Linux are as follows:
1. First use the command ulimit -n to check the current value
2. vim /etc/security/limits.conf
It is recommended to set the following two items to 65535
* soft nofile 65535
* hard nofile 65535
(The * asterisk in front represents the global situation, for all users; nofile represents the number of file handles; The value of soft nofile cannot exceed the value of hard nofile )
3. Restart the Linux system
Command: shutdown -r now means restart immediately