Why Is My WordPress Performance Tanking?

by Derick Schaefer on July 5, 2010

If you haven’t experienced your WordPress blog’s performance tanking, you will at some point.  More frustrating than the actual  blog performance issues are all of the dead ends you will encounter when looking for a solution.  After months of having WordPress blogs crash during big traffic spikes, I finally rolled up my sleeves and came up with a rock solid server configuration for WordPress.  The best part is that it is based on a virtual server and is affordable by just about any blogger.  This week I am going to dedicate a series of posts to WordPress performance and then give away my secret as to the configuration of the ultimate, affordable WordPress host.  I’ll start off by helping you understand why WordPress performance tanks.

Why WordPress Performance Quickly Tanks

WordPress is a powerful blogging platform in that it allows bloggers to quickly deploy their blog in a highly expandable and customizable fashion.  Unfortunately, with this ease of deployment and customization, comes design considerations that do not scale well.  This is magnified by hosting platforms that are designed for minimizing monthly costs and support calls.  In the end, as a blogger, you are left with a software application that does not do well under pressure.  Without going into to much detail, I’ll rattle off a couple of the major pain points.

Database Calls

WordPress calls its MySQL database for everything!  Therefore, each page that gets rendered causes WordPress to make multiple calls to its database.  Though modern day connectivity speeds and high performance disk drives minimize the impact of database calls, the one thing that cannot be avoided is the memory associated with database connections and the overall complexity of performing database calls.  Logically, I’ll walk you through the simple database call in your template that puts the name of your blog on your posts and pages every time someone accesses your blog.  It goes like this:

  1. Open a database connection
  2. Check credentials
  3. Issue a call that might join a few tables
  4. Get the record back
  5. Parse the information
  6. Put less than 30 characters of text on one single element of your page.

This can happen multiple times on a single page and is quite a workout for your web server when you get a spike in traffic.

Web Server Connection Semantics

Most WordPress hosting is based on the Linux operating system and uses Apache as a web server.  Apache is a very sophisticated web server capable of servicing all of the needs of WordPress.  With this sophistication comes the need for resources.  Every user that connects to your server will be requesting multiple elements of your blog including images, scripts, style sheets, and html.  Just like a switchboard operator, your web server can become overwhelmed by too many incoming calls.  This is compounded by the fact that multiple elements on a blog post can end up requiring multiple web server calls.

A second challenge is that Internet communications are chatty.  Just typing in the domain of a blog into your browser requires a three way handshake on the network, a lookup of the domain name, and a first connection to be established.  Remember the children’s book “Go Dog, Go” and the repeated scene where the female dog asks, “Do you like my hat?” and the male dog replies, “No, I do not!” and then end with an exchange of “Good-bye” . . . “Good-bye”.  Yes, browsers and web servers go through this nonsense all the time and it can result in performance issues when thousands of users are visiting a blog during a traffic spike.

Shared Hosting

WordPress Hosting Most hosting marketed as “WordPress hosting” is shared hosting.  Shared hosting houses multiple websites on one server.  The result is that your blog gets to compete for resources with other blogs on that server.  (For more information on WordPress hosting options, see a post I dedicated to WordPress hosting options.)  The most important aspect of shared hosting is that Apache, the web server, requires memory for every connection and it can get out of hand very quickly as the visitors of multiple blogs connect with the server.

Summary

If your WordPress performance is tanking, there are affordable answers.  The first thing we have to do, however, is define some traffic levels and scenarios.  Why?  Basically, if your blog is tanking because you have 20 users online at one time, the solution is completely different from the blogger who has 1,000+ users online.  In my next post, I’ll talk a little bit about traffic and share a couple of plugins you can use to keep an eye on this.

Leave a Comment

Previous post:

Next post: