Set the Linux ulimit value correctly. Correctly set the Linux ulimit value. when the linuxulimit value learns swoole, there is a max_conn parameter. max_conn description: description of the maximum number of TCP connections allowed by the server: set this parameter to set the Linux ulimit value correctly. The value of linuxulimit
When learning swoole, there is a max_conn parameter,
Max_conn
Description: maximum number of TCP connections allowed by the server.
Note: After this parameter is set, when the number of connections on the server reaches this value, the new connection will be rejected. In addition, the value of this parameter cannot exceed the operating systemUlimit-nAnd this value cannot be too large, because swoole_server willOne-time memory applicationStores information about each connection. This value also affects the maximum number of concurrent servers. In fact, Linux has a file handle limit, and the default value of Linux is not very high. generally, it is 1024. The production server can easily reach this number.
To correctly set the Linux ulimit-n value, follow these steps:
1. first run the command ulimit-n to view the current value.
2. vim/etc/security/limits. conf
We recommend that you set the following two items to 65535.
* Soft nofile 65535
* Hard nofile 65535
(The asterisk (*) in the preceding figure indicates the global attribute. for all users, nofile indicates the number of file handles. the soft nofile value cannot exceed the hard nofile value)
3. restart the Linux system
Command: shutdown-r now indicates immediate restart
When swoole is learned by worker, there is a max_conn parameter. max_conn description: the maximum number of TCP connections allowed by the server. description: set this parameter...