PING(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’– PING πŸ’–

okay bestie, welcome to the Valkey Command Manual β€” this is the ping(3valkey) page and it's literally the shortest glow-up in the whole protocol. sit down, hydrate, let's go 🫢


✨ NAME ✨

ping β€” returns the server's liveliness response. that's it. that's the whole job. she checks if your fave is still breathing πŸ’…


🌸 SYNOPSIS 🌸

PING [message]

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea: if you don't hand her an argument, she hits you back with PONG. no argument, no problem, just PONG. πŸŽ€

But if you do pass an argument? She returns a copy of it as a bulk. literally just hands it right back to you, unchanged, like a friend returning your hoodie.

This command is lowkey useful for three whole things:

  1. Testing whether a connection is still alive. is the link still linking?? πŸ‘€
  2. Verifying the server's ability to serve data β€” and bestie, an error is returned when this isn't the case. like, for example, during load from persistence, or when you're accessing a stale replica. so if it throws hands, that's your answer. πŸ’€
  3. Measuring latency. how fast is she moving?? ⭐
Now the important plot twist, so pay attention: if the client is in RESP2 and is subscribed to a channel or a pattern, she will instead return a multi-bulk with a "pong" in the first position and an empty bulk in the second position β€” unless an argument is provided, in which case she returns a copy of the argument. yes, really. RESP2 subscription girlies get a whole different reply. iykyk 🌈

πŸ’Œ REPLY πŸ’Œ

Any of the following, bestie:


πŸ”₯ COMPLEXITY πŸ”₯

O(1)

constant time, no cap. she does not care how big your server is, she answers instantly. iconic behavior honestly πŸ‘‘


πŸŽ€ ACL CATEGORIES πŸŽ€

@connection @fast


🌸 HISTORY 🌸

  • Available since: 1.0.0 β€” an OG. been here since day one fr fr πŸ’œ

⭐ EXAMPLES ⭐

127.0.0.1:6379> PING
PONG
127.0.0.1:6379>
127.0.0.1:6379> PING "hello world"
"hello world"

see?? she said it right back. no notes. πŸ’…


πŸ‘‘ 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-pause(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), quit(3valkey), reset(3valkey), select(3valkey)


and that's the whole page, bestie!! 🧚 this was Valkey 9.0.0, dated 2025-10-21, and honestly? she ate. go ping something and feel alive. mwah πŸ’–

πŸ“¦ where this page comes from