Subscribe News Feed Subscribe Comments

5 Golden Tips For WordPress Performance Optimization / Slashdot-Digg Protection

WordPress is a popular blogging software. As a design decision it stores the blog content in database and uses php to fetch and display the pages. This consumes more resources (cpu and memory) than blogging softwares generating static pages. Here are 5 tried and tested power tips to reduce memory & cpu resources and speed up your wordpress based sites.

Speed up PHP code execution.
There are several php code accelerators available. I recommend eAccelerator based on performance and stability. Use it with at least 128MB RAM ( eaccelerator.shm_size = “128″ ). You will observe significant performance benefit from this. Note the average cpu utilization before and after.

Optimize MySQL server installation
MySQL on Linux get installed by default with minimal configuration which is suitable for low end machine. It doesn't make use of the memory of your system you may have. There are several online guide to configure mysql for better memory utilization and overall optimum performance. I used the following settings:
key_buffer = 256M
max_allowed_packet = 1M
table_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M

Read the fine manual for explanations on each of these settings :)

You may also want to enable slow query log and identify the slow queries. Progressively reduce the time as you better optimize the queries.

Slim & trim WordPress.
WordPress is supported by tons of free and paid plugins. However many of them are not optimized. The slow query log step above should help you to identify the slow queries. Search the plugin source code to identify the plugins responsible. Work, politely, with the authors to resolve the issue. If that doesn't work, look for alternatives or disable the plugin. Plugins should be used in moderation. Prefer plugins for functionality rather than cool / wow factor. Many plugins imposes a significant cost in terms of resource and performance.

Staticize your pages.
wp-cache 2 is a WordPress plugin which will cache your page output in a file (download). For future requests of the same page it serves the content directly from the file thereby bypassing the need for database queires and further php code execution. It recognizes when any page content has changed. Unfortunately it then invalidates the whole cache instead of the page itself and other pages which are likely to change.

It will also invalidate the whole cache it a comment is added to any post. This is a problem for highly commented blogs. I had posted a solution to this problem: How To Improve Performance of Highly Commented WordPress Blogs.

At some point you still will have to move to a better server - from shared hosting to VPS (virtual private server) and then from VPS to dedicated server(s). And then you may have to use a caching reverse proxy server for load balancing between multiple apache servers. Trust me you will want to face this type of challenges for now in you are in the big league :)

Custom WordPress Installation


by Teli Adlam

I install WordPress a lot. Unfortunately, there are some things that I don’t care for with the current WordPress default installation files.

When you’re doing one or two installations every so often, it’s no big, but for me it saves more time to tweak the installation files once so that I don’t need to worry about tweaking it on the backend later.

What are these tweaks?

  • Custom admin username, admin display name, blog description, default category, and blog URL (I have a tendency of installing the WordPress files in their own directory separate from the blog’s home page)
  • I’ve never been a huge fan of the phone home feature, so I’ve removed the blog address when checking for updates
  • Although security by obscurity isn’t the greatest security defense, I still don’t feel comfortable advertising my blogging software and version, hence the WP generators have been removed from the head/RSS meta completely
  • The default links and post/page/comment have been omitted because, frankly, I get tired of manually deleting them from every new installation
  • Since the autosave/revision feature is overkill and DB bloat in most of my cases, I’ve added a line to the wp-config-sample.php file to disable it by default (of course, this only applies to installations that don’t already have an existing wp-config.php file handy)

Custom WP Installation Screen

Normally I don’t release these tweaks since they’re for my own personal use, but this time around, I figured why not?

Before downloading and using these WordPress files, please make sure you’re alright with the above—if not, don’t use them. Also, these files come with no warranties or guarantees—i.e. use at your own risk. If your server blows up or catches fire (highly unlikely), you’re on your own. :)

Without further ado, here you go: WordPress 2.8 Custom

Also, when you’re done with the installation it’s important that you delete or rename your install.php and upgrade.php files.

Quick Blog Tip: Separating Comments and Trackbacks


by Teli Adlam

Do your trackbacks display before your comments?

Since learning that comments can be separated from pingbacks/trackbacks, many bloggers have adopted the format. However, there are some blogs which put the pingbacks/trackbacks before the comments and if you run a popular blog, this can be a pain for your readers who wish to leave their own thoughts.

Pingbacks and trackbacks reference your idea elsewhere, however, comments continue the conversation directly on your site, therefore they should receive priority. Don’t make your readers scroll for eons just to see that conversation.

Take a moment to make the switch if you find that your pingbacks/trackbacks are being displayed before your comments.

 
TNB