Skip to content

Commit

Permalink
[TaskManager] fetch more tasks to run than available capacity
Browse files Browse the repository at this point in the history
resolves elastic#65552

Currently TaskManager attempts to claim exactly the number of tasks that
it has capacity for.

As an optimization, we're going to change to have it request more tasks than
it has capacity for.  This should improve latency, as when tasks complete,
there may be some of these excess tasks that can be started, as they are
already claimed (they still need to be marked running).

All the plumbing already handles getting more tasks than we asked for, we
were just never asking for more than we needed previously.
  • Loading branch information
pmuellr committed Aug 20, 2020
1 parent 954b5b5 commit 71995cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion x-pack/plugins/task_manager/server/task_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ export async function claimAvailableTasks(

try {
const { docs, claimedTasks } = await claim({
size: availableWorkers,
size: availableWorkers * 2, // get more than we have capacity for
claimOwnershipUntil: intervalFromNow('30s')!,
claimTasksById,
});
Expand Down

0 comments on commit 71995cc

Please sign in to comment.