One of the metrics in the top widget on your Dashboard is “Cache Size”:
Cache Size displays the disk space used by NitroPack’s cache files.
What is a good cache size?
The size of a site’s cache varies wildly from site to site and depends on many factors. For example, the content length per page in one site can be very different from another one. Also, the total number of pages that exist between sites can vary greatly.
However, a large cache size can be a signal of a suboptimal cache setup.
Telltale signs of cache issues are the following two cases:
- Large cache size and high cache hit ratio - In this case, it is worth checking if you are not creating excessive cache by optimizing rarely accessed pages (low traffic pages). If that’s causing the issue, it would be better to reconfigure Cache Warmup to preemptively cache only the high traffic pages and leave the rest to be optimized organically.
- Large cache size but low cache hit ratio - In this scenario, it’s very much likely that you have a lot of cache variations, the cache system does not ignore these parameters, and most visitors are being served unique pages.
And here’s how you can fix those issues:
Ways to Optimize Your Cache Size
Optimize Cache Warmup
Note: Sitemap XML is an available option for paid plans only.
If you determine that NitroPack caches a lot of pages that rarely get traffic, an easy way to optimize your cache size is to reduce the number of optimized pages by supplying a separate Sitemap XML containing only your high traffic pages.
In case that you’re on a free plan, you can exclude specific low-traffic URLs from being optimized as well:
- Go to your “General Settings” panel;
- Enable “Excluded URLs”;
- Paste the specific URLs that you do not like to be optimized.
Reduce Page Variations
Page variations occur when visitors end up on the same page with a different input data request.
For example, when you run campaigns, your URLs get tracking parameters added to them. If the cache system does not ignore these parameters, they will generate separate cache files for each visitor leading to a large number of cache files, and a low cache hit ratio.
NitroPack already ignores the most important parameters, but if you use parameters outside of the default list, make sure to configure them.
Another case of page variation is through cookies - some cookies are supposed to modify the pages’ content (e.g., language preference cookies), but others are not (e.g., session cookies). If you have configured variation cookies, make sure only to include cookies that modify the content.
NitroPack uses the Variation Cookies option to create different optimized versions of your pages for users who visit your site with any possible combinations of configured cookies - for example, language + currency.
NitroPack’s caching mechanism will prepare optimized versions of all possible combinations of the cookies and their known values. While this ensures great coverage of possible organic requests and a better cache hit ratio, your cache size will increase.
Using fewer variation cookies will eventually lead to fewer cached files and a smaller cache size overall.