Can't find what you are looking for ?

Sunday, August 2, 2009

Optimizing your Wordpress account - 2

A few weeks back, I had written about how to take some basic steps towards optimizing your Wordpress account. Imagine what would happen if more people started promoting your Wordpress Blog, or wonders of wonders, it appears on the front page of Digg or Slashdot. In such cases, unless you have optimized your Wordpress configuration already, you can be pretty much sure that your account will get to a state where the server is not able to handle the load, and will shut down; further if your account is on a shared server, you might have some uncomfortable queries from your host.
So, here are some points on how to optimize your account:
1. Since Wordpress works on a database system, it pulls every bit of content from the server. If there are a large number of requests for your blog, your server has to make that many DB queries to fetch the content. This puts a lot of stress on your server. User a Super Cache plugin to Cache some of the load and serve static HTML files instead of querying the DB (link to plugin, and page).
2. When you serve various files such as binaries, videos, images, scripts, etc from your server, it becomes slow. Place them on other servers, so that the load on your server is reduced. For example, you can get videos from Youtube and Photos from Flickr, and also, you can even hire some hosting space on another server or on a service such as Amazon S3 for this purpose.
3. If you are more advanced, look at your server logs; it may be possible to determine multiple requests from a bot or script that is of no good, blocking these may make your server behave a bit better
4. Look to get stats on how your web page is loading. If it takes a lot of time to load your page, there may be a lot of plugins working, or scripts loading, and so on. Some tools you can use for this purpose are - LiveHTTPHeaders (link, displays the HTTP headers), Firebug (link, Look at loading times for various artifacts on a page),
5. Inside your wp-config.php file, remove some of the DB calls that are not necessary. For example, hard-code your Template Path, Stylesheet path (link to relevant site). You will get some improvements.
6. Review your themes. Some themes call a lot of graphics, and overall call a lot of files. If your CSS files are divided into multiple files, combine them. Replace graphics wherever possible with text.
7. Review the plugins your are using to see whether they are required. Plugins can make your site much slower, especially if they do a lot of DB access and inefficient. If you are advanced technically, monitor the performance of your plugins.
8. Refer to this quick cheat sheet for DB optimization (link to cheat sheet)
9. Reduce the number of posts on the front page of your blog. Typically, Wordpress gives you 10 posts on your front page, you should reduce this to 3-4.
10. Use WP's Built in Object Cache as described on this page (link). From the same site, refer to the MySQL Query Cache.
11. For some detailed technical analysis of what can be done (link)
12. Clean Options (Finds orphaned options and allows for their removal from the wp_ options table) - Get it from this page
13. The combating comment spam page on (link). If you have a good blog which is getting popular, increase in spam is only to be expected. Akismet filters out most comment spam, but just getting it into the junk spam list also adds some load to your server.
14. Page with 5 tips for making your Blog Digg / Slashdot proof (link)
15. High Traffic Tips For WordPress on Codex (link)

If you know more ways beyond this, please do let me know.

No comments: