-
Notifications
You must be signed in to change notification settings - Fork 58
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
Batched jobs for scheduler and task runner #2613
Comments
BoefjeTasks
before they get pushed onto the queueBoefjeTasks
before they get pushed onto the queue
Prerequisites:
Possible solutions:
|
As has been discussed with @jpbruinsslot and @underdarknl, one of the main reasons of this feature is the ability to create a batched job, meaning a job targeting one boefje type for multiple input OOIs. Given that we are moving to a setup where running one job will have significant overhead due to containerization, this will likely introduce a welcome performance gain. Note Let me first note that I believe that this should actually be benchmarked first or based on production data about the amount of jobs run per day and the spread that occurs, because else assuming this will be a bottleneck is merely guesswork. But I'll ignore those principles for now. There are currently two possible routes. Route 1: Build batched jobs in the scheduler queueAs proposed by @underdarknl, one way to create a batched job is to patch them in the scheduler. This would mean:
Performance scenario'sThe queue is very full and a "batchable" job gets addedIn this case, the batched jobs get a lower priority so will depend on the The queue is empty and a "batchable" job gets addedIn this case, batched jobs still get a lower priority, but it gets scheduled right away because it is the only job on the queue. There is likely next to no performance gain in this case. Features required to implement:I would not opt for having 2 kinds of jobs data in the scheduler, because this will imply that we will have to maintain two sets of queries whenever we want to find jobs for a certain input_ooi. Therefore let's assume all jobs become "batched" jobs. We have to:
Point 7 will not be a big deal if we do not decide to handle 1 data structure and allow both batched and non-batched jobs. Again this would require switch statements somewhere handled generically in the scheduler when querying the queue. But also in rocky and boefjes while fetching jobs from the scheduler API. Route 2: Aggregate in the worker and change the queue APIAnother way would be to leave the data structures intact and query the scheduler queue API in a smarter way:
Performance scenario'sThe queue is very full and a "batchable" job gets addedIn this case, either there are several jobs for the same boefje on the queue because the queue has piled up, or there are no jobs because one of the workers has just picked up the batch for this boefje. (This chance could of course be lowered by doing the queue-query in a smart way.) It gets added to the queue and will be picked up at some point together with all other jobs for the same boefje_id. This will likely be a rather large batch, but we might end up running several medium-sized batches instead of one large batch. But if we end up doing several of those, the queue was probably not that full, as we will probably see that the bigger the queue, the bigger the batch sizes. In the worst case you sometimes do a batch of 1. The queue is empty and a "batchable" job gets addedIn this case, again the job gets scheduled right away because it is the only job on the queue. There is likely next to no performance gain in this case. Features required to implement:
Note that an added benefit to using a limit-api is that you are able to control how many tasks you do in parallel with just a limit to the api call, without needing chunking-logic in the worker to perhaps later handle instances where batched jobs get resource intensive per ooi so that you want to limit the batch size. |
BoefjeTasks
before they get pushed onto the queue
Further steps investigate possibility of |
From: #2811 (comment) |
No description provided.
The text was updated successfully, but these errors were encountered: