Redis Client Connection
Redis accepts connections from clients by listening on a TCP port or a Unix socket. When a connection is established, Redis internally performs the following operations:
- First, the client socket is set to non-blocking mode, because Redis uses a non-blocking multiplexing model for network event handling.
- Then, the TCP_NODELAY attribute is set for this socket to disable the Nagle algorithm.
- Then a readable file event is created to monitor data transmission on this client socket.
Maximum Connections
In Redis 2.4, the maximum number of connections was hardcoded directly in the code, while in version 2.6 this value became configurable.
The default value of maxclients is 10000, and you can also modify this value in redis.conf.
config get maxclients 1) "maxclients" 2) "10000"
Example
In the following example, we set the maximum number of connections to 100000 when the server starts:
redis-server --maxclients 100000
Client Commands
| S.N. | Command | Description |
|---|---|---|
| 1 | CLIENT LIST | Returns the list of clients connected to the Redis service |
| 2 | CLIENT SETNAME | Sets the name of the current connection |
| 3 | CLIENT GETNAME | Gets the service name set via the CLIENT SETNAME command |
| 4 | CLIENT PAUSE | Suspends the client connection for the specified time in milliseconds |
| 5 | CLIENT KILL | Closes the client connection |