# numHistoryShards modify

**URL:** <https://community.temporal.io/t/numhistoryshards-modify/7585>\
**Category:** Community Support\
**Created:** [March 16, 2023, 1:44am UTC](https://community.temporal.io/t/numhistoryshards-modify/7585 "2023-03-16T01:44:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rj.huangsir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/rj.huangsir/32/2817_2.png) [@rj.huangsir](https://community.temporal.io/u/rj.huangsir)\
**Post date:** [March 16, 2023, 1:44am UTC](https://community.temporal.io/t/numhistoryshards-modify/7585/1 "2023-03-16T01:44:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [March 16, 2023, 2:30pm UTC](https://community.temporal.io/t/numhistoryshards-modify/7585/2 "2023-03-16T14:30:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rj.huangsir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/rj.huangsir/32/2817_2.png) [@rj.huangsir](https://community.temporal.io/u/rj.huangsir)\
**Post date:** [April 4, 2023, 6:21am UTC](https://community.temporal.io/t/numhistoryshards-modify/7585/3 "2023-04-04T06:21:48Z")

</div>

I wish it used less memory

---

<div class="post-metadata">

**Author:** ![rj.huangsir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/rj.huangsir/32/2817_2.png) [@rj.huangsir](https://community.temporal.io/u/rj.huangsir)\
**Post date:** [April 4, 2023, 6:32am UTC](https://community.temporal.io/t/numhistoryshards-modify/7585/4 "2023-04-04T06:32:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rj.huangsir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/rj.huangsir/32/2817_2.png) [@rj.huangsir](https://community.temporal.io/u/rj.huangsir)\
**Post date:** [April 4, 2023, 7:09am UTC](https://community.temporal.io/t/numhistoryshards-modify/7585/5 "2023-04-04T07:09:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [April 5, 2023, 1:36pm UTC](https://community.temporal.io/t/numhistoryshards-modify/7585/6 "2023-04-05T13:36:28Z")

</div>

You could consider adjusting dynamic configs:

```auto
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.

---

<div class="post-metadata">

**Author:** ![rj.huangsir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/rj.huangsir/32/2817_2.png) [@rj.huangsir](https://community.temporal.io/u/rj.huangsir)\
**Post date:** [April 6, 2023, 1:34am UTC](https://community.temporal.io/t/numhistoryshards-modify/7585/7 "2023-04-06T01:34:17Z")

</div>

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

is the unit here MB?
