Home > Database > Redis > How many redis connections are configured?

How many redis connections are configured?

anonymity
Release: 2019-06-05 09:54:08
Original
9778 people have browsed it

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.

How many redis connections are configured?

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>
Copy after login

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>
Copy after login

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>
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template