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

Add active cache eviction for history service #7547

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

PowerStateFailure
Copy link

What changed?

Add active cache eviction for history service (mutablestate and event caches) implemented as background routine per cache instance that periodically evicts at most N expired elements from cache. The eviction interval and number of elements to be evicted during iteratino (N) can be configured via dynamic config on per-instance base.

The feature is disabled by default.

Why?

In our use-cases Temporal server is deployed in very restricted environments where it shares resources with different services for different use-cases. We faced that after load spikes Temporal keeps consume memory allocated by caches forever (related issue: #4233), and then we found that Temporal implements only passive memory eviction for caches (the terminology is taken form Redis), i.e. element will be removed from cache only when inserting new element in already full cache. Thus we implement active cache eviction and decided to return it back into upstream.

How did you test it?

Tested with our internal fork running in several on-premise environments.

Potential risks

Since the feature is disabled by default, any problems are rarely expected.

Documentation

Is hotfix candidate?

@PowerStateFailure PowerStateFailure requested a review from a team as a code owner April 1, 2025 04:53
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.

1 participant