One of the biggest nightmares for a WordPress website owner is having a slow website. But, how do you diagnose a slow website? If you’re experiencing problems with your website, there may be one or several causes. Don’t stress anymore because we’re here to help.
We’ll look at how to identify inefficiencies on your WordPress site and how to fix them.
Let’s dive in.
Find Inefficient Database Queries and Plugins With New Relic
There are a few excellent tools available that can assist you in pinpointing and identifying time-consuming database queries and plugins. One of these tools is New Relic, a PHP monitoring tool that can provide extensive performance statistics for your WordPress site.
Identifying Inefficient Plugins
The indications of a WordPress plugin causing overall lagging vary depending on the plugin’s activities. A slow plugin, on the other hand, will often impact all pages of a WordPress site.
When you encounter a plugin that is slow to respond when tested with New Relic, it’s easy to dismiss it as poorly designed or inefficient. However, this is not always true. A plugin can take a long time to load due to configuration errors, database latency, or remote assets with slow response times.
So, if a plugin is taking a long time to respond, it’s wise to look at a few more screens in New Relic for more information. Double-check your activities, databases, and remote assets before concluding that disabling the plugin is the ideal or only option.
General Lagging Due to Database Issues
A WordPress site can be slowed down by a database that isn’t well optimized. We discussed a variety of options for resolving this earlier. This database-related slowdown will most likely appear in two areas of New Relic:
- In the overview, you’ll notice an unusually high level of MySQL activity.
- In the databases section, you’ll notice that one or more database tables are taking up a lot of time. The databases section will show you which table and query type is taking the longest. If you click one of the items in the list, you’ll be able to view further information, along with some sample queries.
Use the Free Query Monitor Plugin
Query Monitor, a free WordPress plugin, is another option. You can use it to track down and troubleshoot sluggish database queries, REST API requests, and AJAX calls, among others. Furthermore, the plugin provides data regarding your website. This includes script dependents and dependencies, WordPress hooks that were fired during page generation, conditional query tags fulfilled by the current page, hosting environment information, and much more.
John Blackbourn, a key member of the WordPress community and a developer at Human Made after formerly working at WordPress.com VIP, is the man behind the plugin. Meaning, the plugin was developed by someone well-versed in the WordPress platform.
Query Monitor was first launched in the WordPress plugin directory in 2013, and it now has over 70,000 active installs — a significant number for a development plugin. The plugin’s five-star user rating explains its appeal among developers.
Use Staging Environments Without Interfering With Production
When it comes to diagnosing performance problems, staging sites can be extremely useful. If your WordPress hosting provider doesn’t offer staging environments, you can utilize WP Staging; however, it’s not as simple.
The first thing you should do when setting up a staging environment is deactivating all your plugins. You don’t have to worry about disrupting anything because this is a replica of your live site. It’s by far the simplest method for identifying problems. Just navigate to Plugins, pick all of them, and use the bulk options to deactivate them.
After that, use Query Monitor or New Relic to track response times and observe what changes. Then, one by one, reactivate them, repeating the procedure until you identify the offender.
Here’s what we recommend once you’ve identified the plugin that’s slowing down your site:
- Make sure your themes and plugins are up to date.
- Contact the plugin or theme’s developer and request assistance.
- Find a different plugin that can perform the same function.
- The problem may be caused by your PHP version. Switch to a lower version for your PHP engine and check whether the plugin or theme works after that.
- You can also contact a WordPress developer to help you resolve the problem.
Examine Your Error Logs
Examining error logs for WordPress plugins can speak volumes about their performance.
By editing your wp-config.php file, you can activate error logs. To begin, you’ll need to establish an SFTP connection to your site. Then you can edit your wp-config.php file after downloading it. Always remember to back up this file first!
Look for the line that goes: “ /* That’s all, stop editing! Happy blogging. */ ” and add the following code: define( ‘WP_DEBUG’, true );
If the preceding code is set to “false” in your wp-config.php file, switch it to “true.” As a result, debug mode will now be enabled. If there are any warnings or errors, you’ll notice them in your WordPress admin dashboard.
Then, just after the WP DEBUG line, add the following code to let the debug log report all errors to a file: define( ‘WP_DEBUG_LOG’, true );
Re-upload to your server after saving the changes. The errors will be recorded in your /wp-content/ folder’s debug.log file. If you can’t find this file for some reason, you can always make one.
Problems May Be Caused By Hacking
Your site may have been hacked, affected by malware, or is experiencing a DDoS attack if you’re having problems trying to trace a performance problem. This can slow down your site and make your WordPress admin dashboard less responsive. In these situations, we suggest the following:
- Use a proxy server and a web application firewall (WAF) like Cloudflare or Sucuri to block problematic IP addresses.
- Geo-blocking is another option. In terms of the nature of the traffic they create, some countries are truly terrible. If you’re being attacked, you may need to temporarily or permanently block the entire country.
Error Code Troubleshooting (HTTP Status Codes)
HTTP status codes function as a brief message from the web server that appears at the top of a web page. It isn’t a component of the website. Instead, it’s a notification from the server informing you how things were going when the server received your request to access the page. When troubleshooting your WordPress site, these can be helpful!
While there are more than 40 different status codes, the ones listed here are the most typical ones that WordPress users encounter.
- 429: “Too many requests.” When a user sends too many queries in a short period, the server generates this error. This can happen when bots or scripts try to access your website. In this instance, altering your WordPress login URL can be a good idea.
- 500: “There was an error on the server, and the request could not be completed.” This is a generic code indicating that an internal server error has occurred. The requested content could not be delivered due to a server malfunction. Third-party plugins, incorrect PHP, or even a broken database connection are likely causes of this code.
- 502: “Bad Gateway.” This error code typically indicates that the server received an invalid response from the upstream server while functioning as a gateway or proxy. When a request or query takes too long to complete, the server cancels or kills it, and the database connection is lost.
- 503: “The server is unavailable to handle this request right now.” The request can’t be fulfilled at this time. An overburdened server that can’t handle any more requests may return this code.
- 504: “The server, acting as a gateway, timed out waiting for another server to respond.” This code is returned when two servers are engaged in handling a request, with the first server timing out while waiting for the second server to respond.
Experiencing website bottlenecks and not having a solution is very stressful. With this guide, you can now identify and troubleshoot the various problems. Do you need professional help with your WordPress website? We are just call away. Contact us today and share your proposal with us.