Host level cache for history
History uses mutable state cache and history event cache, and the caches are per shard, this is not efficient and hard to config.
We should make cache host level that is shared among all shards hosted on that host.
The dynamic config for cache size is entry count, but it is not easy to estimate the average entry size and make it harder to config. We should change the config to be byte size so cache would take up to the configured memory byte size.
Here are the current dynamic configs for cache size:
history.cacheInitialSize default 128
history.cacheMaxSize default 512
history.eventsCacheInitialSize default 128
history.eventsCacheMaxSize default 512
We should also emit a gauge metric that measures the cache size in use. We already have the cache_hit and cache_miss, which we should keep after upgrade to host level.
yes please!
I believe this was made the default in v1.25.0: https://github.com/temporalio/temporal/pull/5894
What is the earliest version that I can enable history.enableHostHistoryCache = true with? I couldn't find it in the release notes. This commit leads me to believe v1.23.0: https://github.com/temporalio/temporal/commit/7b146c22af13ef6101db6252733ab3ed10eb881d
cc @prathyushpv