Commit 13e6ec5b authored by Marc Gravell's avatar Marc Gravell

Clarified the pub/sub alternative to blocking pops, because people don't seem to get it

parent 4cc1867b
...@@ -73,7 +73,13 @@ For this reason, the only redis features that StackExchange.Redis does not offer ...@@ -73,7 +73,13 @@ For this reason, the only redis features that StackExchange.Redis does not offer
db.ListLeftPush(key, newWork, flags: CommandFlags.FireAndForget); db.ListLeftPush(key, newWork, flags: CommandFlags.FireAndForget);
sub.Publish(channel, ""); sub.Publish(channel, "");
This achieves the same intent without requiring blocking operations. This achieves the same intent without requiring blocking operations. Notes:
- the *data* is not sent via pub/sub; the pub/sub API is only used to notify workers to check for more work
- if there are no workers, the new items remain buffered in the lsit; work does not fall on the floor
- only one worker can pop a single value; when there are more consumers than producers, some consumers will be notified and then find there is nothing to do
- when you restart a worker, you should *assume* there is work so that you process any backlog
- but other than that, the semantic is identical to blocking pops
The multiplexed nature of StackExchange.Redis makes it possible to reach extremely high throughput on a single connection while using regular uncomplicated code. The multiplexed nature of StackExchange.Redis makes it possible to reach extremely high throughput on a single connection while using regular uncomplicated code.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment