Skip to content

Commit 1f774bb

Browse files
authored
[task manager] provide warning when setting max_workers greater than limit (#85574)
resolves #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.
1 parent 23c5daa commit 1f774bb

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

x-pack/plugins/task_manager/server/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

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

9+
export const MAX_WORKERS_LIMIT = 100;
910
export const DEFAULT_MAX_WORKERS = 10;
1011
export const DEFAULT_POLL_INTERVAL = 3000;
1112
export const DEFAULT_MAX_POLL_INACTIVITY_CYCLES = 10;

x-pack/plugins/task_manager/server/index.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,13 @@ describe('deprecations', () => {
4040
`);
4141
});
4242
});
43+
44+
it('logs a warning if max_workers is over limit', () => {
45+
const { messages } = applyTaskManagerDeprecations({ max_workers: 1000 });
46+
expect(messages).toMatchInlineSnapshot(`
47+
Array [
48+
"setting \\"xpack.task_manager.max_workers\\" (1000) greater than 100 is deprecated. Values greater than 100 will not be supported starting in 8.0.",
49+
]
50+
`);
51+
});
4352
});

x-pack/plugins/task_manager/server/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { get } from 'lodash';
88
import { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/server';
99
import { TaskManagerPlugin } from './plugin';
10-
import { configSchema, TaskManagerConfig } from './config';
10+
import { configSchema, TaskManagerConfig, MAX_WORKERS_LIMIT } from './config';
1111

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

@@ -37,6 +37,11 @@ export const config: PluginConfigDescriptor<TaskManagerConfig> = {
3737
`"${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`
3838
);
3939
}
40+
if (taskManager?.max_workers > MAX_WORKERS_LIMIT) {
41+
log(
42+
`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.`
43+
);
44+
}
4045
return settings;
4146
},
4247
],

0 commit comments

Comments
 (0)