w3resource

Redis Server: CLIENT PAUSE timeout

Redis CLIENT PAUSE Command

Redis CLIENT PAUSE command controlled the connection and able to suspend all the Redis clients for the specified amount of time. The command performs the following actions:

  • It stops processing all the pending commands from normal and pub/sub clients. However interactions with slaves will continue normally.
  • However, it returns OK to the caller ASAP, so the CLIENT PAUSE command execution is not paused by itself.
  • When the specified amount of time has elapsed, all the clients are unblocked: this will trigger the processing of all the commands accumulated in the query buffer of every client during the pause.

This command is useful to switch clients from a Redis instance to another one in a controlled way. For example during an instance upgrade the system administrator could do the following:

  • Pause the clients using CLIENT PAUSE
  • Wait a few seconds to make sure the slaves processed the latest replication stream from the master.
  • Turn one of the slaves into a master.
  • Reconfigure clients to connect with the new master.

Here are some common uses and scenarios for the "CLIENT PAUSE timeout" command:

  • Traffic Control: Temporarily pauses all client processing for the specified timeout period, useful for traffic management.
  • Maintenance Operations: Facilitates maintenance tasks by allowing a brief pause in client interactions without disconnecting them.
  • Failover Testing: Useful in simulating failover scenarios to ensure system resilience and proper handling of paused clients.
  • Data Consistency: Helps ensure data consistency during critical operations, such as backups or migrations, by pausing client commands.
  • Resource Management: Provides a way to manage and reduce load on the server during high-stress periods or critical updates.

Syntax:

Basic syntax of redis CLIENT PAUSE command is shown below:

CLIENT PAUSE timeout 

Available since

2.9.50.

Return Value

Simple string reply: The command returns OK or an error if the timeout is invalid.

Return Value Type

String

Previous: CLIENT GETNAME
Next: CLIENT SETNAME



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/redis/redis-server-client-pause-timeout.php