在单个dyno上运行多个Sidekiq进程

3

我的Heroku上的Rails应用有一个Procfile,它会在我的动态虚拟服务器上启动单个Sidekiq进程。

worker: bundle exec sidekiq -C config/sidekiq.yml

在同一个dyno上启动多个Sidekiq进程是否可行?

我们的组织有一台内存很大的dyno,但我们没有充分利用它。在降低dyno规格之前,我想知道是否可以通过运行多个Sidekiq进程来利用它。

3个回答

2

2

一个选择是使用像https://github.com/ochinchina/supervisord这样的监控程序来运行Sidekiq。

将二进制文件添加到您的代码库中(例如bin/supervisord),并添加配置文件和Procfile条目。

对于具有8个核心的dyno,您的配置可能如下所示:

最初的回答

[program:sidekiq]
command = bundle exec sidekiq -e ${RACK_ENV:-development} -C config/sidekiq_large.yml
process_name = %(program_name)s_%(process_num)s
numprocs = 8
numprocs_start = 1
exitcodes = 0
stopsignal = TERM
stopwaitsecs = 40
autorestart = unexpected
stdout_logfile = /dev/stdout
stderr_logfile = /dev/stderr

Then in your Procfile:

worker_large: env [...] bin/supervisord -c sidekiq_worker_large.conf

确保您调整了Sidekiq并发设置。"

0

还有这个开源的第三方宝石,可以完成这个任务,而不需要支付 Sidekiq Enterprise 的费用。我没有使用过它,也不知道它的工作效果如何,但它看起来很不错。

https://github.com/vinted/sidekiq-pool

它没有最近的提交或许多Github星,但可能正常工作?

这里还有另一个警告您它是未完成的工作进展,但只是为了比较:

https://github.com/kigster/sidekiq-cluster


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接