Enhance streams to support readers that might be interested in the entries in a stream, otherwise producers efficiently noop.
Assuming you have some producers and consumers that a relatively decoupled it might not be clear to the producer that there is any consumer interested in the entry or stream that it is about to produce. Currently with the XADD command a stream is automatically created when XADD is called, even though a consumer may never end up consuming it.
A consumer can flag its interest in a stream by using the MKSTREAM option to create an empty stream to consume entries in the future for that stream.
But a producer to opt out of producing entries for which there is no XGROUP it must first run an KEYS command on the streams id. Then based on the result of the KEYS command decide not to use the XADD command. However if this is used for 10,000 messages across 1,000 streams the producer must call one KEYS command with all 1,000 stream ids to determine if they exist then call XADD when it has determined the stream does exist.
If instead XADD could use a NOMKSTREAM option it could pipeline those 10,000 messages and let Redis determine if there is a stream to add those messages to, or drop them if there is not.
The existing design may be consider preferable because it involves round tripping 1,000 stream ids, then on the client side, filtering out what data to send. While it would increase processing on the client side, it would decrease the amount of commands/data sent across the wire. But it would also leave a race condition, for when a consumer removes himself and the stream, and a producer XADDs entries for that stream. You might end up with an orphaned stream with producers writing data into it and no consumer reading that data out in the foreseeable future.
Comment From: madolson
Status: This is likely a low effort, since it's just a new argument. The command should probably be updated to NXADD to be consistent with other similar commands.