temporalio / sdk-core

Core Temporal SDK that can be used as a base for language specific Temporal SDKs
MIT License
283 stars 77 forks source link

[Feature Request] Evict cached workflows on workflow complete #836

Closed cretz closed 1 hour ago

cretz commented 3 weeks ago

Describe the solution you'd like

Like Go and Java, Core should evict cached workflows when server accepts workflow completion. Since post-close queries don't use the sticky queue anyways, Core was saving lang some steps, but full history was being downloaded anyways and it was just luck if the query landed on the same worker as the cache anyways. It was decided that we might as well save users memory in the common case. After discussion, there was not enough concern for reliance on existing behavior to need to have an option.

This also means Core needs to support the temporal_sticky_cache_total_forced_eviction metric now like Go and JAva.

aezomz commented 1 week ago

Hi Cretz, just want to understand. For current behavior, eviction only happens when the memory runs out? or after hitting MAX_CACHED_WORKFLOWS ?

Also issues like this in this repo, is it normally for Temporal maintainers to keep track and pick up?

cretz commented 1 week ago

With current behavior, eviction only happens if the spot is needed (so the cache size never decreases). We have this tracked on our near-term backlog.