The keys to Making WordPress Fast
- Leverage page cache
- User object cache
- Reduce database bloat
- Keep WordPress clean
- Use good plugins
- Use a CDN (Content Delivery Network)
- Scalability is Key for making WordPress fast
In general, site performance can be broken down into two main segments:
- The amount of time it takes the server to generate the page
- The amount of time it takes the browser to download the page
In this blog post, we’ll be focusing on the things you can do to improve how quickly the server is able to generate the page to send to the web browser.
1. Leverage page cache
One of the main differences between HTML and PHP sites is that with HTML sites, the web browser simply has to request a static file to serve the page. With PHP (which WordPress uses), the page is dynamically built when it is requested by executing PHP code and database queries. While this means PHP-based sites are computationally more expensive on a server, it also means that the type of content your site can serve is more dynamic and personalized to your users. This is why many choose to use WordPress as a content management system (CMS).
Since it’s more taxing on your server to build a dynamic web page for each user that comes to your site, we highly recommend using a page cache system. This means each page that’s requested is stored as a static file in a caching layer on your site’s server, to serve to visitors for a specific period of time. This offloads much of the work the server has to do to generate your site’s pages when they are visited.
At Sunny HQ, we use page cache with a cache expiration time of ten minutes. This means that when a page is requested for the first time, it spends time generating the page with PHP and database queries and then stores a copy of that page in cache. For the next ten minutes, when that page is requested, it will be served from the cache layer instead of regenerating it again. After ten minutes, the cache is purged and the process starts over.
2. Use object cache
Aside from generating the page with PHP, your WordPress site also depends on a database to create pages and store information. When information is requested from the database, running those database queries can also take more time and power on the server’s end.
When you use a layer of the object cache, it allows you to store WordPress database query results in the server’s memory. So instead of running a new request for the same data to be processed by the database each time, WordPress is able to get this information from server memory.
Sunny HQ uses an object cache layer to store repeated query results. This makes your site SUPER FAST!
3. Reduce database bloat
To make WordPress Fast, keeping your database in tip-top shape should also be a priority for your site. The less database bloat you have, the faster your site can perform. This means cutting down on things like post revisions, orphaned post/postmeta and comment/commentmeta rows, as well as reducing autoloaded rows in wp_options.
In WordPress, the wp_options database table has a lot of your site’s configuration settings like: siteurl, active themes, active plugins, cron jobs, and more. These are important settings which probably should be set to automatically load on every page.
By default, most options stored in wp_options are set in the “autoload” column to “yes,” which means they have to load on every single requested page. However, plugins or themes may be adding rows and transients to your wp_options table, which may not be information that needs to load on every single page.
To make WordPress Fast, practice to periodically check through your wp_options table to see if there are any rows added by themes or plugins which might be very long, and may be causing a delay in site load time. Sound complicated? That’s why the Sunny HQ team does this everyday for our customers.
4. Keep WordPress clean
WordPress is a very versatile CMS, but sometimes customization can be very costly to the amount of time it takes to load your site. It’s best to keep configuration files, like the .htaccess file and wp-config.php files, close to their default state. These files have to be loaded on every page load too, so reducing things like rewrites and server directives in the .htaccess file, in particular, can be helpful.
Sunny HQ set redirects and rewrites in our Admin Portal. Redirects set here will be executed before the request is sent to be processed by PHP. This translates to less heavy lifting for the server to redirect the request.
5. Use good plugins
Since WordPress is open source, there are thousands of plugin and theme options to choose from when it comes to your site. When you’re deciding on which plugin to use for a site function, check out the plugin’s page and see how often it’s updated, and how often support threads are resolved. To make WordPress fast always use quality plugins.
If updates are fairly frequent and the authors still seem engaged in support threads, this is a good indication that this plugin is being actively maintained. This is good because more updates often mean more optimizations to the way the plugin functions. It also means the authors are more likely to help patch any security vulnerabilities the plugin may encounter.
Using relevant plugins also means to cut down on the plugins your site doesn’t need or use. If a plugin is inactive and you don’t know when you would use it again, it’s best to delete it entirely.
6. Use a CDN (Content Delivery Network)
CDN technology is offered at Sunny HQ, is built in without using a plugin to rewrite your site’s source code. This makes your site SUPER FAST!
There are also CDN options to make WordPress Fast which involve routing your site through a reverse proxy and leveraging caching at this level. Offloading content through this type of CDN can be valuable for sites with extremely high levels of traffic. They allow for custom configuration of caching for pages and files as well if you want a more granular approach to caching. By using this kind of CDN, it helps offload a good portion of the server processing to cache it instead. We deploy Cloudflare as part of our standard service to all customers. Cloudflare is the icing on the cake, super securing and making it lightning fast.
7. Scalability is Key for making WordPress fast
It’s also important to keep your site as cacheable as possible. Limit the amount of PHP actions and queries being called on your site. This means, reducing actions that have to be repeated on every page load, like a page-view counter or a share counter. Instead, try using caching settings for these features to only refresh them every few minutes, or every hour.
If your blog has many older archives of articles, this could also mean something as simple as being crawled by Google could add up to server load time, because of the number of uncached pages being requested. You can try increasing your cache-expiration settings in your site’s .htaccess file, to help ensure that fewer old pages are going to the server uncached.