Skip to content

Conversation

timl3136
Copy link
Member

@timl3136 timl3136 commented Feb 27, 2025

What changed?
Scaffold ByteSize() measuring size estimation for history event cache
Also added empty ByteSize() for structs in HistoryEvent

Why?
We want to modernize existing cadence common cache implement to a bytes-based system. That means we need to have a method to measure each entry (which is currently accepting any generic interface). We found the "Reflect" package provides a measuring function but runtime is too slow to be used in cache operations. Therefore, we will require all usages to implement the ByteSize() function in their cache logic if they want to migrate to the new bytes-based system.

In order to seamless transition from the current cache system with an entry-based model, the implementation and rollout will be done in following phases:

Define the Sizeable interface
Implement Sizeable for cadence-history service
a. Implement Size() for ExecutionCache
b. Implement Size() for EventCache <-- This PR
Implement bytes-based cache system
Enable new cache system for usage in cadence-history service
Implement and enable new cache system for the remaining usages

How did you test it?
Unit tests

Potential risks
No risk since this PR only adds read-only function that is not used.

Release notes

Documentation Changes

@timl3136 timl3136 changed the title Implement Size() measuring size estimation for history event cache Implement ByteSize() measuring size estimation for history event cache Mar 26, 2025
@shijiesheng
Copy link
Member

change title to scaffold rather than implement

@timl3136 timl3136 changed the title Implement ByteSize() measuring size estimation for history event cache Scaffold ByteSize() measuring size estimation for history event cache Apr 1, 2025
@timl3136 timl3136 enabled auto-merge (squash) April 1, 2025 16:56
@timl3136 timl3136 merged commit 2672a94 into cadence-workflow:master Apr 1, 2025
22 checks passed
@timl3136 timl3136 deleted the sizeable-cache-3 branch April 1, 2025 18:01
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.

2 participants