-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make script cache and compilation limits per context #50152
Comments
Pinging @elastic/es-core-infra (:Core/Infra/Scripting) |
In
In Idea: encapsulate these into a |
Code staging:
Behavior: |
Phase 1 of adding compilation limits per context. * Refactor compilation and caching into separate class, ContextCompiler which will be used per context. * Disable compilation limit for tests. * Add script.max_compilations_rate = "unlimited" setting which disables compilation limits. Refs: elastic#50152
Phase 1 of adding compilation limits per context. * Refactor rate limiting and caching into separate class, `ScriptCache`, which will be used per context. * Disable compilation limit for certain tests. Refs: #50152
Phase 1 of adding compilation limits per context. * Refactor rate limiting and caching into separate class, `ScriptCache`, which will be used per context. * Disable compilation limit for certain tests. Refs: elastic#50152
Phase 1 of adding compilation limits per context. * Refactor compilation and caching into separate class, ContextCompiler which will be used per context. * Disable compilation limit for tests. * Add script.max_compilations_rate = "unlimited" setting which disables compilation limits. Refs: elastic#50152
Should we disable caching all together if a user sets an unlimited compilation rate? |
* Adds per context settings: `script.context.${CONTEXT}.cache_max_size` ~ `script.cache.max_size` `script.context.${CONTEXT}.cache_expire` ~ `script.cache.expire` `script.context.${CONTEXT}.max_compilations_rate` ~ `script.max_compilations_rate` * Context cache is used if: `script.max_compilations_rate=use-context`. This value is dynamically updatable, so users can switch back to the general cache if desired. * Settings for context caches take the first value that applies: 1) Context specific settings if set, eg `script.context.ingest.cache_max_size` 2) Correlated general setting is set to the non-default value, eg `script.cache.max_size` 3) Context default The reason for 2's inclusion is to allow an easy transition for users who've customized their general cache settings. Using the general cache settings for the context caches results in higher effective settings, since they are multiplied accross the number of contexts. So a general cache max size of 200 will become 200 * # of contexts. However, this behavior it will avoid users snapping to a value that is too low for them. Refs: elastic#50152
* Adds per context settings: `script.context.${CONTEXT}.cache_max_size` ~ `script.cache.max_size` `script.context.${CONTEXT}.cache_expire` ~ `script.cache.expire` `script.context.${CONTEXT}.max_compilations_rate` ~ `script.max_compilations_rate` * Context cache is used if: `script.max_compilations_rate=use-context`. This value is dynamically updatable, so users can switch back to the general cache if desired. * Settings for context caches take the first value that applies: 1) Context specific settings if set, eg `script.context.ingest.cache_max_size` 2) Correlated general setting is set to the non-default value, eg `script.cache.max_size` 3) Context default The reason for 2's inclusion is to allow an easy transition for users who've customized their general cache settings. Using the general cache settings for the context caches results in higher effective settings, since they are multiplied across the number of contexts. So a general cache max size of 200 will become 200 * # of contexts. However, this behavior it will avoid users snapping to a value that is too low for them. Refs: #50152
* Adds per context settings: `script.context.${CONTEXT}.cache_max_size` ~ `script.cache.max_size` `script.context.${CONTEXT}.cache_expire` ~ `script.cache.expire` `script.context.${CONTEXT}.max_compilations_rate` ~ `script.max_compilations_rate` * Context cache is used if: `script.max_compilations_rate=use-context`. This value is dynamically updatable, so users can switch back to the general cache if desired. * Settings for context caches take the first value that applies: 1) Context specific settings if set, eg `script.context.ingest.cache_max_size` 2) Correlated general setting is set to the non-default value, eg `script.cache.max_size` 3) Context default The reason for 2's inclusion is to allow an easy transition for users who've customized their general cache settings. Using the general cache settings for the context caches results in higher effective settings, since they are multiplied across the number of contexts. So a general cache max size of 200 will become 200 * # of contexts. However, this behavior it will avoid users snapping to a value that is too low for them. Refs: elastic#50152
* Adds per context settings: `script.context.${CONTEXT}.cache_max_size` ~ `script.cache.max_size` `script.context.${CONTEXT}.cache_expire` ~ `script.cache.expire` `script.context.${CONTEXT}.max_compilations_rate` ~ `script.max_compilations_rate` * Context cache is used if: `script.max_compilations_rate=use-context`. This value is dynamically updatable, so users can switch back to the general cache if desired. * Settings for context caches take the first value that applies: 1) Context specific settings if set, eg `script.context.ingest.cache_max_size` 2) Correlated general setting is set to the non-default value, eg `script.cache.max_size` 3) Context default The reason for 2's inclusion is to allow an easy transition for users who've customized their general cache settings. Using the general cache settings for the context caches results in higher effective settings, since they are multiplied across the number of contexts. So a general cache max size of 200 will become 200 * # of contexts. However, this behavior it will avoid users snapping to a value that is too low for them. Backport of: #52855 Refs: #50152
* Adds ability for contexts to specify their own defaults. * Context defaults are applied if no context-specific or general setting exists. * See 070ea7e for settings keys. * Increases the per-context default for the `ingest` context. * Cache size is doubled, 200 compared to default of 100 * Cache expiration is unchanged at no expiration * Cache max compilation is quintupled, 375/5m instead of 75/5m Refs: elastic#50152
* Adds "unlimited" compilation rate for context script caches * `script.context.${CONTEXT}.max_compilations_rate` = `unlimited` disables compilation rate limiting for `${CONTEXT}`'s script cache Refs: elastic#50152
* Adds "unlimited" compilation rate for context script caches * `script.context.${CONTEXT}.max_compilations_rate` = `unlimited` disables compilation rate limiting for `${CONTEXT}`'s script cache Refs: #50152
* Adds "unlimited" compilation rate for context script caches * `script.context.${CONTEXT}.max_compilations_rate` = `unlimited` disables compilation rate limiting for `${CONTEXT}`'s script cache Refs: elastic#50152
Having "script" : {
"compilations" : 172,
"cache_evictions" : 72,
"compilation_limit_triggered" : 0
}, Here's it in 8.x right now: "script_cache": {
"sum": {
"compilations": 1,
"cache_evictions": 0,
"compilation_limit_triggered": 0
},
"contexts": [
{
"context": "aggregation_selector",
"compilations": 0,
"cache_evictions": 0,
"compilation_limit_triggered": 0
}, We will remove "script": {
"compilations": 1,
"cache_evictions": 0,
"compilation_limit_triggered": 0,
"contexts":[
{
"context": "aggregation_selector",
"compilations": 0,
"cache_evictions": 0,
"compilation_limit_triggered": 0
}, This keeps the format the same between 7 and 8 so we can easily drop |
Removed settings: * `script.cache.max_size` * `script.cache.expire` * `script.max_compilations_rate` Updated `_nodes/stats`: * Remove `script_cache` * Update `script` in `_node/stats` to include stats per context: ``` "script": { "compilations": 1, "cache_evictions": 0, "compilation_limit_triggered": 0, "contexts":[ { "context": "aggregation_selector", "compilations": 0, "cache_evictions": 0, "compilation_limit_triggered": 0 }, ``` Refs: elastic#50152
* Remove `script_cache` * Update `script` in `_node/stats` to include stats per context: ``` "script": { "compilations": 1, "cache_evictions": 0, "compilation_limit_triggered": 0, "contexts":[ { "context": "aggregation_selector", "compilations": 0, "cache_evictions": 0, "compilation_limit_triggered": 0 }, ``` Refs: elastic#50152
Removed settings: * `script.cache.max_size` * `script.cache.expire` * `script.max_compilations_rate` Updated `_nodes/stats`: * Remove `script_cache` * Update `script` in `_node/stats` to include stats per context: ``` "script": { "compilations": 1, "cache_evictions": 0, "compilation_limit_triggered": 0, "contexts":[ { "context": "aggregation_selector", "compilations": 0, "cache_evictions": 0, "compilation_limit_triggered": 0 }, ``` Refs: elastic#50152
Updated `_nodes/stats`: * Remove `script_cache` * Update `script` in `_node/stats` to include stats per context: ``` "script": { "compilations": 1, "cache_evictions": 0, "compilation_limit_triggered": 0, "contexts":[ { "context": "aggregation_selector", "compilations": 0, "cache_evictions": 0, "compilation_limit_triggered": 0 }, ``` Refs: elastic#50152 Backport: elastic#59205
Removed settings: * `script.cache.max_size` * `script.cache.expire` * `script.max_compilations_rate` Refs: elastic#50152
Removed settings: * `script.cache.max_size` * `script.cache.expire` * `script.max_compilations_rate` Refs: elastic#50152
Updated `_nodes/stats`: * Remove `script_cache` * Update `script` in `_node/stats` to include stats per context: ``` "script": { "compilations": 1, "cache_evictions": 0, "compilation_limit_triggered": 0, "contexts":[ { "context": "aggregation_selector", "compilations": 0, "cache_evictions": 0, "compilation_limit_triggered": 0 }, ``` Refs: elastic#50152
Updated `_nodes/stats`: * Update `script` in `_node/stats` to include stats per context: ``` "script": { "compilations": 1, "cache_evictions": 0, "compilation_limit_triggered": 0, "contexts":[ { "context": "aggregation_selector", "compilations": 0, "cache_evictions": 0, "compilation_limit_triggered": 0 }, ``` Refs: elastic#50152 Backport: elastic#59625
* `ingest` and `processor_conditional` default to unlimited compilation rate Refs: elastic#50152
* `ingest` and `processor_conditional` default to unlimited compilation rate Refs: elastic#50152
Removed settings: * `script.cache.max_size` * `script.cache.expire` * `script.max_compilations_rate` Refs: #50152
Updated `_nodes/stats`: * Remove `script_cache` * Update `script` in `_node/stats` to include stats per context: ``` "script": { "compilations": 1, "cache_evictions": 0, "compilation_limit_triggered": 0, "contexts":[ { "context": "aggregation_selector", "compilations": 0, "cache_evictions": 0, "compilation_limit_triggered": 0 }, ``` Refs: #50152
Updated `_nodes/stats`: * Update `script` in `_node/stats` to include stats per context: ``` "script": { "compilations": 1, "cache_evictions": 0, "compilation_limit_triggered": 0, "contexts":[ { "context": "aggregation_selector", "compilations": 0, "cache_evictions": 0, "compilation_limit_triggered": 0 }, ``` Refs: #50152 Backport: #59625
* `ingest` and `processor_conditional` default to unlimited compilation rate Refs: #50152
Currently, we have setting to apply a max for the script cache and settings to determine the max rate of compilation. These apply to all script contexts. We should change the settings to be per script context as each context has different needs.
Relates to #49763
The text was updated successfully, but these errors were encountered: