Everybody loves a fast website/app. There is nothing more frustrating than twiddling your thumbs while a page loads.If you have followed our other articles in our Getting Maximum Speed from Your WordPress Site series you would have seen how image optimisation. minification and caching can improve your site speed. Well now we are going to move away from those measures and step into the realm of VPS (Virtual Private Server) hosting.
VPS hosting is more expensive and requires more knowledge than regular hosting. So why would you choose to go with VPS hosting over your current plan? In our opinion a VPS hosting is warranted when:
- You have optimized your site as far as possible and still want it to go faster
- You want to build your own server stack that can scale up to 1 million+ visitors per day
- You want more control over your server
What sort of results will I get from VPS hosting?
For this experiment we replicated a clients site on a newly provisioned VPS account. Initially we focused on measuring the server response time as an indication of the quality improvement gained with VPS hosting.
Configuration 1: LAMP Stack
The initial configuration consisted of a LAMP (Linux, Apache, MySQL and PHP). This is a pretty standard setup for hosting so I wouldnt expect much of a speed difference. We chose a cloud based VPS solution by Digital Ocean with the minimum required specs for WordPress (at least 1GB RAM).
Immediately after setting up the wordpress site we measured the server response time:
- non VPS hosting: 3.5 seconds
- VPS hosting: 500 milliseconds
Wow – what a big difference! Just switching to a VPS improves the server response time by 650%. The next step was to run a blitz test to see how well the site responds traffic.
As you can see from the screenshot below the site did not scale well. After only 3 concurrent users the site crashed. In fact I needed to manually restart MySQL – not a good result.
Configuration 2: LEMP Stack
Similar to the LAMP stack except we are now using NGINX as a proxy server in front of Apache. NGINX is built for dynamic PHP sites so should improve the site speed and the scaleability of the site. Here are the results of the LEMP stack:
- LAMP: 500 milliseconds
- LEMP: 250 milliseconds
Thats a fair improvement, but can it handle traffic. Well this time the server didnt crash straight away, but the site started lagging significantly once traffic increased:
Its Alive! Varnish Accelerator with LEMP
The next step was to setup Varnish HTTP Accelerator (also known as Varnish Cache but its much more than a cache).
Varnish has an astounding reputation so we thought we would throw everything we got at it – a 500 users per second blitz.
After deploying Varnish the results were staggering! Although there was virtually no change in the response times, the server didnt flinch even as the number of concurrent users increased. Incredibly the response time actually improves with more users. This is due to the way that Varnish works whereby current users create a cache for future users. Below is the screenshot:
Under this configuration the site could easily handle over 1 million hits per day. I continued to run blitz tests to the limit and found that the server can scale up to 15 million hits per day before users start experiencing issues.
This article is part of our series on speeding up WordPress – you can read part one here