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 fine control for workflow cache eviction #573

Open
9 tasks
antmendoza opened this issue Jan 8, 2025 · 2 comments
Open
9 tasks

Add fine control for workflow cache eviction #573

antmendoza opened this issue Jan 8, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@antmendoza
Copy link
Member

Is your feature request related to a problem? Please describe.

Some users want to control when workflows are evicted from the cache. For example:

  • They may want to evict workflows they know will sleep for days. For non-latency-sensitive use cases, the cost of storing these workflows in the cache is higher than polling and replaying the workflow history when the timer fires. Ideally, they want to prioritize keeping in the cache workflows that they know are actively active and latency-sensitive.

  • They may want to keep in cache workflows that will be queried after the workflow is closed (and evicted from cache). Querying closed workflows comes with extra latency since the workflow history has to be fetched and replayed by the worker before executing the query. Users want to control how long the workflow will be stored in the cache after the workflow is closed to prevent the extra latency that comes with fetch + replay

Describe the solution you'd like

Additional context

Per-SDK Tickets

  • Go -
  • Java -
  • Core -
  • TypeScript -
  • Python -
  • .NET -
  • Ruby -
  • PHP -
  • Temporal CLI -
@antmendoza antmendoza added the enhancement New feature or request label Jan 8, 2025
@cretz
Copy link
Member

cretz commented Jan 8, 2025

This will need some internal discussions on design, and some of the work may be server side if post-close queries don't use the sticky queue anyways.

@Quinn-With-Two-Ns
Copy link
Contributor

They may want to evict workflows they know will sleep for days.

Currently SDKs use a LRU strategy for eviction, I think their is room for optimization here. For example we could factor in history size when choosing what workflow to evict. If it is worth optimizing eviction vs just asking users to increase their memory and cache size I am not sure.

and some of the work may be server side if post-close queries don't use the sticky queue anyways.

Yes their is some server side work needed to allow query to always use the workflow cache temporalio/temporal#4463.

I do think it should be opt in since keeping a closed workflow in cache by default on the chance that it may be queried, is not appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants