CLIENT-PAUSE(3valkey)
π CLIENT-PAUSE π
okay bestie, so this one lives in the valkey command manual (that's the 3valkey manual, section 3, iykyk) and it's literally the "everybody freeze" button π§β¨
β¨ NAME β¨
client-pause β Suspends commands processing. that's it. that's the whole job. it pauses. the processing. of commands. π
πΈ SYNOPSIS πΈ
CLIENT PAUSE timeout [WRITE | ALL]
π¦ DESCRIPTION π¦
So CLIENT PAUSE is a connections control command, and what it does is suspend all the Valkey clients for however long you tell it to (the time is in milliseconds, jsyk β±οΈ).
Here's the whole rundown of what it actually does, no cap:
- It stops processing all the pending commands from normal and pub/sub clients β but only for the given mode. Interactions with replicas keep going like normal though, they're not affected. also lowkey important: clients are formally paused when they try to execute a command, so the server isn't doing any work for clients that are just sitting there inactive. slay, efficient.
- BUT β and this is the iconique part β it returns
OKto the caller ASAP. so theCLIENT PAUSEcommand's own execution is not paused by itself. main character behavior honestly. - And when the amount of time you specified has elapsed, all the clients get unblocked: that triggers the processing of all the commands that piled up in every client's query buffer during the pause. the floodgates open π§
Client pause currently supports two modes:
- ALL: This is the default mode. All client commands are blocked. every single one. no exceptions.
- WRITE: Clients are only blocked if they attempt to execute a write command. so reads can still go off.
And for the WRITE mode, some commands have special behavior β pay attention bestie, this is the part that trips people up:
EVAL/EVALSHA: Will block client for all scripts.PUBLISH: Will block client.PFCOUNT: Will block client.WAIT/WAITAOF: Acknowledgments will be delayed, so these commands will appear blocked.
π why you'd even use this π
This command is useful because it makes it able to switch clients from a Valkey instance to another one in a controlled way. like, actually controlled, not vibes-based. 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 replicas processed the latest replication stream from the primary.
- Turn one of the replicas into a primary.
- Reconfigure clients to connect with the new primary.
The recommended mode for client pause is WRITE. This mode will stop all replication traffic, can be aborted with the valkey-client-unpause(7) CLIENT UNPAUSE command, and allows reconfiguring the old primary without risking accepting writes after the failover. This is also the mode used during cluster failover. so likeβ¦ it's the moment, fr fr π
This command also prevents keys to be evicted or expired during the time clients are paused. This way the dataset is guaranteed to be static β not just from the point of view of clients not being able to write, but also from the point of view of internal operations. everything frozen. nothing moving. the dataset is in its β¨stillness eraβ¨
π¬ REPLY π¬
valkey-protocol(7) Simple string reply: OK or an error if the timeout is invalid. so like, give it a bad timeout and it will read you to filth π
β‘ COMPLEXITY β‘
π ACL CATEGORIES π
@admin @connection @dangerous @slow
π HISTORY π
- Available since:
3.0.0 - Changed in
6.2.0:CLIENT PAUSE WRITEmode added along with the mode option.
π SEE ALSO π
auth(3valkey), client(3valkey), client-caching(3valkey), client-capa(3valkey), client-getname(3valkey), client-getredir(3valkey), client-help(3valkey), client-id(3valkey), client-import-source(3valkey), client-info(3valkey), client-kill(3valkey), client-list(3valkey), client-no-evict(3valkey), client-no-touch(3valkey), client-reply(3valkey), client-setinfo(3valkey), client-setname(3valkey), client-tracking(3valkey), client-trackinginfo(3valkey), client-unblock(3valkey), client-unpause(3valkey), echo(3valkey), hello(3valkey), ping(3valkey), quit(3valkey), reset(3valkey), select(3valkey)
k that's the whole page bestie π go pause something responsibly, and remember: WRITE mode is the recommended one, not that I'm telling you what to do, but I am π«Ά
Version 9.0.0 Β· 2025-10-21 Β· CLIENT-PAUSE(3valkey) β mwah, catch you in the next manpage πβπ
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms