Database / ValKey Interview questions
How does Valkey implement publish/subscribe messaging?
SUBSCRIBE and PSUBSCRIBE register a client's interest in specific channels or glob patterns, and PUBLISH broadcasts a message to every client currently subscribed at that moment.
Classic pub/sub is fire-and-forget: messages are never stored, so a client that wasn't subscribed when a message was published simply never sees it, which distinguishes it from the durable, replayable log semantics of Streams.
In Cluster mode, SSUBSCRIBE/SPUBLISH scope pub/sub traffic to a single shard instead of fanning it out across the entire cluster bus, which reduces unnecessary cross-node message traffic.
More Related questions...