While Swift is generating the cache, the CPU usage can be higher than usual. Swift is using more aggressive optimization than any other plugin on the market and it needs some CPU. Usually it isn’t an issue and CPU usage can be increased temporarily, but if it goes back to normal after prebuild finished, you don’t need to worry about it.
However, for large sites on relatively small server it can cause too high CPU usage temporarily. Actually, when the server is using CPU it is always using 100%. High usage means the CPU was used for a longer period.
If CPU usage is constantly higher you may need check the configuration. It is recommended to:
- Enable Compute API: Settings > General > Compute API
- Enable Optimize Prebuild Only: Settings > Optimization > General > Optimize Prebuild Only
- If you are not satisfied with Optimize Prebuild Only option, enable Optimize in background instead: Settings > Optimization > General > Optimize in Background.
- Setting a low number of threads as maximum: Settings > Optimization > General > Maximum threads: set this to 2 or 1. 1 will make the pre-build a bit slow, so try 2 first.
- Exclude third party CSS: Settings > Optimization > Styles> Exclude 3rd Party CSS.
- Disable Generate Critical CSS as generating Critical CSS is the most CPU intensive process: Settings > Optimization > Styles> Generate Critical CSS.
- Exclude third party JS: Settings > Optimization > Scripts > Exclude 3rd Party Scripts.
- Set Cache Expiry Mode to Action based, if you are not using nonce or anything that can expire on frontend: Settings > Caching > General > Cache Expiry Mode: Action based.
- Enable Prebuild Cache Automatically: Settings > Caching > Warmup > Prebuild Cache Automatically.
- Setup lower Limit prebuild speed (recommended to use on limited shared hosting): Settings > Caching > Warmup > Prebuild Speed: Moderate (or Slow).
- Exclude post types that you wouldn’t like to cache. Autoconfig should find most and exclude them automatically but you can can add them manually: Settings > Caching > Exceptions> Exclude Post Types.