-
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
[Fleet] Improve performance of auto package policy upgrades #121639
Comments
Pinging @elastic/fleet (Feature:EPM) |
Pinging @elastic/fleet (Team:Fleet) |
Before we do the implementation work above, we should validate with a large data set + APM instrumentation that this is indeed the area that is causing the slowdown. |
@joshdover I started working on this, and had a few questions:
Is there a guide about how to use APM instrumentation to check slowness in kibana, I haven't used APM before. |
Makes sense to me 👍
Agreed, that is probably a confusing workflow to have this API have this side-effect. cc @nchaulet and @kpollich on any input here.
See https://www.elastic.co/guide/en/kibana/current/kibana-debugging.html#_instrumenting_with_elastic_apm I also want to flag that this PR may have a slight impact on this work: #125788 |
thanks, yes I noticed that pr, will rebase once merged :) |
Hmm, thinking about this a bit I don't think this is ideal either. It makes more sense to me to have upgrades happen only during setup rather than during preconfiguration updates. I'm not 100% sure where we call preconfiguration update rather than setup currently, though, so I might be missing a use case. |
I raised a draft pr, will continue with tests. I tried to use APM instrumentation (following the guide), but currently it is not working for 8+ versions, because of the default policies change, fix is in progress: elastic/apm-integration-testing#1435 Apart from that, I did some manual time measurements of Measuring with this improvement merged by @joshdover yesterday, which removed The actual policy upgrade takes more time as expected, so far the times were around 4-5000ms for system package. I think the refactor still make sense to make the logic simpler and more readable. |
You can also use your own Cloud deployment if you'd like, this is how I do it personally. It's nice to have a test cluster that you use over the course of several months with some real data to play around with and can make whatever Fleet changes you'd like to it without affecting other employees.
Well that's a nice side-effect of that bug fix. Thanks for taking the time to measure it. I also suspected this was the main issue as it seemed to be the thing we were querying repeatedly unnecessarily.
+1, thanks for continuing forward with this. |
We have suspicion that some customers are running into some performance problems on the
/api/fleet/setup
endpoint caused by the "keep policies up-to-date" logic in Fleet setup. This has some opportunity for some optimization improvements which would minimize the overhead of running this logic during Fleet setup.Current implementation
id
s for all package policieskibana/x-pack/plugins/fleet/server/services/preconfiguration.ts
Lines 357 to 367 in 2fa5a87
id
:kibana/x-pack/plugins/fleet/server/services/managed_package_policies.ts
Line 39 in 2fa5a87
keepPoliciesUpToDate == false
or is already up to date, skip this package policyProposed implementation
Most of the decisions we need to make could be made with much fewer fetches by looking at the packages first and then using that information to filter for the package policies that need to be upgraded.
keepPoliciesUpToDate = true
andname in [managed package names]
packageName = installedPackage.name
andversion != installedPackage.version
The text was updated successfully, but these errors were encountered: