-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Do not overwhelm Elasticsearch with UiSettings requests #82218
Comments
Pinging @elastic/kibana-platform (Team:Platform) |
Seems reasonable to at least expose this method and document that it should be favored when retrieving multiple settings. This should imho be done regardless of our decision for the next option.
Yea, that seems kinda dangerous to me for that exact reason. OTOH I'm unsure of the need to have 'real time' / 'fresh' access to UISettings. Would it be acceptable to have a per-instance cache with a very short lifespan (like, 60 / 120 seconds or so)? If it does, it could probably be a significant perf improvement. |
A per-request cache doesn't feel all that dangerous to me, at least for a vast majority of requests. Having a cache timeout makes sense for the longer running requests, like those that we'd see with Fleet. |
+1 to this. Most requests are short-lived and I suspect there would be very few problems created by caching the |
I'm good with that. Note that it will require some kibana/src/core/server/core_route_handler_context.ts Lines 92 to 94 in bc8a1da
( I think we will need to add a new Follow-up question: we don't plan to optimize / cache the |
@gingerwizard analysed APM data and noticed the high number of
_security/user/has_priveleges
requests to Elasticsearch. Some of them as caused by the Platform code reading uiSettings See_doc/config
:This problem is caused by the current implementation of the UiSettings client. Every
get('setting_name')
invocation performs a request to Elasticsearch service. It becomes a bottleneck since plugins might call it several times in a row. We can see that for given APM data,vis_type_timeseries
plugin callsUiSettingsClient.get
method thrice:kibana/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/get_es_query_uisettings.js
Lines 24 to 28 in 73fbadb
data
plugin callsUiSettingsClient.get
method twice:kibana/src/plugins/data/server/search/es_search/get_default_search_params.ts
Lines 33 to 34 in 73fbadb
I can see a couple of options with different pros & cons:
client.get(['key:a', 'key:b'])
but this approach isn't well scalable because it requires a manual audit.write
operations, it might be that cache isn't invalidated if uiSettings write request is handled by another Kibana instance.A side note: Every page load performs three requests: 2 when fetching
/bootstrap.js
and one inui_render_mixin
. I expect we address this problem in #54375 (comment)The text was updated successfully, but these errors were encountered: