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

Multiprocess RQ workers (using supervisor) #4371

Merged
merged 11 commits into from Jan 1, 2020

Conversation

rauchy
Copy link
Contributor

@rauchy rauchy commented Nov 19, 2019

What type of PR is this? (check all applicable)

  • Refactor

Description

This is an alternative implementation to the one suggested in #4233. Here we use supervisor instead of Honcho in order to spin up, monitor and restart multiple worker processes.

supervisor is installed in the Docker image and is launched inside the worker entrypoint. We use the non-daemonized mode of supervisor in order to allow the container to exit in case the supervisor process exits.

Related Tickets & Documents

#4233

@rauchy rauchy added the Backend label Nov 19, 2019
@rauchy rauchy requested a review from arikfr November 19, 2019 09:24
@rauchy rauchy added this to In progress in Switch from Celery to RQ via automation Nov 19, 2019
@rauchy rauchy mentioned this pull request Nov 19, 2019
1 task
Copy link
Member

@arikfr arikfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still some healthcheck, right? Can Supervisor handle it?

export WORKERS_COUNT=${WORKERS_COUNT:-2}
export QUEUES=${QUEUES:-}

touch /tmp/worker.log && tail -f /tmp/worker.log &
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you didn't configure supervisord to write to stdout directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's even simpler :) didn't think of that! 1fb1a7e handles this.

worker.conf Outdated
@@ -0,0 +1,17 @@
[supervisord]
logfile=/tmp/supervisord.log
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update this to stdout as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rauchy
Copy link
Contributor Author

rauchy commented Nov 21, 2019

We still some healthcheck, right? Can Supervisor handle it?

In 092eb6c I've used supervisor_checks to run a check every minute (we should probably change the interval) - the check runs for every monitored process and asserts that the worker is behaving as expected (on top of what you get from supervisor, which is basically testing if the process is up). If a specific worker process is misbehaving, it is replaced.

We can also add more checks for CPU / memory (provided OOTB by supervisor_checks)

Let me know what you think of this.

@rauchy rauchy requested a review from arikfr November 21, 2019 12:43
@rauchy rauchy moved this from In progress to Review in progress in Switch from Celery to RQ Nov 21, 2019
@rauchy
Copy link
Contributor Author

rauchy commented Dec 10, 2019

@arikfr can we merge this?

@arikfr arikfr merged commit 260bfca into master Jan 1, 2020
Switch from Celery to RQ automation moved this from Review in progress to Done Jan 1, 2020
@arikfr arikfr deleted the multi-process-rq-workers-using-supervisor branch January 1, 2020 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants