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

Client-side savedObject client: optimize bulk get pooling #82581

Closed
pgayvallet opened this issue Nov 4, 2020 · 1 comment · Fixed by #82603
Closed

Client-side savedObject client: optimize bulk get pooling #82581

pgayvallet opened this issue Nov 4, 2020 · 1 comment · Fixed by #82603
Labels
enhancement New value added to drive a business result Feature:Saved Objects performance Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@pgayvallet
Copy link
Contributor

pgayvallet commented Nov 4, 2020

The client-side savedObject client is using a pooling mechanism for get operations

public get = <T = unknown>(type: string, id: string): Promise<SimpleSavedObject<T>> => {
if (!type || !id) {
return Promise.reject(new Error('requires type and id'));
}
return new Promise((resolve, reject) => {
this.batchQueue.push({ type, id, resolve, reject } as BatchQueueEntry);
this.processBatchQueue();
});
};

private processBatchQueue = throttle(
() => {
const queue = cloneDeep(this.batchQueue);
this.batchQueue = [];
this.bulkGet(queue)

When calling client.get multiple times with the same type/id tuple, the resulting bulkGet that fires contains these duplicates.

We should remove the dupes when calling the backend, and then optimize the logic to dispatch (copies of) the object to the get calls that requested the same object.

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

Pinging @elastic/kibana-platform (Team:Platform)

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 performance Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants