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

Fractional and per-time-unit scheduling #114

Open
aecay opened this issue Feb 3, 2020 · 0 comments
Open

Fractional and per-time-unit scheduling #114

aecay opened this issue Feb 3, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@aecay
Copy link
Collaborator

aecay commented Feb 3, 2020

Mite's current job scheduling model is based on maintaining a certain number of jobs active at once. This means that our jobs need to have sleeps in them (boilerplate); it also means that there is no good way to schedule a very-occasional request without a long sleep (which causes problems for the controller teardown). We also model the work that runners are doing by the number of jobs scheduled on them. A job that is sleeping doesn't represent load in the same way that a job doing network I/O does (even though both are in an identical "waiting" state, one consumes network resources and the other doesn't). That means that our distribution of work across runners won't be optimal.

We should also support a job scheduling model that gives an interval over which jobs should run (each second, run 5 of this journey). The advantage to this model is that it generalizes easily to occasional journeys (every sixty seconds, run one copy of this journey) and one-shot jobs (at 1:00 into the test, run this journey). I think we can do this, on the controller end, with a token-bucket model: for each journey, we have an asyncio queue. One coroutine in a forever-loop does { deposit N tokens; sleep M seconds }. Another blocks on the queue, and whenever it can take tokens out, kicks off the jobs. The existing model might be adaptable into this framework as well: instead of depositing tokens on a time basis, we'd deposit them back into the bucket when the job completed.

@aecay aecay added the enhancement New feature or request label Feb 3, 2020
@aecay aecay mentioned this issue Mar 3, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant