Speed up a Wordpress Site
Posted 04th октомври, 2018
Wordpress sites can be lightweight and efficient. However, they can also become sluggish, have errors that cause timeouts, and have seemingly undiagnosable problems disrupting loading. It may be that the site simply requires optimisation, or there might be an bug that needs fixing.
Our Fixed.net team can analyse your website and diagnose the causes of slow loading, then optimise your site for optimum speed.
This is a comprehensive guide to Wordpress site speed and performance. It overviews expected response times, variation between providers, then looks at diagnosing speed issues, before examining fixes and optimisations that can be made.
Content
- Diagnosis
- What slows down Wordpress
- Worst offenders
- Trace Processes
- Database queries
- Speed Optimisation
- Caching
- Image Optimisation
- Dynamic Content
- Compression and Browser Caching
- Update Plugins and Themes
- Database Maintenance
- Advanced
- Use a CDN
- Choosing a host
- Other
- Optimise Homepage
- Choose a good theme
The response time of your website can be established by adding it as a website in Fixed.net (no charge). Even the most complex of Wordpress sites should be loading in well under 2 seconds. Anything over 1.5 seconds indicates that there might be a bug with the Wordpress install, or a hosting provider service issue.
Diagnosing Slow Loading
An underperforming Wordpress site may manifest itself in one or more of the following ways:
- Slow loading, where a site loads but takes a substantial period, either some or all of the time.
- Partial normal loading, followed by continuous loading, usually of a third party plugin. This is often where an external call is required to request a third party feature or api-call.
- Timeouts.
- Occasional server errors
Some of these are a result of errors which need to be fixed. However, most are a case of optimisation being required, or basic steps taken to speed up a site.
What slows down Wordpress
All of the above are caused by one of the following:
- Too many plugins
- Out of date plugins or themes
- Images too large and unoptimised
- An external call
- Large files
- Broken javascript
- A redirect loop
- PHP Errors
- A hacked site
- Failed database connections
- Broken caching
Trace Processes
The best way to work out what is slowing down a Wordpress site is to trace the actual process. You can see exactly what the server is doing when the page hangs.
This is done on a server level which means you may not be able to access it. If you do, you can run
strace php index.php
This will output you the server logs of the Wordpress site. Errors are often printed out in the screen.
Example Database Queries
A site load may be hanging on a database query. This can happen if a column is not indexed, or if your database server is overloaded.
Speed Optimisation
Caching
WP Super Cache is a static caching plugin for WordPress. It generates HTML files that are served directly by Apache without processing comparatively heavy PHP scripts. This plugin will speed up your site significantly.
Image Optimisation
Optimise Images - The WP Smush.it plugin strips meta data from JPEGs, optimises JPEG compression, converts certain GIFs to indexed PNGs and strips the unused colours from indexed images . You could also download ImageOptim from imageoptim.com, this software optimises images by finding best compressions parameters and by removing unnecessary comments and color profiles. It handles PNG, JPEG and GIF animations.
Cut down dynamic content
Dynamic content has a big impact on site speed, so remove any unnecessary dynamic content from your site.
Compression and browser caching
Gzip compression works by finding similar strings within a text file, and replacing those strings temporarily to make the overall file size smaller. You can add the following to the .htaccess file to enable Gzip compression;
AddOutputFilterByType
DEFLATE
text/text
text/html
text/plain
text/xml
text/css
application/x-javascript
application/javascript
text/javascript
Install Updates
Software, plugin and theme updates come with bug patches and enhancements, make sure you install any updates right away.
Maintain the Database
The WP-DB Manager plugin allows you to optimise and repair your database. You can also backup the database, restore the database, delete a backed up database, drop tables and run selected queries. - The WP Optimise plugin allows you to optimise and clean up your database.
Advanced
Use a CDN
A CDN is a Content Delivery Network, this reduces hops and lowers latency. Some recommended CDNs are CloudFlare and MaxCDN.
Move hosts
When using a shared hosting service it is very evident when the issue comes from the hosting. Sometimes a shared server could be overcrowded which would cause a slow down on all sites on the platform. There could however be other reasons concerning the server that could cause a slow down of your website.
Using different speed testers you can can determine if the wait time for your website is due to a slow loading host indeed. If that is the case you might need to move to a different host. To be able to do that check our migrate your website guide.
Optimise individual pages
There really isn't a way to optimize the speed of each page directly, however the following good practices will be able to keep your pages from being to large and slow to load:
Split comments to pages - breaking the comments in pages when there are too many of them - is always a good idea. To do that navigate to Settings >> Discussions and enable the option Break comments into pages with 10/20/50 comments per page
Remove unused media - do not overflow your page with hundreds of images and videos and large files that would just add up on the load time of the page.
Do not upload video - If you wish to add video to your website - that is perfectly fine, but do not upload it directly, instead embed the video for much better results.
Use optimized images - you can do that with different plugins or from your image editing software by choice, but do not upload images with 300dpi and huge resolutions as they will take a long time to load.
Reduce the number of posts per page - this is especially useful on blog pages.
Choose better plugins/themes
Sometimes the reason for a slow down could be a faulty or bad written plugin or theme. When doing speed tests you could easily navigate to the elements of a theme/plugin that are slower to load.
In order to prevent this from occurring it is important to choose wisely when it comes to your themes and plugins - install only plugins and themes with good reviews and high ratings. You can always do a research of a theme for any known issues as well before installation.