Skip to content

Commit

Permalink
[task manager] provide warning when setting max_workers greater than …
Browse files Browse the repository at this point in the history
…limit (elastic#85574) (elastic#85872)

resolves elastic#56573

In this PR we create a new task manager limit on the config property
`xpack.task_manager.max_workers` of 100, but only log a deprecation
warning if that property exceeds the limit.  We'll enforce the limit
in 8.0.

The rationale is that it's unlikely going to be useful to run with
more than some number of workers, due to the amount of simultaneous
work that would end up happening.  In practice, too many workers can
slow things down more than speed them up.

We're setting the limit to 100 for now, but may increase / decrease it
based on further research.
  • Loading branch information
pmuellr authored Dec 14, 2020
1 parent 7fa2e9d commit 9b0ec30
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions x-pack/plugins/task_manager/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { schema, TypeOf } from '@kbn/config-schema';

export const MAX_WORKERS_LIMIT = 100;
export const DEFAULT_MAX_WORKERS = 10;
export const DEFAULT_POLL_INTERVAL = 3000;
export const DEFAULT_MAX_POLL_INACTIVITY_CYCLES = 10;
Expand Down
9 changes: 9 additions & 0 deletions x-pack/plugins/task_manager/server/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,13 @@ describe('deprecations', () => {
`);
});
});

it('logs a warning if max_workers is over limit', () => {
const { messages } = applyTaskManagerDeprecations({ max_workers: 1000 });
expect(messages).toMatchInlineSnapshot(`
Array [
"setting \\"xpack.task_manager.max_workers\\" (1000) greater than 100 is deprecated. Values greater than 100 will not be supported starting in 8.0.",
]
`);
});
});
7 changes: 6 additions & 1 deletion x-pack/plugins/task_manager/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { get } from 'lodash';
import { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/server';
import { TaskManagerPlugin } from './plugin';
import { configSchema, TaskManagerConfig } from './config';
import { configSchema, TaskManagerConfig, MAX_WORKERS_LIMIT } from './config';

export const plugin = (initContext: PluginInitializerContext) => new TaskManagerPlugin(initContext);

Expand Down Expand Up @@ -37,6 +37,11 @@ export const config: PluginConfigDescriptor<TaskManagerConfig> = {
`"${fromPath}.index" is deprecated. Multitenancy by changing "kibana.index" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details`
);
}
if (taskManager?.max_workers > MAX_WORKERS_LIMIT) {
log(
`setting "${fromPath}.max_workers" (${taskManager?.max_workers}) greater than ${MAX_WORKERS_LIMIT} is deprecated. Values greater than ${MAX_WORKERS_LIMIT} will not be supported starting in 8.0.`
);
}
return settings;
},
],
Expand Down

0 comments on commit 9b0ec30

Please sign in to comment.