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

feat: configurable last cache eviction #25520

Merged
merged 3 commits into from
Nov 6, 2024
Merged

Conversation

hiltontj
Copy link
Contributor

@hiltontj hiltontj commented Nov 5, 2024

Closes #25519

This alters the eviction behaviour of the last-n-value cache:

  • The cache, when queried, will not produce entries that are expired. This actually wasn't done before, which would have been a bug, but this also allows us to more leniently run cache eviction.
  • The process that runs eviction on the LastCacheProvider is now run in the background, by default, every 1m, but the interval can be configured by the user on server start with the --last-cache-eviction-interval argument.
  • Cache eviction is no longer run on every buffered write, which should reduce lock contention

This changes how the last cache is evicted. It will no longer run eviction
on writes to the cache, instead, there is an optional method to create a
last cache provider that will run eviction in a background task on a specified
interval.

Otherwise, when records are produced from the cache, only those that have
not expired will be produced.

This should reduce locks on the cache and hopefully improve performance.
@hiltontj hiltontj added the v3 label Nov 5, 2024
@hiltontj hiltontj self-assigned this Nov 5, 2024
Copy link
Contributor Author

@hiltontj hiltontj Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes here are the key to fixing the performance issue. This:

  1. Does not run eviction on every buffered WAL batch
  2. Does not hold a lock on the write buffer while populating the last cache

@hiltontj hiltontj marked this pull request as ready for review November 6, 2024 14:47
@hiltontj hiltontj merged commit 391b67f into main Nov 6, 2024
13 checks passed
@hiltontj hiltontj deleted the hiltontj/lastcache-eviction branch November 6, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invoke last cache eviction less frequently
2 participants