-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Script: Deprecate script context cache #79508
Script: Deprecate script context cache #79508
Conversation
Deprecate the script context cache in favor of the general cache. Users should use the following settings: `script.max_compilations_rate` to set the max compilation rate for user scripts such as filter scripts. Certain script contexts that submit scripts outside of the control of the user are exempted from this rate limit. Examples include runtime fields, ingest and watcher. `script.cache.max_size` to set the max size of the cache. `script.cache.expire` to set the expiration time for entries in the cache. Whats deprecated? `script.max_compilations_rate: use-context`. This special setting value was used to turn on the script context-specific caches. `script.context.$CONTEXT.cache_max_size`, use `script.cache.max_size` instead. `script.context.$CONTEXT.cache_expire`, use `script.cache.expire` instead. `script.context.$CONTEXT.max_compilations_rate`, use `script.max_compilations_rate` instead. The default cache size was increased from `100` to `3000`, which was approximately the max cache size when using context-specific caches. The default compilation rate limit was increased from `75/5m` to `150/5m` to account for increasing uses of scripts. Refs: elastic#62899
Pinging @elastic/es-core-infra (Team:Core/Infra) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few quick comments
@@ -321,4 +321,77 @@ avoid deprecation warnings and opt into the future behaviour, include the query | |||
parameter `?return_200_for_cluster_health_timeout` in your request. | |||
==== | |||
|
|||
[[script-context-cache-removed]] | |||
.The `script.max_compilations_rate` setting cannot be `use-context`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value is deprecated, not removed right? The wording seems to imply it won't work, but it will, it should just be migrated away from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to "is a deprecated value".
compilation rate limits and to compensate for an undersized general script | ||
cache. | ||
Now, system scripts are exempt from compilation rate limiting and | ||
the general script cache size is dynamically with a higher default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"size is dynamically with a higher default"? I'm not sure what this is supposed to mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to "is able to be set dynamically"
`200/10m`, which allows 200 compilations for every 10 minute period. | ||
|
||
*Impact* + | ||
Discontinue use of the removed setting value. Specifying the setting value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wording looks like a breakage, but it's just a deprecation. We should model it after other deprecation docs. For example, look at deprecate-transient-cluster-settings
in this file. Ditto for all the other sections added in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to To avoid deprecation warnings, discontinue use of the deprecated setting value.
@@ -249,6 +263,10 @@ void registerClusterSettingsListeners(ClusterSettings clusterSettings) { | |||
*/ | |||
void validateCacheSettings(Settings settings) { | |||
boolean useContext = SCRIPT_GENERAL_MAX_COMPILATIONS_RATE_SETTING.get(settings).equals(USE_CONTEXT_RATE_VALUE); | |||
if (useContext) { | |||
deprecationLogger.critical(DeprecationCategory.SCRIPTING, "scripting-context-cache", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these critical should be warnings instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
@elasticmachine update branch |
@elasticmachine update branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, but i would like @debadair to look over the migration docs wording/structure.
|
||
Previously, you could set this setting to `use-context` to have a | ||
script cache, compilation rate limit settings, cache expiration and | ||
cache size per cluster. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per cluster -> per script context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
Now, system scripts are exempt from compilation rate limiting and | ||
the general script cache size is able to be set dynamically. | ||
|
||
Do not use `use-context` as a value for this setting. Instead, remove |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This paragraph should be moved/rephrased into the impact below. I would also remove the first sentence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed first sentence, moved and expanded below.
size. | ||
|
||
*Impact* + | ||
To avoid deprecation warnings, discontinue use of the deprecated settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The impact should be specific, not the same for every one of these migration notes. Maybe @debadair can provide some suggestions on wording. I'm also not sure if we should have a single note about script.context.$CONTEXT.*
or have individual notes as you have here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made the impact more specific and recommended mitigation.
I'm also not sure if we should have a single note about script.context.$CONTEXT.* or have individual notes as you have here.
I made them different so the deprecation warnings could point to different sections. Since the deprecation warning URLs can easily be changed after release (they use https://ela.st/), I don't have a strong opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be inclined to consolidate this into a single entry. I think it can be streamlined quite a bit.
[[script-context-cache-deprecated]]
. The script context cache is deprecated
[%collapsible]
====
Details +
Settingscript.max_compilations_rate
touse-context
and
configuring context-specific caches is deprecated.
Context-specific caches are no longer needed to prevent system scripts
from triggering rate limits.
Configure the general cache to control the max complication rate, cache size, and
cache expiration for your scripts.
Impact +
Removescript.max_compilations_rate: use-context
and the context-specific cache settings:script.context.$CONTEXT.cache_max_size
,script.context.$CONTEXT.max_compilations_rate
,script.context.$CONTEXT.cache_expire
.
The general cache defaults to a max size of 3000 with a rate limit of 150/5m,
which allows 150 compilations per 5 minute period.
To override the defaults, configure thescript.cache.max_size
,script.max_compilations_rate
, andscript.cache.expire settings
.
====
@@ -277,7 +295,7 @@ void validateCacheSettings(Settings settings) { | |||
String.join(", ", customRates) + "] if compile rates disabled via [" + | |||
SCRIPT_DISABLE_MAX_COMPILATIONS_RATE_SETTING.getKey() + "]"); | |||
} | |||
if (useContext == false) { | |||
if (useContext == false && SCRIPT_GENERAL_MAX_COMPILATIONS_RATE_SETTING.exists(settings)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this branch not be an error anymore? The setting is the general one, not per context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SCRIPT_DISABLE_MAX_COMPILATIONS_RATE_SETTING
is used for tests and not compatible with any custom settings. If that is set at all we need to error. I added this due to a test error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, but the conditional here is checking SCRIPT_GENERAL_MAX_COMPILATIONS_RATE_SETTING
not SCRIPT_DISABLE_MAX_COMPILATIONS_RATE_SETTING
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh, this is inside a block for SCRIPT_DISABLE_MAX_COMPILATIONS_RATE_SETTING
, I think I see now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some suggestions to streamline the deprecation entry & align the messages with the guidelines. LMK if you have any questions!
size. | ||
|
||
*Impact* + | ||
To avoid deprecation warnings, discontinue use of the deprecated settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be inclined to consolidate this into a single entry. I think it can be streamlined quite a bit.
[[script-context-cache-deprecated]]
. The script context cache is deprecated
[%collapsible]
====
Details +
Settingscript.max_compilations_rate
touse-context
and
configuring context-specific caches is deprecated.
Context-specific caches are no longer needed to prevent system scripts
from triggering rate limits.
Configure the general cache to control the max complication rate, cache size, and
cache expiration for your scripts.
Impact +
Removescript.max_compilations_rate: use-context
and the context-specific cache settings:script.context.$CONTEXT.cache_max_size
,script.context.$CONTEXT.max_compilations_rate
,script.context.$CONTEXT.cache_expire
.
The general cache defaults to a max size of 3000 with a rate limit of 150/5m,
which allows 150 compilations per 5 minute period.
To override the defaults, configure thescript.cache.max_size
,script.max_compilations_rate
, andscript.cache.expire settings
.
====
String.format(Locale.ROOT, "settings [" + maxSettings + "] for context specific rate limits are deprecated and will" | ||
+ " not be available in a future version." | ||
+ " Use [" + ScriptService.SCRIPT_GENERAL_MAX_COMPILATIONS_RATE_SETTING.getKey() + "] to rate limit the compilation" | ||
+ " of user scripts, system scripts are exempt.", maxSettings), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd edit slightly to align with the other deprecation messages:
Setting context-specific rate limits is deprecated. Use [setting] to rate limit the compilation of user scripts. Context-specific caches are no longer needed to prevent system scripts from triggering rate limits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much nicer. Done.
+ " deprecated and will not be available in a future version." | ||
+ " Use [" + ScriptService.SCRIPT_GENERAL_CACHE_SIZE_SETTING.getKey() + "] to size the context cache for all" | ||
+ " scripts.", | ||
cacheSizeSettings), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly:
Setting a context-specific cache size is deprecated. Use [setting] to configure the size of the general cache for user scripts. Context-specific caches are no longer needed to prevent system scripts from triggering rate limits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
+ " Use [" + ScriptService.SCRIPT_GENERAL_CACHE_EXPIRE_SETTING.getKey() + "]" | ||
+ " to set the cache expiration all scripts.", | ||
cacheExpireSettings), | ||
"https://ela.st/es-deprecation-7-script-context-expire-deprecated", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly:
Setting a context-specific cache expiration is deprecated. Use [setting] to configure the expiration of the general cache. Context-specific caches are no longer needed to prevent system scripts from triggering rate limits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Deprecate the script context cache in favor of the general cache. Users should use the following settings: `script.max_compilations_rate` to set the max compilation rate for user scripts such as filter scripts. Certain script contexts that submit scripts outside of the control of the user are exempted from this rate limit. Examples include runtime fields, ingest and watcher. `script.cache.max_size` to set the max size of the cache. `script.cache.expire` to set the expiration time for entries in the cache. Whats deprecated? `script.max_compilations_rate: use-context`. This special setting value was used to turn on the script context-specific caches. `script.context.$CONTEXT.cache_max_size`, use `script.cache.max_size` instead. `script.context.$CONTEXT.cache_expire`, use `script.cache.expire` instead. `script.context.$CONTEXT.max_compilations_rate`, use `script.max_compilations_rate` instead. The default cache size was increased from `100` to `3000`, which was approximately the max cache size when using context-specific caches. The default compilation rate limit was increased from `75/5m` to `150/5m` to account for increasing uses of scripts. System script contexts can now opt-out of compilation rate limiting using a flag rather than a sentinel rate limit value. 7.16: Script: Deprecate script context cache elastic#79508 Refs: elastic#62899 7.16: Script: Opt-out system contexts from script compilation rate limit elastic#79459 Refs: elastic#62899
Deprecate the script context cache in favor of the general cache. Users should use the following settings: `script.max_compilations_rate` to set the max compilation rate for user scripts such as filter scripts. Certain script contexts that submit scripts outside of the control of the user are exempted from this rate limit. Examples include runtime fields, ingest and watcher. `script.cache.max_size` to set the max size of the cache. `script.cache.expire` to set the expiration time for entries in the cache. Whats deprecated? `script.max_compilations_rate: use-context`. This special setting value was used to turn on the script context-specific caches. `script.context.$CONTEXT.cache_max_size`, use `script.cache.max_size` instead. `script.context.$CONTEXT.cache_expire`, use `script.cache.expire` instead. `script.context.$CONTEXT.max_compilations_rate`, use `script.max_compilations_rate` instead. The default cache size was increased from `100` to `3000`, which was approximately the max cache size when using context-specific caches. The default compilation rate limit was increased from `75/5m` to `150/5m` to account for increasing uses of scripts. System script contexts can now opt-out of compilation rate limiting using a flag rather than a sentinel rate limit value. 7.16: Script: Deprecate script context cache elastic#79508 Refs: elastic#62899 7.16: Script: Opt-out system contexts from script compilation rate limit elastic#79459 Refs: elastic#62899
Deprecate the script context cache in favor of the general cache. Users should use the following settings: `script.max_compilations_rate` to set the max compilation rate for user scripts such as filter scripts. Certain script contexts that submit scripts outside of the control of the user are exempted from this rate limit. Examples include runtime fields, ingest and watcher. `script.cache.max_size` to set the max size of the cache. `script.cache.expire` to set the expiration time for entries in the cache. Whats deprecated? `script.max_compilations_rate: use-context`. This special setting value was used to turn on the script context-specific caches. `script.context.$CONTEXT.cache_max_size`, use `script.cache.max_size` instead. `script.context.$CONTEXT.cache_expire`, use `script.cache.expire` instead. `script.context.$CONTEXT.max_compilations_rate`, use `script.max_compilations_rate` instead. The default cache size was increased from `100` to `3000`, which was approximately the max cache size when using context-specific caches. The default compilation rate limit was increased from `75/5m` to `150/5m` to account for increasing uses of scripts. System script contexts can now opt-out of compilation rate limiting using a flag rather than a sentinel rate limit value. 7.16: Script: Deprecate script context cache #79508 Refs: #62899 7.16: Script: Opt-out system contexts from script compilation rate limit #79459 Refs: #62899
Deprecate the script context cache in favor of the general cache.
Users should use the following settings:
script.max_compilations_rate
to set the max compilation ratefor user scripts such as filter scripts. Certain script contexts
that submit scripts outside of the control of the user are
exempted from this rate limit. Examples include runtime fields,
ingest and watcher.
script.cache.max_size
to set the max size of the cache.script.cache.expire
to set the expiration time for entries inthe cache.
Whats deprecated?
script.max_compilations_rate: use-context
. This specialsetting value was used to turn on the script context-specific caches.
script.context.$CONTEXT.cache_max_size
, usescript.cache.max_size
instead.
script.context.$CONTEXT.cache_expire
, usescript.cache.expire
instead.
script.context.$CONTEXT.max_compilations_rate
, usescript.max_compilations_rate
instead.The default cache size was increased from
100
to3000
, whichwas approximately the max cache size when using context-specific caches.
The default compilation rate limit was increased from
75/5m
to150/5m
to account for increasing uses of scripts.Refs: #62899