Redis Client Connection
Redis can accept different type of clients' connections on the configured listening TCP port and on the Unix socket, if enabled.
When a new client connection is accepted, it performs the following operations:
- The client socket is put in non-blocking state since Redis uses multiplexing and non-blocking I/O.
- The TCP_NODELAY option is set in order to ensure that we don't have delays in our connection.
- A readable file event is created so that Redis is able to collect the client queries as soon as new data is available to be read on the socket.
Maximum number of Clients
In Redis config (redis.conf), there is a property called maxclients, which specifies that how many number of clients can be connected to Redis.
Following is the basic syntax of command.
The maximum number of clients depends upon the maximum number of file descriptors limit of OS. Its default value is 10000, although you can change this property.
Let's take an example to set the maximum number of clients to 100000, while starting the server.
||Returns the list of clients connected to Redis server
||Assigns a name to the current connection
||Returns the name of the current connection as set by CLIENT SETNAME
||This is a connections control command able to suspend all the Redis clients for the specified amount of time (in milliseconds)
||This command closes a given client connection.