Home » Redis Client Connection

Redis Client Connection

by Online Tutorials Library

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.

Redis Client Connection 1

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.

Example

Let’s take an example to set the maximum number of clients to 100000, while starting the server.


Client Commands

Index Command Description
1 CLIENT LIST Returns the list of clients connected to Redis server
2 CLIENT SETNAME Assigns a name to the current connection
3 CLIENT GETNAME Returns the name of the current connection as set by CLIENT SETNAME
4 CLIENT PAUSE This is a connections control command able to suspend all the Redis clients for the specified amount of time (in milliseconds)
5 CLIENT KILL This command closes a given client connection.

Next TopicRedis Pipelining

You may also like