[task manager] provide warning when setting max_workers greater than limit (#85574)

resolves https://github.com/elastic/kibana/issues/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.
This commit is contained in:
Patrick Mueller 2020-12-14 16:38:05 -05:00 committed by GitHub
parent 23c5daa622
commit 1f774bb2e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View file

@ -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;

View file

@ -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.",
]
`);
});
});

View file

@ -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);
@ -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;
},
],