Redis client connection
Redis receives connections from clients by listening to a TCP port or Unix socket. When a connection is established, Redis will perform the following operations internally:
-
First, the client socket will be set to non-blocking mode because Redis uses a non-blocking multiplexing model for network event processing.
Then set the TCP_NODELAY attribute for this socket and disable the Nagle algorithm
Then create a readable file event to listen to this client socket Data sent
Maximum number of connections
In Redis2.4, the maximum number of connections is directly hard-coded in the code, while in version 2.6 This value becomes configurable.
The default value of maxclients is 10000. You can also modify this value in redis.conf.
config get maxclients 1) "maxclients" 2) "10000"
Instance
In the following example, we set the maximum number of connections to 100000 when the service starts:
redis-server --maxclients 100000
Client command
S.N. | Command | Description |
---|---|---|
1 | CLIENT LIST | Return the list of clients connected to the redis service |
2 | CLIENT SETNAME | Set the current connection Name |
3 | CLIENT GETNAME | Get the service name set by the CLIENT SETNAME command |
4 | CLIENT PAUSE | Suspend the client connection, specify the suspension time in milliseconds |
5 | CLIENT KILL | Close the client connection |