Number of redis client connections
Redis receives connections from clients by listening to a TCP port or socket,
When established with the client After connection, redis will perform the following operations internally:
(1) The client socket will be set to non-blocking mode, because redis uses a non-blocking multiplexing model for network time processing;
(2) Then set the TCP_NODELAY attribute for this socket and disable the Nagle algorithm;
(3) Then create a readable file event to monitor the data sending of this client socket.
Number of redis connections and maximum number of connections
1. View the number of connections
Method 1: Use: info clients on the redis-cli command line to view the current number of redis connections
127.0.0.1:6379> info clients #Clients connected_clients:621 client_longest_output_list:0 client_biggest_input_buf:0 blocked_clients:0 127.0.0.1:6379>
Method 2: config get maxclients can query the maximum number of connections allowed by redis
127.0.0.1:6379> CONFIG GET maxclients ##1) "maxclients" ##2) "10000" 127.0.0.1:6379>
2. Settings and modifications
1. In versions after 2.6, the maximum number of connections can be modified. The default is 10000, which can be found in redis.conf Modify the configuration file
... # maxclients 10000 ... 2.config set maxclients num 可以设置redis允许的最大连接数 127.0.0.1:6379> CONFIG set maxclients 10 OK 127.0.0.1:6379>
3. When starting the redis.service service, add the parameter --maxclients 100000 to set the maximum number of connections limit
redis-server --maxclients 100000 -f /etc/redis.conf
The above is the detailed content of How many redis connections are configured?. For more information, please follow other related articles on the PHP Chinese website!