How to control concurrency per queue?

后端 未结 3 1006
情深已故
情深已故 2021-02-08 03:45

Sidekiq documentation suggests I can only control the global concurrency of sidekiq, rather than per queue. I am raising a question here with hope that there\'s a solution for a

3条回答
  •  一向
    一向 (楼主)
    2021-02-08 04:04

    The Enterprise version of Sidekiq has enhanced concurrency control:

    https://github.com/mperham/sidekiq/wiki/Ent-Rate-Limiting

    In particular, you can limit concurrency of arbitrary jobs by count or interval. e.g. up to 20 jobs at a time; or up to 20 jobs per (60 seconds/1 hour, etc). The interval can be rolling or clock-aligned.

    This could satisfy the per-queue control you're asking about with the correct usage. But it can be much more flexible, controlling concurrency by your own groupings. For example, you could specify up to 30 jobs per second can hit PayPal. Or, you could specify 30 jobs per second per state can hit Paypay, and 15 jobs per state can hit Stripe simultaneously. (Assuming 'state' is an attribute in your data, of course.)

    There's no limit to how fine-grained you want to define your groups.

提交回复
热议问题