Redis Client Connection
Redis accepts client connections by listening on a TCP port or a Unix socket. When a connection is established, Redis performs the following internal 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 on this socket to disable the Nagle algorithm
- Then a readable file event is created to listen for data sent by 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 starting the service:
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 | Set the name of the current connection |
| 3 | CLIENT GETNAME | Get the service name set via the CLIENT SETNAME command |
| 4 | CLIENT PAUSE | Suspend the client connection, specifying the suspension time in milliseconds |
| 5 | CLIENT KILL | Close the client connection |