How to Optimize a WordPress Site for Speed and Performance
There have been multiple discussions around speed and performance of websites, particularly WordPress sites. In this post, you will find my self assessment of speed and performance results from this site. As I began looking at optimizing the content for my blog for Search engine optimization the matter of website speed came up.
The Need For Speed: Optimizing a WordPress site
Why is my site so slow?
This is a common question asked in Web Hosting or WordPress Forums and sites. For writing this post, I ‘slowed’ down my site to explain typical reasons.-Amar Vyas, January 2, 2021
Let us break down this question into multiple elements, and try and answer this query. A WordPress site is a sum of many moving parts. These include, but are not limited to:
|Server and Memory||Network Speeds||PHP and MySql version|
What is this blog made of
I use the Hestia Theme for WordPress, with about 15 plucing including CDN (Gumlet) and Security Ninja. I use Cloudflare for DNS, though not for the CDN or Content Delivery Network or caching. In other words, the server (VPS in my case) has to do the heavy lifting. I use Gridpane for server and WordPress management, whcih uses Nginx by default at the time of writing.
In terms of plugins, I use Gridpane Redis Object Cache and Nginx Helper plugins for server side, and Fast Velocity Minify plugin for WordPress content delivery. I had autooptimizer plugin previously, which I might get back to in a few days’ time.
This site gets about 600-700 visitors a day, so not a very busy site. The VPS is PHP-Friends located in Germany, with the following specifications:
Under the hood: What runs this website
SERVER INFO: Processor: 2 vcore Intel Xeon E5-2630 v3 @ 2.40GHz Memory: 6 GB + 6 GB Swap Disk: 65 GB SSD OS: Linux (Unubtu 18.04) Server: nginx/1.16.1 PHP: 7.4.11 MySQL: 8.0.21-12 Server Load: 1.34 DB Data Size: 67 MB DB Index Size: 4 MB --- LIMITS: PHP Max Exec Time: 300 PHP Memory Limit: 512 MB PHP Max Upload Size: 512 MB PHP Max Post Size: 512 MB MySQL Max Packet Size: 64 MB MySQL Max Connections: 151
Speed Test Results Compared
Resources to Learn More about How to Speed up WordPress Site
- Website Performance Benchmarking: https://geekflare.com/web-performance-benchmark/amp/
- How to Optimize WordPress site for Speed: https://wpspeedmatters.com
Scenario 1: Disabling Caching altogether
For this test, I disabled caching for this website, which includes:
-Disabling the Fast Velocity Minify plugin
-Disabling Nginx and Redis Cache
-I also flushed the tntire cache for the website
The result was along expected lines: a slow, rather super slow, website.
As a test case, I also checked for speed from Sydney, which would be the farthest distance from the server location in Germany.
Scenario 2: Enabling Caching
For this scenario, I turned on Gridpane Redis Caching, as well as Nginx Caching. And Fastvelocity Minify with default settings. There was some improvement in performance, as the results from London show. Location of course plays an important role.
We’re getting there in terms of optimizing the website and improving the speed performance for this wordpress site
The Quest to get Straight A’s
After doing a bunch of optimizations that an everyday user could digest (by turning on or off the settings that made sense, or could be googled up easily), things were looking okay. When…something broke, and broke horribly. I had to retrace my steps to un do the damage.
Rebooting the optimization process
After much experimentation, we have reached an intermediate milestone.
Conclusion: Optimizing wordpress site for speed and performance
Optimizing your wordpress site for speed is an art and a science. Too much of optimization can break the site and lead to some un intended (and un desirable) results. If you know what you are doing, you can experiment with the settings. If not, best to talk to someone who knows their stuff, and work with them to get your site optimized for speed.