This change reduces memory allocations when building the WorkflowState object, particularly when a step had a large number of retries. This was accomplished in two ways:
The SDK EventType.eventType() method allocates memory every time it is called, to generate an enum object from the source string. This method was being called a lot while reading through the workflow event history. Now, the method is generally only called once per event.
WorkflowState now only builds one PartitionState object per partition, rather than one per retry attempt.
For a workflow that had a step with 1000 retries, these changes reduce memory allocations during WorkflowState.build() by about 75%.
I also moved the workflow cancellation handling into one place instead of being split across three different methods.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Someone pointed out to me that a newer version of the AWS SDK fixes the enum issue, so I'm reverting the eventType() related changes in favor of just updating our SWF SDK to a newer version.
This change reduces memory allocations when building the WorkflowState object, particularly when a step had a large number of retries. This was accomplished in two ways:
EventType.eventType()
method allocates memory every time it is called, to generate an enum object from the source string. This method was being called a lot while reading through the workflow event history. Now, the method is generally only called once per event.WorkflowState
now only builds onePartitionState
object per partition, rather than one per retry attempt.For a workflow that had a step with 1000 retries, these changes reduce memory allocations during
WorkflowState.build()
by about 75%.I also moved the workflow cancellation handling into one place instead of being split across three different methods.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.