Redis Client Connection
Redis receives connections from clients by listening on a TCP port or a Unix socket. Once a connection is established, Redis performs the following operations internally:
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.
A readable file event is then created to listen for data sent from the client socket.
Maximum Number of Connections
In Redis 2.4, the maximum number of connections was hardcoded in the code, but in version 2.6, this value became configurable.
The default value for maxclients is 10000, and you can modify this value in redis.conf.
config get maxclients
1) "maxclients"
2) "10000"
Example
The following example sets 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 a list of client connections to the Redis service |
2 | CLIENT SETNAME | Sets the name for the current connection |
3 | CLIENT GETNAME | Gets the service name set by the CLIENT SETNAME command |
4 | CLIENT PAUSE | Suspends client connections for a specified duration in milliseconds |
5 | CLIENT KILL | Closes a client connection |