dhiaayachi / temporal

Temporal service
https://docs.temporal.io
MIT License
0 stars 0 forks source link

Expiration policy for signal requestIDs in mutable state #432

Open dhiaayachi opened 2 months ago

dhiaayachi commented 2 months ago

Is your feature request related to a problem? Please describe. Today if workflow is signal directly via the Signal api (not workflow-to-workflow signal), signal requestID will be store in workflow mutable state forever, which will result in an increase in mutable state size, which could lead to performance issue when say there're 30K signal requestIDs.

Describe the solution you'd like

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

dhiaayachi commented 1 month ago

Thank you for reporting this.

This is an interesting issue with Temporal's workflow signal mechanism. It seems the current design might lead to growing workflow mutable state sizes when handling external signals. You are suggesting ways to mitigate this.

The provided documentations do not have specific workarounds for this particular issue, however, they contain valuable insights into Temporal's workflow message passing mechanisms, specifically focusing on the differences between Signals, Queries, and Updates.

For a possible workaround, you might consider:

To further understand the nature of the issue, I would need some more information about your workflow implementation.

I'm happy to help further as you provide more context!

dhiaayachi commented 1 month ago

Thank you for reporting this issue. I understand that storing signal request IDs in workflow mutable state forever can lead to performance issues, especially when dealing with a large number of signals.

Currently, there is no built-in mechanism to automatically expire or remove signal request IDs from workflow mutable state. The closest option that you have already mentioned is using the existing max signal count limit. This limit ensures that the number of signals that a workflow can receive is capped, preventing an excessive buildup of request IDs in mutable state.

We appreciate your feedback and will consider your feature request for future releases.