-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Experiencing a lot of database overhead with forked jobs #1871
Comments
Hi @SimantovYousoufov, yup, I have seen this too. There can be a fair bit of overhead creating new connections, etc. on every fork. To get around this we started using resque-multi-job-forks which lets us not have to fork for every job. Once enabled, we saw a massive performance increase with the job execution time and also a noticeable load decrease on our db. Have you tried using that plugin? |
Yeah Rails does automatically reconnect after forking now. I don't think Resque can actually do anything to solve this other than forking less often. You can potentially try to configure Rails to not do this, but I'm not sure if that's an out of the box configuration option or if that's something you need to roll yourself. Ideally you'd only do that on resque jobs and not with your web server. |
Ya, and for good reason. There can a lot of oddness with trying to re-use connections across new forks. Agreed with @PatrickTulskie, not sure there's much you can really do other than either not fork, or if you still want some of the benefits of forking, use the plugin I mentioned above. |
We're running into an interesting situation when using Resque while trying to process a queue of millions of jobs. I'm pretty confident this is due to Rails or something within Rails re-initializing with every fork, but it's unclear what there is to be done about it.
Our environment:
The symptoms:
We've been able to get around this by setting
FORK_PER_JOB=false
and avoiding forking which lets us get back to the performance we're expecting. However, I'm wondering what can be done about this so we can get back to resque's recommendation of forking for each job and gain that safety back. More than happy to dive into any details/provide any more info.The text was updated successfully, but these errors were encountered: