-
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
CompletionStats need only be recomputed on a refresh #51915
Comments
Pinging @elastic/es-distributed (:Distributed/Engine) |
There are number of external projects (just listing a few we've found with our audits so far) that hit this pinch point by default as an FYI
Having the ability to have a default Im sure other tools / fixtures out there can pinch others as it has our own ramping of a large scale set of clusters. |
+1 to cache the completion stats (especially when we have many fields). Another optimization is to not compute the completion stats if we don't have any suggest field in the mapping. |
Is ES7 set to always generate completion stats during ingestion ? Can we turn this off? It is possibly a blocker for us to upgrade to ES7 from prior (old) versions in production for us if so... We are finding with our latest tests removing the above fixtures, we are still seeing it stand out in our hot threads. Does x-pack monitoring hit or stimulate the gathering of completion stats? |
It's not really anything to do with ingestion, nor is it specific to version 7. By default the completion stats are computed for each stats call and this seems to be true as far back as version 1.7 (I haven't checked further back).
Indeed you can; if you don't need to monitor completion stats so frequently then you should exclude them from these stats requests. I can't comment on how you might configure the third-party products linked above to do this, sorry, but Elasticsearch has had support for selecting specific stats for a long long time. |
Is this true for |
@rtkkroland oh dear, yes, I didn't realise we also compute completion stats for the cluster-level API but you're right I think we do: Lines 57 to 59 in 84dbadb
It doesn't look like there are selectors for this API 😕 |
Computing the stats for completion fields may involve a significant amount of work since it walks every field of every segment looking for completion fields. Innocuous-looking APIs like `GET _stats` or `GET _cluster/stats` do this for every shard in the cluster. This repeated work is unnecessary since these stats do not change between refreshes; in many indices they remain constant for a long time. This commit introduces a cache for these stats which is invalidated on a refresh, allowing most stats calls to bypass the work needed to compute them on most shards. Closes elastic#51915
Some additional follow up / findings on our side. We had Netdata installed on all our cluster nodes and its default configuration hits Strongly encourage the cost or risks of API's like |
Computing the stats for completion fields may involve a significant amount of work since it walks every field of every segment looking for completion fields. Innocuous-looking APIs like `GET _stats` or `GET _cluster/stats` do this for every shard in the cluster. This repeated work is unnecessary since these stats do not change between refreshes; in many indices they remain constant for a long time. This commit introduces a cache for these stats which is invalidated on a refresh, allowing most stats calls to bypass the work needed to compute them on most shards. Closes #51915
Computing the stats for completion fields may involve a significant amount of work since it walks every field of every segment looking for completion fields. Innocuous-looking APIs like `GET _stats` or `GET _cluster/stats` do this for every shard in the cluster. This repeated work is unnecessary since these stats do not change between refreshes; in many indices they remain constant for a long time. This commit introduces a cache for these stats which is invalidated on a refresh, allowing most stats calls to bypass the work needed to compute them on most shards. Closes elastic#51915 Backport of elastic#51991
Computing the stats for completion fields may involve a significant amount of work since it walks every field of every segment looking for completion fields. Innocuous-looking APIs like `GET _stats` or `GET _cluster/stats` do this for every shard in the cluster. This repeated work is unnecessary since these stats do not change between refreshes; in many indices they remain constant for a long time. This commit introduces a cache for these stats which is invalidated on a refresh, allowing most stats calls to bypass the work needed to compute them on most shards. Closes #51915 Backport of #51991
Computing the completion stats involves walking every field of every segment of every relevant shard, looking for completion fields. By default the seemingly-innocuous
GET _stats
API does this for every shard in the cluster. I've seen more than a few cases where an external monitoring system is hitting an overly-broad stats API hard enough that the cluster can't keep up. The consequence is that these stats requests pile up in themanagement
threadpool and interfere with the other users of that threadpool.As far as I can tell, these stats only change on a refresh. In most cases this means they do not change much at all, so I think we can improve the situation by caching these stats between refreshes.
I also note that in #33847 we changed the source of these stats from the external searcher to the internal one. I'm not sure why - external seems more appropriate to me, and would help with the caching since external refreshes may be very infrequent indeed.
Relates:
The text was updated successfully, but these errors were encountered: