Skip to content

Conversation

markusthoemmes
Copy link
Contributor

@markusthoemmes markusthoemmes commented Jul 18, 2025

For the index cache (which is always global currently), we don't set an upper bound as to how many indexes can be cached. That's likely benign in local cases but causes an arbitray amount of memory to be consumed if used as a service. This introduces an LRU cache instead, which can be configured using APKO_INDEX_CACHE_SIZE.

I think this also fixes a race in the existing implementation where we'd leak indexes with outdated etags if two HEAD requests would race outside of the critical section of adjusting the etag pointers.

For the index cache (which is always global currently), we don't set an upper bound as to how many indexes can be cached. That's likely benign in local cases but causes an arbitray amount of memory to be consumed if used as a service. This introduces an LRU cache instead, which can be configured using APKO_INDEX_CACHE_SIZE.

I think this also fixes a race in the existing implementation where we'd leak indexes with outdated etags if two HEAD requests would race outside of the critical section of adjusting the etag pointers.
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