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

Work In Progress: Add central LRU cache that adjusts to available memory #7426

Closed
wants to merge 1 commit into from

Conversation

bep
Copy link
Member

@bep bep commented Jun 25, 2020

Hugo has always been a active user of in-memory caches, but before this commit we did nothing to control the memory usage.

One failing example would be loading lots of big JSON data files and unmarshal them via transform.Unmarshal.

This commit consolidates all these caches into one single LRU cache with an eviction strategy that also considers used vs. available memory.

Hugo will try to limit its memory usage to 1/4 or total system memory, but this can be controlled with the HUGO_MEMORYLIMIT environment variable (a float value representing Gigabytes).

A natural next step after this would be to use this cache for .Content.

Fixes #7425
Fixes #7437
Fixes #7436
Updates #7544

@bep bep force-pushed the cache-bound branch 4 times, most recently from 5ce19a0 to c6d29f7 Compare June 27, 2020 11:25
@bep bep force-pushed the cache-bound branch 9 times, most recently from c2635a7 to 8a38818 Compare August 15, 2020 17:25
@bep bep changed the title Work in progress: Make cache memory bound Add central LRU cache that adjusts to available memory Aug 15, 2020
@bep bep mentioned this pull request Aug 15, 2020
@bep bep force-pushed the cache-bound branch 2 times, most recently from eab9cf2 to fbc75f2 Compare August 16, 2020 12:22
@bep bep added the Keep label Sep 20, 2020
@bep
Copy link
Member Author

bep commented Sep 20, 2020

Note to self: Rember/consider *.config.js files.

@bep bep force-pushed the cache-bound branch 2 times, most recently from 3209412 to ac391f9 Compare October 22, 2020 09:03
@bep bep changed the title Add central LRU cache that adjusts to available memory Work In Progress: Add central LRU cache that adjusts to available memory Oct 22, 2020
@bep bep force-pushed the cache-bound branch 2 times, most recently from c00a644 to e4e1027 Compare October 26, 2020 18:47
Hugo has always been a active user of in-memory caches, but before this commit we did nothing to control the memory usage.

One failing example would be loading lots of big JSON data files and unmarshal them via `transform.Unmarshal`.

This commit consolidates all these caches into one single LRU cache with an eviction strategy that also considers used vs. available memory.

Hugo will try to limit its memory usage to 1/4 or total system memory, but this can be controlled with the `HUGO_MEMORYLIMIT` environment variable (a float value representing Gigabytes).

A natural next step after this would be to use this cache for `.Content`.

Fixes gohugoio#7425
Fixes gohugoio#7437
Fixes gohugoio#7436
Fixes gohugoio#7882
Updates gohugoio#7544
@jmooring
Copy link
Member

Closing, superseded by #11894.

@jmooring jmooring closed this Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants