English 中文(简体)
Redis - Client Connection
  • 时间:2024-12-27

Redis - Cpent Connection


Previous Page Next Page  

Redis accepts cpents’ connections on the configured pstening TCP port and on the Unix socket, if enabled. When a new cpent connection is accepted, the following operations are performed −

    The cpent 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 cpent queries as soon as new data is available to be read on the socket.

Maximum Number of Cpents

In Redis config (redis.conf), there is a property called maxcpents, which describes the maximum number of cpents that can connect to Redis.

Following is the basic syntax of command.

config get maxcpents  

1) "maxcpents" 
2) "10000" 

By default, this property is set to 10000 (depending upon the maximum number of file descriptors pmit of OS), although you can change this property.

Example

In the following example, we have set the maximum number of cpents to 100000, while starting the server.

redis-server --maxcpents 100000 

Cpent Commands

Sr.No Command Description
1 CLIENT LIST Returns the pst of cpents 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 cpents for the specified amount of time (in milpseconds)
5 CLIENT KILL This command closes a given cpent connection.
Advertisements