English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Client Connections

Redis receives connections from clients by listening to a TCP port or a Unix socket. After a connection is established, Redis internally performs the following operations:

  • Firstly, the client socket will be set to non-blocking mode because Redis uses a non-blocking multi-threading model for network event handling.

  • Then set the TCP_NODELAY attribute for this socket to disable Nagle algorithm

  • Then create a readable file event to listen for data transmission from this client socket

Maximum number of connections

In Redis2.4 In the previous version, the maximum number of connections was directly hardcoded in the code, while in2.6In this version, this value has become configurable.

The default value of maxclients is 10000, you can also modify this value in redis.conf.

config get maxclients
1)  "maxclients"
2)  "10000"

Online Example

In the following example, we set the maximum number of connections to the service at startup 100000:

redis-server --maxclients 100000

Client Command

S.N.CommandDescription
1CLIENT LISTReturn the list of clients connected to the redis service
2CLIENT SETNAMESet the name of the current connection
3CLIENT GETNAMEGet the service name set with the CLIENT SETNAME command
4CLIENT PAUSESuspend client connection, specify the suspension time in milliseconds
5CLIENT KILLClose Client Connection