On my other website which is had quite high traffic with 47.000++ members, i used several layers of cache to handle traffic spikes. My software specs are running on WordPress 5.5, PHP 7.4.5, MariaDB 10.5.5, Centos 7 with Sentora Panel, Apache Web Server and PHP-FPM Server for PHP Handler.
- Opcache, first thing first, this module of PHP must be installed on your system. Setting it up based on your web’s need, mine is 256MB for it’s memory
- Memcached, if you want to survive from high traffic spikes you have to install this memory object cache on your server. I used 4GB for it’s memory shared. Works like magic
- Mod_pagespeed, one of apache’s module that really help me to optimized my website. This module rewrites css, js and images, combine it, inlining it on the fly while users access your web, and it also cache all those static contents in your disk or even in your ram using memcached integration, so next pageload become super fast. Mod_pagespeed is all in one and the next level of web’s optimization
- Cloudflare CDN, in terms of cache, cloudflare’s free service helps me with storing static contents from pagespeed optimization so it reduce server load really significant. Beside that cloudflare comes with so many tools like free SSL/TLS, protection from DDos, and even can optimize your web on the fly, but i don’t use it because i already had mod_pagespeed.
- Browser leverage cache, the last cache you can count on, set it up on .htaccess file so repeat visitors fetch you web’s content from their browser instead from your server, it helps reduce your server load too.
With all those cache layers on your server will help you reduce server cost. I only use shared VPS with 6 cores CPU and 16 GB RAM, and server load at most 1.xx when it’s on high visitors time.
Try the art and you won’t regret it.