# Tune cache values

Applies to All Core roles, but particularly Content Delivery

A Sitecore cache consumes memory based on the amount of data stored in the cache. Cache size defines the maximum application memory the cache can consume. The following instructions apply to all Sitecore caches. To tune cache values:

1. Ensure that you have set initial cache values before tuning.

2. Choose a load testing tool (Gatling and JMeter are free).

3. Start a load test that hits all items in all languages. The load test should run for the duration of the cache tuning exercise.

• If you are tuning caches for Content Delivery, your load test should simulate visits to the published site.

• If you are tuning caches for Content Management, your load test should simulate visits to the Experience Editor and Content Editor. Ideally, your test should including expanding the Content Tree.

4. While the load test is running, browse to the /sitecore/admin/cache.aspx page. Pay particular attention to the following caches when tuning the Content Delivery environment:

• web[data] (Data cache)

• web[item] (Item cache)

• SqlDataProvider- Prefetch data(web) (Prefetch cache)

Pay particular attention to the following caches when tuning the Content Management environment:

• master[data] (Data cache)

• master[item] (Item cache)

• SqlDataProvider- Prefetch data(master) (Prefetch cache)

5. Press the Refresh button on the /sitecore/admin/cache.aspx page to see how the caches react to load.

### Note

The maximum amount of memory that you can assign to caches depends on the amount of memory available in the system.

1. Increase the size of the cache by 25% when:

• The size of the cache is consistently more than 80% of the maximum cache size.

• The cache Delta fluctuates significantly. This indicates that the cache is regularly exceeding max size and being scavenged.

### Note

A cache is scavenged by half (half of the cache entries are removed) when it exceeds maximum.

2. If the size of the cache remains less than 50% of the MaxSize, decrease the size of the cache by 25%.

3. Repeat the previous step until the caches are stable. A cache is considered stable when:

• The cache size is between 70% and 80%.

• The Delta value remains relatively consistent.