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

Reduce RQ status load time #4257

Merged
merged 2 commits into from
Oct 23, 2019
Merged

Reduce RQ status load time #4257

merged 2 commits into from
Oct 23, 2019

Conversation

rauchy
Copy link
Contributor

@rauchy rauchy commented Oct 17, 2019

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

  • Refactor

Description

The RQ job status page was loading job information for all queued jobs, but for those, we only care about the amount. This PR fixes this.

Running a small benchmark - for 60k queued jobs, this PR has reduced the load time from approx 34 seconds to 2 seconds.

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

@rauchy rauchy requested a review from arikfr October 17, 2019 10:19
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.

See comment + let's open the same PR to the Python 3 branch.

@@ -155,7 +155,7 @@ def rq_queues():
q.name: {
'name': q.name,
'started': fetch_jobs(q, StartedJobRegistry(queue=q).get_job_ids()),
'queued': fetch_jobs(q, q.job_ids)
'queued': len(q.job_ids)
Copy link
Member

Choose a reason for hiding this comment

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

Does q.job_ids include queued and started?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RQ does an LPOP when it starts executing a job so q.job_ids won't include started ones (instead, they are moved to rq:wip:..., which is observed by the StartedJobRegistry).

@arikfr arikfr merged commit f0f85ec into master Oct 23, 2019
@arikfr arikfr deleted the reduce-rq-status-load-time branch October 23, 2019 08:43
@rauchy rauchy mentioned this pull request Oct 23, 2019
1 task
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

Successfully merging this pull request may close these issues.

2 participants