WordPress Optimization Tips


January 19th, 2012   

Any dynamic CMS application like WordPress can be a bear to maintain, and strain your server hardware. WordPress, and it’s many plugins available, can make your website slow down to a crawl. Fortunately we have years of experience with WordPress and high volume traffic. We have some great tips to help optimize your WordPress. A slow loading web site blog can not only mean an increase in bounced visitors to your site, but can also mean a decreased ranking with Google. So it’s critical you make sure your site loads fast.

Here are some recommendations to help optimize your WordPress for search engine optimization (SEO) but also for speed. Unfortunately, some of these options are only available when you go with a managed VPS, and not available in a shared hosting environment.

Replace Apache With LiteSpeed

We always recommend replacing Apache with another web server. Apache is great for compatibility, but the worst with web site performance. Dynamic applications like PHP based apps, don’t scale well with a high volume of traffic, and isn’t efficient with memory usage. We recommend using LiteSpeed because of it’s compatibility with Apache configuration files, it’s support of mod_rewrite entries, security and it’s performance with PHP.

LiteSpeed offers the performance of mod_php, but the security when using suPHP. Unlike a mod_php setup, the LiteSpeed web server runs PHP as your user/group. No more having to worry about the proper permissions for folder when uploading content through WordPress.

The added benefit when using LiteSpeed is compatibility with Apache configuration files. This means control panels like DirectAdmin are fully compatible with Apache, and we typically recommend this configuration. Yes LiteSpeed is a commercial application, but the cost is minimal and well worth the monthly fee.

Limit The Amount Of WordPress Plugins

Without knowing the plugins you use for your WordPress blog, it always makes sense to limit the amount of plugins you use. Unfortunately, not all plugins are created equal. Some plugins are complete resource hogs. Some plugins are coded poorly, and can affect the load time of every web page. Others insert unneeded HTML code on every web page, when only used on one page. If unsure, remove each plugin one by one and use a tool like Google Chrome Developer Tools to monitor the load time of your web pages.

Install a PHP Accelerator

PHP out of the box scales just ok. PHP is an interpreted language. Code written in PHP is converted into machine readable code (bytecode) and served through your web server. This process is time consuming, and adds overhead when every web page is loaded. It also makes your web site much more CPU bound, since PHP must compile the code every time.

Fortunately there is a solution to this issue. Install an opcode cache for PHP. There are many PHP accelerators available such as: eAcceleator, ionCube PHP Accelerator, XCache, and Zend Optimizer.

From our experience with compatibility, we recommend the PECL package APC. PHP accelerators are not perfect, and sometimes can cause issues with the created PHP code. From our experience APC seems to be the most reliable, but unfortunately isn’t the fastest. In tandem with a PHP accelerator, we also recommend installing a cache engine plugin within WordPress.

Use a Cache Engine

As mentioned previously, every web page with WordPress is generated dynamically with PHP scripts. This can slow down your web page generation time. We recommend not only using APC, but then adding a caching engine within WordPress. The two recommended WordPress plugins are:

Each plugin has it’s advantages and disadvantages and should choose the one based upon your situation. We typically recommend using WP Super Cache first.

WP Super Cache
WP Super Cache converts your entire blog into static HTML. Static HTML always loads faster than dynamically generated PHP code, and can handle a much higher amount of web site hits per second. This plugin is perfect if all of your content is static and you do not have any dynamically generated content that changes often on a web page (ie stock quotes).

W3 Total Cache
Some plugins do not work with WP Super Cache. If this is your situation, we then recommend using W3 Total Cache. Unlike WP Super Cache which converts all of your WordPress blog into static content, W3 Total Cache uses various methods to cache code within PHP. This allows for better flexibility with the choice of plugins you use, but from our tests runs slightly slower then WP Super Cache. W3 Total Cache can be complicated to setup, but has many more options, is much more flexible, and can work with memcached.

Use the Genesis Framework

We recommend not using the default themes, or the many freely available themes for WordPress. Many WordPress themes are junk, or have hidden URLs that help the developer’s SEO. It is possible to hire a web developer to create a custom theme for your WordPress blog, but this can be time-consuming and costly.

A much cheaper alternative we recommend is the Genesis WordPress Framework by StudioPress. It’s a great WordPress theme to base your site on.

Fortunately if you aren’t a web designer, Genesis offers many child themes you can get your web site up and running in no time. Genesis not only allows for you to create quickly a professionally looking web site, but is optimized for SEO and quick loading. We recommend StudioPress Genesis Framework to all our customers.

MySQL Optimization

The SQL database MySQL is an integral part of WordPress. Since every page generated is stored within MySQL, it’s critical MySQL is optimized.

Depending upon the amount of memory available with your instance, and the size of your database it’s critical it’s all in memory and not using swap space. Using your instance disk swap tends to degrade performance very quickly. Therefore the configuration settings for your MySQL can be very dependent upon the amount of postings you have on your blog. Below is a general recommendation, but is not comprensive.

Recommended my.cnf

[mysqld]
local-infile=0
query_cache_size=84M
tmp_table_size=84M
max_heap_table_size=64M
thread_cache_size=4
table_cache=164

By default WordPress installs the database tables as MyISAM storage type. While this is ok for a small web site, this can cause problems with a site that has many reads and writes to it’s database tables. The MyISAM format performs table locking when updates to the table occur. This means if another process needs to write to the same database table, it must wait until the other process completes. This can cause delays in web page generation. MyISAM is really just a glorified flat file database format. Read for fast reads, but poor with most other database operations.

The table format InnoDB on the other hand supports row locking, which means multiple reads and writes can use the same table concurrently. This prevents delay in page generation. Not every table within WordPress must be converted though. Some tables can perform better with MyISAM since they are mainly read only.

From our experience, tables wp_options and wp_comments should be converted to InnoDB.

Use a CDN

Your web server is busy generating web pages. From your blog it also has to serve videos, images, stylesheets, Javascript, and other various static content. This increases the contention for your web server.

If you have a web site visitor coming from California, but your server is located in New York, their request must travel across the country. Latency, or the time it takes to across the country, is at minimum 100ms. Add this delay for the many requests needed to generate a complete web page, it can add easly 2-3 seconds to the load time of your web site.

Using a Content Delivery Network, or CDN, is the best option to speed up your static content. CDNs have multiple locations around the world to store your content. By pushing your content to a CDN, the web site visitor will get access to your content from the nearest location to them. This means decreased time to load your static content. The added benefit is your web server, which is now just focused on generating dynamic web pages, no longer has the additional strain of serving static files.

We recommend using Amazon’s Cloudfront service, but there are many other CDN providers available.

Pick An Outstanding Hosting Provider

The last item, but definitely not least option affecting the performance of your WordPress blog, is your choice of hosting provider. If using shared hosting, many of the options mentioned above are limited by the expertise and flexibility of your hosting provider. Some may have options to help with the performance of your blog, but most need to optimize for all their customers in a cookie cutter fashion.

Unfortunately it is also the dirty little secret many overload their shared hosting servers to ensure a profit. Services that are unlimited does not exist in the real world. They must limit something, even though they are offering “unlimited” disk space and bandwidth. Usually with dynamically generated web sites like WordPress blogs, the limiting factor is the amount of CPU power available. This means your site loads slowly, and is the primary factor to your site’s lag. In some cases the hosting provider will suspend your account because the amount of CPU used by your web site. If your web site is another other than a personal blog, you need to migrate to a VPS.

Virtual Private Servers (VPS) act just like a real server – you have your own dedicated CPU, memory, and disk space. Though compared to a dedicated server, a VPS is at the fraction of the cost.

Unfortunately many VPSes are unmanaged. This means you are responsible for everything: backups, security, software updates, and monitoring. Many people don’t have the time, or expertise to manage their own server.

For a little promotion of our services, HostCube offers a managed VPS or managed cloud services. We work within our own cloud, or with third party cloud providers like Amazon’s EC2.

Everything is done for you, and is no different than a shared hosting account. It service is still a black box to you, and you just have to focus on your blog.

The amount of time saved by hiring an hosting firm who’s an expert in optimizing WordPress is well worth the cost. While we have our hosting services, we also do consulting for customers who need help with their existing WordPress setup.

Comments

  1. BizSugar.com Says:

    WordPress Optimization Tips – The HostCube Blog…

    Some great tips on making your wordpress site both faster and more efficient. Very important if you want readers to stay and interact….

  2. nancy zidonis Says:

    Great info – thanks,

  3. Create Your Own Roadmap with Your Small Business Says:

    […] Optimize your WordPress business blog. Do you use WordPress for your business blog? Odds are you do. The platform is very popular with business and other bloggers alike. But how do you or your Web developer make sure you are getting all you can out of the platform? HostCube […]

  4. Create Your Own Roadmap with Your Small Business | NSD Newsletter Says:

    […] Optimize your WordPress business blog. Do you use WordPress for your business blog? Odds are you do. The platform is very popular with business and other bloggers alike. But how do you or your Web developer make sure you are getting all you can out of the platform? HostCube […]

  5. Nancy E. Wigal Says:

    I particularly like that you mention Genesis. It helps with SEO, as does the all in one SEO pack.

    And you are spot on about web hosting. I can’t tell you how many of my students and clients use cheap, cheap, cheap hosting and wonder why their site suffers so much.

    Plus, at least one well known web hosting offerer won’t turn on your website stats unless you manually request it, and too many first timers don’t know that they need to do this, so when they come to me for SEO help, it’s very hard to gauge what their site has done if the analytics were never turned on.

    Great post!

  6. Create Your Own Roadmap with Your Small Business | Leomoo.com Says:

    […] Optimize your WordPress business blog. Do you use WordPress for your business blog? Odds are you do. The platform is very popular with business and other bloggers alike. But how do you or your Web developer make sure you are getting all you can out of the platform? HostCube […]

  7. Create Your Own Roadmap with Your Small Business | Free Web Design Tucson Says:

    […] Optimize your WordPress business blog. Do you use WordPress for your business blog? Odds are you do. The platform is very popular with business and other bloggers alike. But how do you or your Web developer make sure you are getting all you can out of the platform? HostCube […]

  8. Small Business Blueprint for Success | MoreCustomersOnline.com | Mobile Marketing & Online Customer Getting Solutions Says:

    […] Optimize your WordPress business blog. Do you use WordPress for your business blog? Odds are you do. The platform is very popular with business and other bloggers alike. But how do you or your Web developer make sure you are getting all you can out of the platform? HostCube […]

  9. Create Your Own Roadmap with Your Small Business | Start Fund NL Says:

    […] Optimize your WordPress business blog. Do you use WordPress for your business blog? Odds are you do. The platform is very popular with business and other bloggers alike. But how do you or your Web developer make sure you are getting all you can out of the platform? HostCube […]

Leave a Reply

(required)
(will not be published) (required)