Most of the time, we all talk about increasing readership, this time why not we will go for performance enhancement. Few days ago, one of my subscribers expressed that, he experienced sluggishness on the back end while using WordPress as a CMS with high number of pages. He isn’t the only person who came across this problem, a lot of WP users experience related problem generally. Question is, whether these problems resides in the core of WP or occasionally forced by some other issues?
Actually there is no simple answer for that, any CMS whether Drupal or WordPress can experience same issues caused by numerous reasons without anything to do with the core itself. I will keep the focus of the discussion on the WordPress (self hosted) related issues to narrow it down. Why not we turn the spotlight on the fundamental reasons first, so that it would be easier to eliminate them?
Your WP (WordPress) powered site may experience sluggishness because of:
• MySQL server or connection issues.
• PHP Memory Limit.
• Apache log rotator problem (for Apache server).
• Broken/Degraded PHP code in template/theme files.
• Excessive plugin uses — use of plugin(s) with broken codes.
• WordPress Dashboard’s display of RSS feeds.
• Pingback attempts when posting.
There are many other reasons which might trigger sluggishness, but one way or another related to above mentioned cause. Now that we know what makes our WP site slow down (Back end or front end), let’s turn our focus on how to avoid these.
MySQL server or connection issues
Actually very little you can do about this, since your host can only resolve this. Most of the case, this is a temporary issue when your host is having an upgrade or downtime. Too many connections to your DBhost can also trigger sluggishness. Your WP back end can also slow down when MySQL Database being unable to keep up with the query demands.
Solution: Contact with your server host if they are having an upgrade or downtime. Make sure your WP database isn’t shared with your other sites. Check with your hosting company regarding your DB statistics, if needed, do an upgrade or change host. No use of sticking to a host just because they are nice but can’t meet your technical demand.
PHP Memory Limit
Heartbeat of WP is PHP, so obviously when something wrong with that, you will have issues. By default, PHP is a beast with all kinds of nasty modules it thinks it needs to load. So the more it’s loading, the more memory you need. Why not control what to load? Disable as many extensions as you aren’t using to save memory.
Solution: Optimize your PHP configuration, avoid loading unused modules.
Apache log rotator problem (for Apache server)
This crap happens when your site is hosted on Apache server. For some reason when a log rotator script gets broken, your server log files start to grow huge in size. So in the end, your server has to deal with hundreds of Megabytes excess log files that slowed it down to the point of instability.
Solution: Easiest way to resolve is contact your server’s technical support. You may also check and make sure the files/directory of log files should be only server write-able.
Broken/Degraded PHP code in template/theme files
This thing happens a lot, in fact, a lot of WP users experience sluggishness for this reason when their site gets bigger. You will come across hundreds of beautiful, stunning looking WordPress themes across the web, but how will you know the PHP codes are optimized in the back end? WordPress has some basic guidelines/requirements for theme submission, but PHP code check isn’t one of them (Checking each themes code isn’t practical either). But from the user’s perspective, you need to make sure your theme’s codes are optimized, as that is the framework of your whole site.
Solution: First, use wp-cache plugin (included with latest WP version installation pack). It’s the classic caching solution. It also knows how to update itself when comments are received, etc, so your site is always the most up to date and requires less load time. Second (optional), why recompile scripts every time, when you can save the bytecode? There is an extension called eAccelerator, uses a bit of disk space and also optimizes the opcodes and saves you from having to recompile a script every time. It can shave up to 5000ms off your loading time, depend on the php code. Third, switch your theme to some standard theme (for example-WordPress default theme) with all the plugins active and test the performances. If the performance remains sluggish, your problem isn’t in theme/template codes.
Excessive plugin uses/ use of plugin(s) with broken codes
This is the second most probable cause for WP to slow down. Just like above problem, this is also caused by broken PHP code or degraded MySQL queries, but in this case within plugin files.
Solution: Don’t use plugins when you can do it easily without the use of plugins. Activate only the plugins you really using, or best remove the non active plugins. Now deactivate all plugins and clear your browser’s cache. Activate one plugin and clear the cache again and check the performance, lastly, clear cache again. Repeat the process until you experience slowness or finish activating all required plugins. There are ways to identify slow/degraded MySQL queries, which I will discuss in the next blog tip.
For some reason, this is a random problem, means different people experience sluggishness with different types of third party scripts or widgets. So why am I saying the reasons of problem is those codes, where it’s random? Since most of the cases, the problem resolves when those scripts or widgets get removed — they must be the cause.
WordPress Dashboard’s display of RSS feeds
If you find that editing posts/templates or logging into WordPress takes a long time, the culprit is probably the WP dashboard. This is the “home” of the administration section, displays links to your latest posts, upcoming posts, comments, and incoming links. Unfortunately, it also displays a number of RSS feeds related to WordPress. While this sounds like a good idea, it often takes 30 seconds or longer to load the page because of delays fetching the RSS files, and they rarely have anything new and relevant. Two ways you can avoid that:
Avoid loading the Dashboard page (index.php) at all. Instead of using the “Login” link in the sidebar, you may use link that goes straight to /wp-admin/post.php. This brings you straight to the posting interface, which loads instantly, and you can use the links to reach other parts of the console, including the Dashboard if you need it.
If you still want to use the standard login feature, install Angsuman’s Dashboard hack, which replaces the RSS section of the dashboard with more useful links within your site.
Pingback attempts when posting
This is a random cause of your slow WP posting interface, especially the editing part. While the actual posting process is instantaneous, the delay is caused by two parts of network activity:
WordPress attempts to use Pingback to notify every URL you’ve linked to. If you find yourself linking to WordPress blogs often, this is actually a useful feature — otherwise, it’s a waste of time. In my experience, attempts to Pingback non-blog sites are the cause of most of this delay.
WordPress uses Ping-o-matic to notify search engines of your post. This is a very good thing, but occasionally causes delays. Rarely, Ping-o-matic causes a delay when posting. To eliminate this, you can remove rpc.pingomatic.com from the list of Update Services in Options | Writing. You can even use other ping server instead of pingomatic.
As you can see, most of the cases of slowing down WP site aren’t WP related at all. A little bit of workaround and tricks can be just enough to avoid these.