Tuesday, February 10, 2009

My Love-Hate Relationship with WordPress

I love WordPress, but I hate it too!

I love WordPress because it is easy to use, install, and configure. I also love WordPress because it is updated 2-3 times a year so I don't worry about it not working with the next version of php or mysql.

I hate it because it is getting fat. This last few weeks I've been busy optimizing my own PHP scripts for better perfomance because i noticed some pages loading slowly. I've even redistributed my mysql tables and optimized mysql database table indexes. I also turned off and deleted many WordPress plugins thinking that work help. Yes,  they all did help. Unfortunately they didn't help enough. WordPress too often ends up in my "slow queries" log generated by my shared hosting.

After several months of integration of my php shop scripts with WordPress, I cut the cord!  I commented out the include file that loads the Wordpress backend so I could use the Supercache page caching plugin.

I saved around 10-18 queries!  I don't know why WordPress needs to do around 10-18 queries (depends on the version) just to let me load a plugin on an external page, but that is what Supercache was showing and I finally decided that it wasn't worth it.

Why did it take me so long to do it?  I had to set up my own page caching first.  Fortunately there are several php output or page caching script samples online. I tried one and after finding all of the bugs in the script that kept it from working I fixed it up and have it installed and working.

How much faster are external pages loading?  Comparing the processing time between the supercached versions of my external pages and the time with my own caching script. Some pages are loading between one third and one sixth of the time it took before while others are loading in about the same amount of time.  Page processing time is a good metric, but it isn't precise because it varies according to current server load. If the server is under more load, a script will take a little longer so you have to compare averages.

Another motivating factor in my decision to cut the cord to WordPress on my external pages are the somewhat recent changes to Supercache.  I'm sure Donncha has very valid reasons for doing so, but he removed the notice in HTML comments that a cached page was being served, so I couldn't easily tell if the cache was working or not ( often times it didn't appear to be serving the cache even though the files were being created).

Not really being able to tell if the cache was working or not was the straw that broke the camel's back for me. I don't like working on blind faith when it comes to my web hosting and server stability.

Don't you love it when fixing one problem helps solve another? By setting up my own separate cache, I was able to disconnect the WordPress backend and speed up pages. It made me want to do a dance of joy.

What's next in caching?  I am thinking about setting up a menu cache for dynamically created menus on the shop category and shop discount pages.  If you notice an additional speed up in the next few days on those pages, now you'll know why.

Do you cache your php output or menus?  If you haven't already set up caching today!

No comments:

Post a Comment