Redis receives a connection from a client by listening to a TCP port or a UNIX socket, and when a connection is established, the following actions are performed within Redis:
• First, the client socket is set to non-blocking mode because Redis uses a non-blocking multiplexing model for network event processing.
• Then set the Tcp_nodelay property for this socket and disable the Nagle algorithm.
• Then create a readable file event to listen to the data sent by this client socket.
Maximum number of 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 for MaxClients is 10000, and you can modify the value in redis.conf.
Config get maxclients
1) "MaxClients"
2) "10000"
Example
The following example sets the maximum number of connections to 10000 when the service starts:
Redis-server--maxclients 100000
Client commands