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

Cache all package manifest on startup #103

Merged
merged 3 commits into from
Sep 12, 2019
Merged

Conversation

ruflin
Copy link
Member

@ruflin ruflin commented Sep 11, 2019

So far in each request to search or categories all manifest had to be reread from disk each time. As the packages do not change during the runtime of the service, this is not necessary and all can be cached on startup of the service and kept in memory. Even if there are one day 10000 packages and each manifest is 1KB, this would only consume ~10MB of memory (currently manifest are only about 250 Bytes). Using 10MB of memory instead of 10000 file read on each request seems worth it.

The code was also modified to in general pass a copy of the packages instead of using a reference. This makes sure even if a request modifies the packages locally, the global package list is not modified.

So far in each request to search or categories all manifest had to be reread from disk each time. As the packages do not change during the runtime of the service, this is not necessary and all can be cached on startup of the service and kept in memory. Even if there are one day 10000 packages and each manifest is 1KB, this would only consume ~10MB of memory (currently manifest are only about 250 Bytes). Using 10MB of memory instead of 10000 file read on each request seems worth it.

The code was also modified to in general pass a copy of the packages instead of using a reference. This makes sure even if a request modifies the packages locally, the global package list is not modified.
remove requirement to use reference for IsNewer. Not needed

simplify magefile by introducing also GetPackages

make getPackagePaths private
@ruflin ruflin marked this pull request as ready for review September 12, 2019 12:32
@ruflin ruflin requested review from jfsiii and skh September 12, 2019 12:33
@ruflin ruflin merged commit a575c39 into elastic:master Sep 12, 2019
@ruflin ruflin deleted the preload-packages branch September 12, 2019 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants