Number of redis connections configuration
What this article shares to you is about the configuration of redis connections. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Let's take a look at it with the editor.
Number of redis client connections
Redis receives connections from clients by listening on a TCP port or socket
When a connection is established with the client, the following actions are done internally in redis:
(1) the client socket will be set to non-blocking mode, because redis uses a non-blocking multiplexing model in network time processing.
(2) then set the TCP_NODELAY property for the socket and disable the Nagle algorithm
(3) then create a readable file event to listen to the data transmission of this client socket.
Number of redis connections and maximum connections
1. Number of connections View
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#Clientsconnected_clients:621client_longest_output_list:0client_biggest_input_buf:0blocked_clients:0127.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 purl 6379 >
two。 Set, modify
1. After version 2.6, you can modify the maximum number of connections configuration. The default is 10000, which can be modified in the redis.conf configuration file.
... # maxclients 10000...2.config set maxclients num can set the maximum number of connections allowed by redis 127.0.0.1 CONFIG set maxclients 10OK127.0.0.1:6379 6379 >
3. Add the parameter-- maxclients 100000 to set the maximum number of connections when starting the redis.service service
Redis-server-- maxclients 100000-f / etc/redis.conf is the configuration of the number of redis connections. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.