Big Performance Improvements Coming in BuddyPress 2.0

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:

last-active

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.

6 Comments


  1. 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?

    Report


  2. I think JJJ has those survey results and I’d love to see them. I know they talked about getting them published during the recent developer’s chat, but it looks like they haven’t had a chance to get it out yet. For anyone who uses Twitter (sorry, I don’t), you may want to ping JJJ (https://twitter.com/JJJ) and ask when he plans to publish the survey results.

    There were some good questions in the survey and I look forward to seeing what was learned.

    Report


  3. 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.

    you gotta be joking right? alot of buddypress plugin developers take long enough to update and fix bugs that are already exist within their plugins without upgrading them for the launch of a new buddypress release, after reading the buddypress trac about 2.0 i really cant see this upgrade going very well for many upon its release, those people who have buddypress running nice and smoothly will most likely upgrade and find lots of their plugins break and will most likely lose functionality that there users expect until the plugin devs get up to shape (in some cases if at all!)
    this is why i believe buddypress needs to think of backwards compat with as many bp plugins as possible rather than say hey leave it to the devs of the plugins and hope they react quikly!

    well sorry if it sounds like im bursting your bubble but just watch and see upon its release, im not just talking about free plugins im talking about ones people have also paid for. its allways the same on any major update!

    Report

Comments are closed.