How to Make Your WordPress Site Faster

how-to-make-your-wordpress-site-faster

Let me guess, the minute you see this post title, you may think: “install WP Super Cache or W3 Totoal Cache“, do I read your mind? Then you are wrong. I don’t like them because they are cumbersome. I have horrible nightmares to make my plugins working with those cache plugins. For example, Can I ignore caching of a plugin in W3 Total Cache?. The fragment caching is what they provided for this situation but it is not convenient as you need to edit the theme manually.

I own some 128MB VPSes which are fairly tiny hence I need to choose wordpress plugins wisely. WordPress is not doing great when your site grows big. It becomes very slow even though I take some advice from experts to install nginx + php-fpm + mysql and configuration settings are optimal for my tiny VPS. But gotta say, can’t lay all blames on wordpress the VPS is just 128MB after all.

If you are a developer, I would recommend reading Make the web faster By Google. If you are just looking for some ideas to speed up your wordpress site, please read on.

Wait, one more thing. I need you to do two web page tests first – your home page and one post. Try tools.pingdom.com, gtmetrix.com or www.webpagetest.org and note the result for comparison later.

General Rules

I’ve seen a lot of posts that tech people how to improve wordpress loading time by installing a couple of plugins. In my opinion, the best way to optimize your wordpress is installing as few plugins as possible.

Yep, KISS is best programming principle ever written. But it is hard to measure the efficiency of a plugin and personally I don’t audit source code of every plugin I’ve installed. Sometimes I end up with a plugin that comes with fewest configurations and fewest features. DB Cache Reloaded Fix is one of them. But usually, I have to modify(mostly remove unneeded features) a plugin to suit my needs.

If you can optimize it in server side, then never do it in wordpress. For example, making browser cache images, css and javascript files for a while, and eanbling GZIP, they are easy to setup in server and barely consume system resource.

DB Cache Reloaded Fix

This is my favorite plugin and I’ve installed it in my every site including this site too. If I can only choose one caching plugin. I’ll definitely go for this. It only does one job – caching database query.

Very easy to use. Check enable, pick up a time, if you are not a diligent blogger, simply empty the cache filter and click “Save”. You are done!

Remember that it will and can only cache database query except for those ones in cache filter and it won’t do anything with database update, insertion and deletion. So if you have any plugin that utilizes database, the data may not be real-time unless you add its database table to the cache filter.

Compressing Static Files

By Static Files, I mean js, css, images and even html. Compressing static files will speed up your wordpress.

hmm, it takes me a while to think about what compression plugins I should recommend to my readers. My goal to make wordpress run faster is taking up as few CPU and RAM as possible. Unfortunately, they are all system resource consumers. I’ve been struggling with this for a long time until CloudFlare.com shows up.

CloudFlare.com claims to be a CDN company. Unlike other CDN, you don’t need to upload media files to them and what you need to do is host your DNS to theirs. Besides, it protects and accelerates your website. Auto Minify is one of my favorite features. It compresses javascript, css and html.

If it is inconvenient to change the DNS of your site to another, you can choose:

Better WP Minify

WP-Compress-HTML

Oh, as for images, Smush.it it’ll strip unuseful data from image and optimize image compression without reducing the image quality. It is also availble in wordpress plugin.

Expiring Static Files

Other than make the static files smaller, we also need to set an appropriate lifetime for static images. It makes sense that static files won’t be updated frequently so it it better to have browser cache them for a while.

This will be tricky as it is involved with .htaccess. You can find it through cpanel and it’s located at the root folder of your site. If not found, try to create one. Copy the content from here and paste to the end of your .htaccess file.

If you are using nginx, please refer to this one

Optimize Database

Just like Windows, you should defragment the hard disk time to time. If you are running a busy site which apparently will have a lot of database data changes, you should defragment database like once a week. Sites like mine, defragment it when it need to.

Recommended plugin: WP Database Optimizer

Permalink Settings

Most of webmaster will set the permalink setting to %postname% for seo purpose but they won’t know this will have a negative influence the database performance when you site becomes bigger like 10k posts.

The reason is simple. Take www.test.com/I-am-test-post.html as example, wordpress will try to look it up the corresponding post whose post name is associated with I-am-test-post. If you have 500 posts, not big deal. If you have 10k posts, the database query will slow down. Here is a bad example for your better understanding, imagine the difference of identifying one guy from 5 and 100 ordinary people.

So my advice, contain %post_id% at least, make it like /%post_id%/%postname% . The wanted guy wears prominent red hat now.


Conclusion:

Well, it seems I run out of ideas. It leaves me nothing but tweaking php coding and server setting optimizations such as use MyISAM as storage engine, optimize nginx and php configuration.

If you are a non-geeky webmaster, here is what you can do: install DB Cache Reloaded Fix and move your DNS to cloudflare.com and set Performance profile to CDN Basic Optimizations.

Okay, you can start running another two web page tests if you have finished the optimizations above. Welcome to post your test results and share your optimization ideas!

Share and Enjoy

    FacebookTwitterGoogle PlusLinkedInStumbleUponPinterestRedditTumblrDiggEmailPrint

Related Posts