BuddyPress 2.0, due sometime in mid-April, officially kicked off development a couple weeks ago. This release will include some exciting, visible new features, including the ability to edit BuddyPress profiles in the WordPress admin. But there are also some major improvements happening under the hood that will help BuddyPress to scale better in the near future.
Moving the user ‘last_activity’ data out of the wp_usermeta table has been a on the roadmap for awhile, but what does that really mean and who will it affect?
The ‘last_activity’ data is what you see displayed on user profiles:
This data is also used within BuddyPress to sort results and to determine whether a user is a valid site member. In an update last week, BuddyPress core developer Boone Gorges explained why the issue has developed into what he calls “a perennial performance bottleneck”:
In the case of users, the information was stored in wp_usermeta. This table gets exceptionally bloated on busy sites, and it’s not properly indexed for the sorts of ORDER BY queries we were performing on it.
Gorges put a fix in place to address the issue. BuddyPress 2.0 will now store user last_activity data in its own row within the wp_bp_activity table, even if the site has the Activity component disabled. “The performance improvements are pretty extreme,” Gorges said and promised to post benchmarks as development for BuddyPress 2.0 approaches release.
When applying the first patch to the issue, Gorges shared a few preliminary metrics that should give you an idea of the performance improvements in this fix:
Basically, the main query went from about 57ms to .3ms. Roughly two orders of magnitude improvement. This will become more dramatic on larger sites (usermeta’s performance will degrade in a greater-than-linear fashion), especially where usermeta is filled with lots of other junk from other plugins.
‘Last_activty’ data will be indefinitely mirrored in both the old and new locations in order to maintain backwards compatibility with plugins. However, plugin authors are encouraged to update their extensions to get data via the BuddyPress API functions instead of the old method. Gorges offers an example in his update and lists a few plugins from the WordPress Plugin Directory that will need to be updated.
Plugin developers who want to take advantage of these performance improvements have plenty of time to prepare an updated version to have on deck to coincide with the 2.0 release. Leave a comment on the BuddyPress Development blog if you have any questions regarding the changes or need help updating your code.
I am really happy about these performance improvements. It will make a huge difference to sites with a few thousand members and up. 2.0 is going to be awesome!
Does anybody know when/where the results of the BuddyPress survey will be posted?