Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how many simultaneous workers can we run? #16

Closed
hknaksu opened this issue Apr 21, 2022 · 2 comments
Closed

how many simultaneous workers can we run? #16

hknaksu opened this issue Apr 21, 2022 · 2 comments

Comments

@hknaksu
Copy link

hknaksu commented Apr 21, 2022

I have been testing delayed for a few days, seems rock solid!
I like the philosophy on sticking with ActiveJob and ActiveRecord database being used.
Got a quick question on the number of workers we can run safely at the same time?
I want to utilize all the cores on a big server. I have kicked 4 workers with 5 max_claims and
have not experienced any issues so far. Would there be any adverse effects starting up to 10 workers?
Thank you.

@smudge
Copy link
Member

smudge commented Apr 21, 2022

Hey @hknaksu, glad to hear that it's going well so far!

So, I haven't done any extensive profiling on anything other than our in-house deployment (which is Kubernetes-based), but think that the best way to utilize all of your cores is to spin up at least as many workers as there are cores. Ruby's global interpreter lock will prevent the threads themselves from benefitting from more than one core (so max_claims can only allow you to scale up concurrency on a single core). Therefore, running 10 or more workers on a relatively hefty server does seem reasonable to me.

That said, whether or not there are any adverse effects will depend heavily on the footprint of your app, and what kinds of jobs are being run. If the jobs are very DB-intensive, then you might see your DB CPU max out during periods of heavy background work, which could impact your web processes. And since these workers will be sharing resources on the same server, you may also hit up against memory or CPU constraints with the worker processes themselves. At Betterment we do regularly scale up to hundreds of workers, but they are distributed across multiple k8s nodes, so we mostly worry about running too many database-bound jobs at once.

@hknaksu
Copy link
Author

hknaksu commented Apr 21, 2022

This helps, thanks for the quick reply.

@hknaksu hknaksu closed this as completed Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants