If your hosting provider has notified you that your website’s CPU usage is high, it is possible that NitroPack is the cause.
➡️Here are two reasons why this may happen:
Excessive Cache Warmup
If your site has a lot of pages to warm up (pre-optimize) and/or lacks enough server resources, warming up the cache may cause a spike in CPU usage.
Our Cache Warmup feature imitates real user hits and visits many URLs in a short timeframe.
If the requests cause the CPU of the server to spike, you can try:
1. Limiting the number of URLs in your website’s sitemap to the top 10-20% of pages that receive the highest traffic.
First, check what your highest traffic pages are via a tracking service such as Google Analytics.
After doing so, the URLs can be used to create a custom sitemap that contains only those pages.
2. Remove your sitemap from the Cache Warmup.
To do this, head over to our Cache Insights page: https://app.nitropack.io/cache-insights
In the right widget for our Cache Warmup, click on Edit.
Inside, simply remove your sitemap URL and click on Update.
After the Update, the Cache warmup method will automatically switch to "Standard" mode. By doing so, NitroPack would only crawl your website's homepage and warmup any URLs found there.
3. Disabling the Cache Warmup completely and relying on real user visits to trigger optimizations.
This option is less ideal than the others, as your website’s pages are optimized only after a user visits them.
If you wish to do this, head over to the Cache Insights page, then click on Edit, and then Disable.
4. Purge the cache during periods of low activity. This can be at night or when you know less traffic is generated.
If all of your website’s pages have already been optimized and you need to re-optimize all of them, you can try doing a full purge of the cache only in periods of low activity on your website so that NitroPack can re-optimize the pages when there is less traffic, and our contribution to the CPU usage would be lower.
To do a full cache purge, head to our Dashboard page and hit “Purge All Cache”.
A lot of URLs are queued for optimization
📍Optimizations are queued when their status is “Scheduled for optimization” in https://app.nitropack.io/cache-insights
Unless there is a lot of traffic to the website, many pages being queued for optimization are usually related to our Cache Warmup.
The process of optimizing the website involves our service fetching all of the resources from your server and optimizing them on our end.
The fetching process may overload the server by sending too many requests in a short period of time.
Also, when an optimization is ready for a given URL, we send another webhook to notify the server, which counts as another request.