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

Add concurrency control based on job type #71

Conversation

ivb-supercede
Copy link
Collaborator

This is an important use case for us, since we have certain expensive jobs that shouldn't hog all the resources on the machine. This adds a new kind of ConcurrencyControl, that limits the number of jobs that can be simultaneously executed per job-type.

I tried to modify the code in such a way that polling is not made significantly more expensive by the existence of the new concurrency control - but there might be a slight decrease in performance, because the job type filter is filled from the list of all job types, which might result in a query. This could be fixed by making two polling queries: one which takes the filter, and one which doesn't.

This is an important use case for us, since we have certain expensive
jobs that shouldn't hog all the resources on the machine.

This adds a new kind of ConcurrencyControl, that limits the number of
jobs that can be simultaneously executed per job-type.
@saurabhnanda
Copy link
Owner

Thank your for your PR. I'll take a little longer to review this PR, while #70 seems straightforward and should get merged as soon as the CI build passes.

In the meantime, is the use-case for your PR the same as the discussion at #38 and the subsequent PR at #55 ?

@ivb-supercede
Copy link
Collaborator Author

In the meantime, is the use-case for your PR the same as the discussion at #38 and the subsequent PR at #55 ?

The use-case is very similar - but we don't have any shared resource that jobs need to control access to (apart from system CPU & memory). Being able to rate-limit jobs more generally would also satisfy our needs.

@saurabhnanda
Copy link
Owner

@ivb-supercede would it fair to say that if we have concurrency control based on a resources table (as implemented in #55) it can satisfy your use-case as well, by treating resource = job-type. But it will require more work on your behalf to set up the resources table appropriately.

I'm wondering if it makes sense to make the jobPollingSql configurable and give a bunch of common options to choose from (with a sensible default in ConfigBuilder.mkConfig)

@ivb-supercede
Copy link
Collaborator Author

Closing in favour of #80.

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