Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Clockwork require its own process?

I've seen people say in a couple of different places that clockwork should be run on its own dyno, with a procfile that might look something like this (example from heroku):

clock: bundle exec clockwork lib/clock.rb

Is there any reason not to run it on the same dyno as the workers? With a process that looks something like this:

worker: bundle exec clockwork clock.rb & bundle exec sidekiq -C config/sidekiq.yml -L log/sidekiq.log

It seems to work fine this way, but I'd like to know the underlying reason why people say not to do it this way. Any guidance would be appreciated. Thanks in advance.

like image 457
toddmetheny Avatar asked Mar 26 '15 22:03

toddmetheny


1 Answers

I've recently starting running sidekiq and clockwork side by side, like this:

web: bundle exec puma -C config/puma.rb
worker: bundle exec clockwork clock.rb & bundle exec sidekiq & wait -n
# ^ https://help.heroku.com/CTFS2TJK/how-do-i-run-multiple-processes-on-a-dyno

And so far not seeing any issues.... This is a $25/month saving for us on the heroku hosting.

what would happen if sidekicks dies? (@Anthony said)

Normally sidekiq doesn't die (for me at least), I think it's because sidekiq is only managing jobs. The actual work happens in classes with a perform() method, and when those methods "raise / fail", it doesn't bring down the sidekiq parent with it. Sidekiq has a GUI that shows the retry queue and a dead queue, so dead jobs would end up in one of those places.

btw Heroku has an article on running multiple jobs in a single "dyno": https://help.heroku.com/CTFS2TJK/how-do-i-run-multiple-processes-on-a-dyno

OP said:

I've seen people say in a couple of different places

I'd be curious to read those comments though, if you have the links.

like image 179
american-ninja-warrior Avatar answered Oct 23 '22 17:10

american-ninja-warrior