SLTy Plugins

WordPress Plugins that are both practical and Spirit-Led.

 

The #1 easiest way to speed up your WordPress blog

Everything I ever needed to know about computer speedups, I learned when cleaning my bedroom. OK, maybe not everything. But certainly this first hint belongs in that category. What did your mom always say?

“Throw away the trash. Then, put away your stuff. Then, do your chores (or homework, or whatever.) And then you can go out and play.”

Mom was pretty smart. It’s hard to get anything done when I’m buried in junk!

OK, so how does that relate to WordPress?

My new blog was a little sluggish; the new WP Tuner plugin said my host was taking about 2/3 of a second to generate each page, even with caching enabled. I’m busy right now, so I wanted a quick fix.

Time to take out the trash. My first thought: I have some unused plugins–things I am interested in trying someday.

OK, I admit, I’m messy. I don’t just have some plugins. I have quite a lot of plugins: close to 20 in use (or to be tested in the next few days); and another 18 that, if I’m going to be honest with myself, are really not needed at all. Am I the only plugin slob in the blogosphere?

OK, so maybe this is a useless experiment for you. But I was wondering… would it save any time to remove the extra plugins from the wp-content/plugins folder?

How big a difference do you think that would make?

You’re probably thinking: “get a clue, Mr Pete. An unused, deactivated plugin is not hurting anything at all. You’re wasting your time.”

Maybe so, but this is my time I’m wasting, both in the experiment, and in telling the story. It’s only a waste of your time if you read the whole thing and didn’t learn anything.

So… here’s what I did:

  • Created a new folder, wp-content/ex-plugins
  • Logged into my host SSH account (to get a Linux shell prompt) and used the cd command to get to my wp-content/plugins folder
  • Opened my WordPress plugins page in a browser window to see my list of deactivated plugins
  • For each plugin, used mv pluginfoldername ../ex-plugins, to simply move each unused plugin ("pluginfoldername") to the new folder. (There’s lots of ways to do this, whether FTP, WinSCP, or whatever.)

Time for the moment of truth. I refreshed a WordPress page. Blinked twice, and tried a few other pages.

Last chance… how much time do you think it saved?

Average old time: 0.63 cpu seconds. New time: 0.35 cpu seconds.

That’s a 44% speedup, and it took me all of five minutes. A lot less time than it took to tell you about it.

Below is an example of my new page load time from WP Tuner. This is clock time — the cpu time is smaller. Notice that most of the time is still spent loading WordPress code (in wp-settings) and loading plugins.

Obviously, we’ve only just begun to speed things up. I wonder what else I could do…

WP Tuner Page Load Timing

WP Tuner Page Load Timing

17 Responses to “The #1 easiest way to speed up your WordPress blog”

  1. ovidiu:

    are you sure that removing deactivated plugins helps? In my mainblog, I install all plugins I might need in the future or for future projects, so that blog has close to 520 plugins installed just for future references…

  2. Mr Pete:

    Re: ovidiu (#1),
    I can’t guarantee for everyone (and note that I’m saying this is an easy speedup, not necessarily the best possible speedup.) What I know is what I wrote above: this blog’s performance improved 40 percent as a result of that simple change.

    It’s certainly easy to try, and will have zero impact on your blog operation. Just move the unused plugins to a new folder under wp-content. That way they will be invisible to WordPress.

    I’d love to hear what you find! With that many plugins, it’s bound to help at least a little.

  3. ovidiu:

    I’ll give it a try, but honestly, I only kept the ones I deemed useful one day for a certain site/solution/problem…
    I’ll have to try and bookmark them somehow, as the plugin directory of wordpress is a mess to search through :-(

  4. Mr Pete:

    Re: ovidiu (#3),
    I’m a bit confused.

    In your first message, it sounds like you are keeping more than 500 plugins in your wp-content/plugins folder.

    Now it sounds like perhaps you do not have them on your system?

    I’m wondering… perhaps I should eventually create a feature to “archive” all unused plugins in a separate folder… to help speed up people with situations like yours. (Or, if enough people can test this idea and demonstrate whether it helps or not… then perhaps we can convince the WordPress developers to make it part of the main program!)

  5. ovidiu:

    no,no you got it right, they are all in my wp-content/plugins folder, ready to be activated. I meant if you theory is correct, I have to open their respective websites, then bookmark them somewhere.

    and your idea about archiving unused plugins sounds brilliant :-)

  6. Mr Pete:

    OK, then here’s my suggestion for attacking this:

    1) What is your current typical page “Render Time”? That’s the first number WP Tuner puts up in its summary, even before the Performance Analysis title. If that’s already pretty quick, perhaps you don’t have a need for further improvements.

    [Mine was 0.6 seconds, which seemed excessive on a new, lightly loaded server, with almost no posts and comments.]

    2) With over 500 plugins available, I’m guessing the number you have in use is relatively tiny? If so, why not do the “archive” process like this:

    a) Make a complete copy of your wp-content/plugins folder — this is easy if you have shell access on the server, as the following set of commands:
    cd [root folder of your WP install]
    cp -R wp-content/plugins wp-content/plugins-available

    b) Use a visual FTP client such as FileZilla to first select all files and folders in wp-content/plugins (e.g. with ctrl-A), then UNselect the few that you are using (e.g. with ctrl-clicks)
    c) Finally, delete all the remaining selected folders and files wp-content/plugins, which are the ones you are not using. (e.g. now press the Del key)

    This works nicely, giving you a backup of all the plugins but only keeping the few in use in the main plugins folder.

  7. ovidiu:

    hey, thx for the help. here are the first figures:
    Render Time: 0.904 cpu sec (78% load, 22.109 startup). Clock: 1.156 sec (1.2% for queries). DB queries: 38, none defective, none > 0.500 sec. Memory: 22.6MB
    Thats from my frontpage. Seems pretty good to me, right?
    There are 560 plugins used: 82 active plugins and 478 inactive plugins.

  8. ovidiu:

    or is 0.904 seconds actually bad? Unfortunately that doesn’t tell me much. Basically its a brand new blog, as I had the misfortune of breaking it completely and restarting from scratch with wp 2.7 so if you want go have a look, I left the link to my site with this comment.

  9. Mr Pete:

    Re: ovidiu (#8), to me that is incredibly slow.

    What that says is on a brand new blog with few comments, it took 1 full second (0.9 of the CPU. 1.2 of the clock) to generate the front page for one viewer.

    My hosting provider (Hostgator) says I cannot use more than 25% of the CPU long term.

    Your numbers would mean no more than 15 clicks per minute (15 seconds of CPU per minute = 25%) for ALL users combined.

    For a rarely-viewed blog, that may not be a problem. But if you have even five people clicking around, that means each one can only go to a different page every 20 seconds (3 per minute per person)… which is pretty slow.

    I suggest trying this little fix as I described above, and see what you get! I have a hunch you will be quite surprised :)

  10. ovidiu:

    thx. thats really nice of you to explain so in depth. I just tested another minimal blog on the same server (another blog, just a couple of plugins):
    Render Time: 0.156 cpu sec (72% load, 53.191 startup). Clock: 0.215 sec (13.9% for queries). DB queries: 22, none defective, none > 0.500 sec. Memory: 13.0MB

    Now after your explanations, that looks a lot better :-) so I will go ahead and remove the unused plugins, will elt you know afterwards.

  11. Mr Pete:

    My pleasure, ovidiu (#10). That’s a great result!
    It will be interesting to see the improvement on your main blog.
    The test you did has a different number of queries (22 vs 38 before) which will impact the results.
    I would refresh your main home page a few times and see how fast it is in general.

    One thing to remember about all these measurements: while the WP Tuner plugin provides a lot of detailed numbers… it is wise to remember not to get lost in picky details. Look at the bigger picture that applies to your situation. In this case:
    * Your main blog was taking about one second to generate a page
    * Your new “minimal” blog is taking about 0.2 seconds (1/5 sec) to generate a page

    So this hint could (at best?) give you up to a 5x (500 percent) speed boost. We will know the real answer after you move the unused plugins on your main blog.

    What’s so interesting about this little hint: supposedly, it should not matter. Non-activated plugins are ignored by WordPress.

    Moral of the story: a SLTy Detective never assumes “it’s impossible.”

  12. ovidiu:

    :-( I can’t seem to get my main blog faster. there is definitely something fishy.

    Render Time: 2.276 cpu sec (23% load, 143.041 startup). Clock: 9.514 sec (0.3% for queries). DB queries: 68, none defective, none > 0.500 sec. Memory: 20.5MB

    same server another blog:

    Render Time: 0.168 cpu sec (81% load, 20.477 startup). Clock: 0.206 sec (17.4% for queries). DB queries: 21, none defective, none > 0.500 sec. Memory: 13.0MB

    could you maybe give me some hints how to use wp-tuner to further narrow down the problem?

  13. ovidiu:

    ok, now I still don’t get this:
    a clean blog, with 23 active plugins and 10 inactive ones gives me these values:

    Render Time: 0.168 cpu sec (79% load, 4.604 startup). Clock: 0.212 sec (14.5% for queries). DB queries: 21, none defective, none > 0.500 sec. Memory: 13.1MB

    and my main blog, with all plugins deactivated except for wp-tuner still gives these values:

    Render Time: 1.048 cpu sec (87% load, 2.952 startup). Clock: 1.202 sec (0.0% for queries). DB queries: 3, none defective, none > 0.500 sec. Memory: 7.2MB

    what else could be the problem? I mean I am going to change themes now and test again:

    main blog with the default theme enabled and still no single enabled plugin except for wp-tuner:

    Render Time: 1.432 cpu sec (99% load, 3.916 startup). Clock: 1.435 sec (0.1% for queries). DB queries: 6, none defective, none > 0.500 sec. Memory: 7.3MB

    Thats a no-go. Are you available for a paid analysis? This blog really puzzles me, as I have had problems with it for a while. If a couple of visitors hit my blog at the same time, my server’s load goes up like a rocket see here: http://screencast.com/t/xyVyOxOECu

    The whole thing started after I tried to move my wp 2.6.3 blog from myblog.com/wordpress into the root. Although I went through the database and eliminated every occurance of that subfolder, I have had these troubles since :-( and that also means this single blog slows down my whole server… In case yo uare interested or willing to help, you can contact me via the email of this comment…

  14. Mr:

    Re: ovidiu (#13), I apologize for the delays… the Real World is complicated right now :)

    You definitely have a problem.

    To help you more: the easiest thing (until I come up with some other trick) is if you can provide me with a login on your site. Please email me as webbed dot pete at gmail

    Paid analysis: I wouldn’t do more just because of money, but tip jar donations appreciated more than you can imagine. (I’m working on enabling donations via Google Checkout which is nice because as a nonprofit we don’t even pay fees… Google covers that! Nice.)

  15. ovidiu:

    donated, sent you the login details, but here is another bummer!
    I isntalled a fresh blog yesterday which is giving me amazing stats with just 2 themes and a dozen installed plugins:

    Render Time: 0.092 cpu sec (93% load, 3.164 startup). Clock: 0.099 sec (5.7% for queries). DB queries: 21, none defective, none > 0.500 sec. Memory: 7.4MB

  16. Jürgen:

    Thank you, Pete! Worked great for me (and my blog)!

  17. Charles Masterson:

    For 1 thing, you have a pop-up here not working….it just blanks the screen 50%.

    The other, where can I find table info? I had a table that took 20 seconds to access. I couldn’t figure what it was but I emptied it anyway. Got the blog running again. It said I was doing a new install, but after that big scare, the blog seems to run fine. I dunno what that table was but your plugin helped me find the problem.

Leave a Reply

Quicktags:

Pages

Blogs

Quick Tip Jar

Currency:

Amount:

Categories

Tags

Recent Posts

Recent Comments

WP Tuner Plugin

WP Tuner 0.9.6 Comment Thread

Meta

Other Notes