From 71995ccc0c7949fa5d87a4833a048526395c3b96 Mon Sep 17 00:00:00 2001 From: Patrick Mueller Date: Wed, 19 Aug 2020 09:53:53 -0400 Subject: [PATCH] [TaskManager] fetch more tasks to run than available capacity resolves https://github.com/elastic/kibana/issues/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. --- x-pack/plugins/task_manager/server/task_manager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/task_manager/server/task_manager.ts b/x-pack/plugins/task_manager/server/task_manager.ts index 2c812f0da516d..6fb182139cb2a 100644 --- a/x-pack/plugins/task_manager/server/task_manager.ts +++ b/x-pack/plugins/task_manager/server/task_manager.ts @@ -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, });