Skip to content
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

/api/kibana/management/saved_objects/scroll/counts very slow when lot of documents #133748

Closed
pgayvallet opened this issue Jun 7, 2022 · 5 comments
Assignees
Labels
enhancement New value added to drive a business result Feature:Saved Objects Management good first issue low hanging fruit Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@pgayvallet
Copy link
Contributor

pgayvallet commented Jun 7, 2022

When testing on a 500k objects cluster, I saw that the call to /api/kibana/management/saved_objects/scroll/counts takes approximatively 2minutes. During this time, the counts are not properly surfaced in the UI.

We can probably improve that by increasing the number of documents per page:

const findOptions: SavedObjectsCreatePointInTimeFinderOptions = {
type: typesToInclude,
perPage: 1000,
};

Plus, we're currently storing all the results in memory, just to count the number of document per type

const objects = await findAll(client, findOptions);
const counts = objects.reduce((accum, result) => {

We should increment the counter between each batch instead of keeping all documents in memory.

Also, we can probably improve the search request by asking to not return any attribute fields (See SavedObjectsFindOptions.fields) which should also increase the overall performances.

As an alternative, we could also see if we can use an aggregation instead of a full scroll.

@pgayvallet pgayvallet added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc enhancement New value added to drive a business result Feature:Saved Objects Management labels Jun 7, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@pgayvallet pgayvallet added the good first issue low hanging fruit label Jun 7, 2022
@elastic elastic deleted a comment from Saga-123-soc Jun 9, 2022
@rahuldimri
Copy link
Contributor

@pgayvallet Can I work on this ?

@pgayvallet
Copy link
Contributor Author

@rahuldimri Sure, please feel free to take a shot at it!

@rahuldimri
Copy link
Contributor

Thanks @pgayvallet can you assign this one to me.

@pgayvallet
Copy link
Contributor Author

Fixed by #168918

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Saved Objects Management good first issue low hanging fruit Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

3 participants