The cost of Deep Integration
I’ve spent the last week working with a client on a rather large WP/bbP setup. One of the real joys of this project is that it’s large enough for me to get some time in for more than asthetics and QA. Hence, a few more posts her this last week and some code, and some BackPress help.
Anyway, one of my junior developers came up with an interesting stat the other day that I’ve been looking into, namely Deep Integration and it’s hit/performance. I’m sure almost all of this will be obvious to a great many of you, but I thought I’d throw out some figures.
Single Loading of software after install
WordPress2.9.2 16 database queries
WordPress30 19 database queries
bbPress0.9 09 database queries
bbPress1.0.2 16 database quieres
Single Loading of software after setup
WordPress2.9.2 19 database queries
WordPress30 23 database queries ***1
bbPress0.9 10 database queries
bbPress1.0.2 18 database quieres
Now the first thing I noticed is that WP3.0 took a leap in queries. Once it takes you 20+ queries to load a simple homepage with no plugins my spider sense is tingling. Turns out that WP3.0 is somewhat sruggling with it’s new menu system. ***1 It takes 6 queries minimum, plus 1 query for each taxonomy type used in the new menu (apart from hardcoded links with don’t get an additional query). That’s a heck of a leap for something as simple as a menu. I mean, menu’s are rarely dynamic – they don’t change that often. For this particular website, as will probably be the way for the others I’ve moved to WP3.0, I’m looking at a minimum of 8 database queries simply to load the data needed to display the name and link in a menu. To be clear, that’s over 30% of database queries on a clean install of WordPress that are being called by this.
As cool as the drag/drop facility is, make every menu item a custom link and you’ll save a minimum of 2 db calls per page load.
Even better, hardcode the actual menu and save yourself 8 database calls per page load (you can hardcode an array for the walker class to iterate through and produce the same result)
Single loading of software after basic/core plugins:
Now, I believe that no WordPress (nor bbPress) install can run as expected these days without certain plugins. Your thoughts on this may vary ofcourse but I find that I need a minimum of WP-Super-cache, XML-sitemaps, WP-security-scan, wp-pagenavi, headspace/All-in-one, WP-stats, and probably a few others that I can’t remember off the top of my head. Oddly for bbPress I need more plugins.
WordPress2.9.2 23 database queries
WordPress30 27 database queries ***1
bbPress0.9 18 database queries
bbPress1.0.2 29 database quieres
That’s quite a leap. But I’m confident that I could bring down the bbPress Queries with some time spent considerably, and I could enable caching from WordPress. I’m not posting this data in itself as definative stats for everyone, so there could be optomization made for sure.
Deep Integration of WP3.0 and bbPress1.0.2:
WP3 & bbP1 56 database quieres
56! With virtually no caching availible (as a plugin, for the average user with no .ini or shell access).
56! On every page (+/- a few queries).
Deep Integration of WP3.0 and bbPress1.0.2 – after first pass:
WP3 & bbP1 43 database quieres
Ok some quick theme changes and delayed/circumvented loading of certain things and I’ve brought it down considerably.
But the fact still remains that this is a truly crazy amount of database queries per page load.
Anyway, after presenting this (in a better looking format) to the IT director of the client, I’ve managed to re-assign myself 2 weeks to come up with a planB. We want something that allows us the functionality of Deep Integration, but without the MASSIVE overhead. I have an idea down on paper, but right now I just wanted to post a few figures and give folks a heads up.
Edit: If you want to see something fun, try this:
Add to your bb-config.php and your wp-config.php
In bb-config.php and wp-config.php add the following line:
Then add the following code to your footer.php in your theme (right at the bottom)
*** replace the square brackets  html brackets (they’re not showing up correctly)
You must be logged in to reply to this topic.