Redis command o...login
Redis command operation Chinese manual
author:php.cn  update time:2022-04-12 14:07:28

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.CommandDescription
1CLIENT LISTReturn the list of clients connected to the redis service
2CLIENT SETNAMESet the current connection Name
3CLIENT GETNAMEGet the service name set by the CLIENT SETNAME command
4CLIENT PAUSESuspend the client connection, specify the suspension time in milliseconds
5CLIENT KILLClose the client connection

php.cn