numHistoryShards modify

We’re using Temporal and have an issue with the numHistoryShards configuration setting. We initially set it to 512, but have found it to be too high for our needs. Can we simply modify the configuration and restart the Temporal service to apply the changes?

Unfortunately no, if you change number of shards after your cluster is provisioned you would have to stand up a new one (one idea is to keep the old one running until all workflows have completed and route client calls for new executions to newly provisioned one with updated shard count).

Does the extra shards cause issues for you? 512 is typically not considered a large amount.

1 Like

I wish it used less memory

Or is there any way that to limit it’s memory usage?

Or can I run a new instance with a lower numShard, but share the same database with the old instance?

You could consider adjusting dynamic configs:

history.cacheInitialSize (default 128)
history.cacheMaxSize (default 512)
history.eventsCacheInitialSize (default 128)
history.eventsCacheMaxSize (default 512)

These are per shard configs.
History cache is LRU cache, items are evicted once max size its reached.

Another thing to consider is setting short namespace retention period and
dynamic config history.cacheTTL (default 1 hour). Cache entries not accessed for longer than TTL are considered expired and will be removed from cache next time they are accessed.

history.cacheInitialSize (default 128)
history.cacheMaxSize (default 512)
history.eventsCacheInitialSize (default 128)
history.eventsCacheMaxSize (default 512)

is the unit here MB?