Redis listens to a TCP port or UNIX socket to receive connections from clients. After a connection is established, redis performs the following operations internally:
- First, the client socket is set to non-blocking mode because redis adopts the non-blocking multiplexing model for network event processing.
- Then set the tcp_nodelay attribute for the socket to disable the Nagle algorithm.
- Create a readable file event to listen to the data sent from the client socket.
Max connections
In redis2.4, the maximum number of connections is directly hardcoded in the Code, and in version 2.6 this value becomes configurable.
The default value of maxclients is 10000. You can also modify this value in redis. conf.
ConfigGetMaxclients1) "Maxclients"2) "10000"
Instance
For the following instances, we set the maximum number of connections to 100000 at service startup:
Redis-Server--Maxclients100000
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 |
Obtain the service name set through the client setname command |
4 |
Client pause |
Suspends a client connection, specifying the suspension time in milliseconds |
5 |
Client kill |
Redis Client Connection