限制Sidekiq中每个队列的工作量

时间:2013-04-02 07:42:31

标签: ruby-on-rails ruby sidekiq

我一直在尝试使用sidekiq-limit_fetch gem来限制每个队列的工作量,而Sidekiq似乎“看到”日志中强加的限制,但是当我看到工作人员时,忽略了限制。< / p>

以下是Sidekiq看到限制的日志部分:

2013-04-02T05:47:19Z 748 TID-11ilcw DEBUG: {:queues=>
    ["recommendvariations",
     "recommendvariations",
     "recommendvariations",
     "recommendphenotypes",
     "recommendphenotypes",
     "recommendphenotypes",
     "preparse",
     "preparse",
     "preparse",
     "parse",
     "parse",
     "parse",
     "zipgenotyping",
     "zipgenotyping",
     "zipfulldata",
     "deletegenotype",
     "fitbit",
     "frequency",
     "genomegov",
     "mailnewgenotype",
     "mendeley_details",
     "mendeley",
     "pgp",
     "plos_details",
     "plos",
     "snpedia",
     "fixphenotypes"],
   :concurrency=>5,
   :require=>".",
   :environment=>"production",
   :timeout=>8,
   :profile=>false,
   :verbose=>true,
   :pidfile=>"/tmp/sidekiq.pid",
   :logfile=>"./log/sidekiq.log",
   :limits=>
    {"recommendvariations"=>1,
     "recommendphenotypes"=>1,
     "preparse"=>2,
     "parse"=>2,
     "zipgenotyping"=>1,
     "zipfulldata"=>1,
     "fitbit"=>3,
     "frequency"=>10,
     "genomegov"=>1,
     "mailnewgenotype"=>1,
     "mendeley_details"=>1,
     "mendeley"=>1,
     "pgp"=>1,
     "plos_details"=>1,
     "plos"=>1,
     "snpedia"=>1,
     "fixphenotypes"=>1},
   :strict=>false,
   :config_file=>"config/sidekiq.yml",
   :tag=>"snpr"}

here's the sidekiq.yml。从sidekiq的web界面来看,这些限制被忽略了 - 现在,我在“推荐变量”上得到了2名工人 - 但这应该是1。

我在bundle exec sidekiq -e production -C config/sidekiq.yml开始工作。

有没有其他人遇到过这个?

1 个答案:

答案 0 :(得分:4)

您是否尝试在sidekiq.rb初始化程序文件中设置限制?

像这样:

Sidekiq::Queue['recommend'].limit = 1

它对我有用。