Do you have a dynamic website which is built with MySQL and PHP? If your website and audience is growing, there might be a problem with the website’s performance. Without any caching mechanism your website becomes slow if your website gets more visitors than the web server can handle. Do you like to know more about PHP caching, Redis and Memcached? Keep reading…
Why does your website need a PHP cache?
A dynamic website without caching can’t handle a lot of visitors. If a visitor access a dynamic website, all database queries and PHP script executions will use RAM memory and CPU power. Since all server resources are limited, your web server and website will become slow or unavailable.
We tested a page from a website build with WordPress. We did the first test without caching enabled. During the test both CPU’s need to work harder and the load was a bit high. At the moment that 50 concurrent users visited the website, 15 PHP processes have been used. The URL load time (95th percentile) was above 100 ms.
Next we did the same test with caching enabled. The load was much lower and the CPU was not used at all. Only 5 PHP processes have been used at the moment that 50 concurrent users have visited the site. The cached version was much faster with less than 50 ms, URL load time (95th percentile).
What kind of PHP cache can you use to speed up your website?
There are different kinds of cache types and all of them have different functions. Our list includes only server side cache types which are used together with PHP scripts. Other cache types like browser cache, database cache or proxy cache are not the scope of this article.