/
/
How to improve BuddyPress speed and performance

The combination of WordPress, BuddyPress, and all of your plugins can sometimes lead to a slow website. What follows is the ultimate guide to speeding up your BuddyPress site. In combination, the techniques described below will dramatically improve your page load speed. Some of these methods are easy to implement while others are more difficult. Just do what you feel comfortable with.


The Basics

Stay up to date

WordPress and plugin authors regularly release updates which you can download by going into Dashboard > Updates in your WordPress dashboard. Many of these updates provide speed improvements and you should get into the habit of downloading updates fairly regularly. Always back up your files and back up your database before performing updates! On the rare occasion that something goes wrong, you will save yourself a huge headache by having backed up your website first.

Limit plugin use

WordPress has over 15,000 plugins available. With all of these plugins, it’s tempting to try out every plugin that peaks your interest. However, every additional plugin you install will need to request information from your database and the cumulative effect of having dozens of plugins is that your site will slow down. Use only the plugins that you actually need. Try to remove the rest.


Caching Methods

Caching is definitely the most effective method for speeding up your website. Below is an excellent explanation of what the word “caching” actually means, by Tutorial9.

“Each time you visit your blog, WordPress will go through a sometimes lengthy process to build everything you see. First it will process the PHP code which will make numerous calls to your database and finally output HTML for your web browser to display. On some blogs this could happen between 20 to 200 times per page! WordPress has often been criticized as slow but we can change that by enabling caching.”

“If you enable caching only the first visitor will go through this entire process. The caching mechanism will save the data and then serve every subsequent visitor the final result. Thus speeding up WordPress by a huge factor. Trust me, you want it and your visitors will thank you for using it.”

Important: You have to be very careful when caching with BuddyPress, as much of the content is dynamically generated and must stay fresh. Follow our guide and you will be okay:

General Caching

Install the Hyper Cache plugin. Carefully follow the instructions below to avoid problems with your BuddyPress setup…

Hyper Cache is specifically written for people who have their sites on low resource hosting providers. This plugin will make an enormous speed improvement and is recommended instead of other similar plugins such as WP Super Cache or W3 Total Cache. It will work better with BuddyPress and is quite simple to set up.

Under the “Configuration” settings panel, set the “Cached pages timeout” to just 1 minute.

By default this plugin will cache all of your site’s pages, including your BuddyPress-specific content like activity posts and forum posts. This is not good, as your BuddyPress content is constantly updated and needs to remain fresh. To fix it add the following lines into “URI to reject” in the “Filters” settings panel of Hyper Cache:

/forums/
/groups/
/members/
/activity/
/blogs/
/messages/
/register/
/activate/

Add any other base URI’s that you want to reject. For example, if you have a section with /photos/ in the base URI and users are uploading photos into this section, you would want to add /photos/ to the list.

Database Caching

Install the DB Cache Reloaded Fix plugin. This plugin caches every database query on your website and reduces how many times your site needs to access the database, thus speeding things up. You should be fine using the default settings.

Image Caching

Neither of the methods outlined above will cache the images used throughout your site. Caching your images will help speed things up as well. I am not aware of a good plugin for this, so you will have to do it manually.

If you know how to edit files via FTP, open up your preferred FTP program and make sure “hidden files” are viewable. Find a file called “.htaccess” in the root folder of your website and open it. Add the following to the end of the file to cache site images for one month:

# Image and Flash content Caching for One Month
<FilesMatch “.(flv|gif|jpg|jpeg|png|ico|swf)$”>
Header set Cache-Control “max-age=2592000”
</FilesMatch>


Database Optimization

Your actual database can get filled with old junk that bogs it down, such as post revisions that have collected over time. You can clean out all of the unused content from your database to reduce its size.

Install the WP DB Optimizer plugin. The plugin optimizes your database tables with one click. To use it, just go to Settings > Optimize Database and it will instantly optimize it for you. I recommend getting into the habit of occasionally returning to this plugin and cleaning your database.

Install the Better Delete Revision plugin. Then go into Settings > Better Delete Revision. Click “Check Revision Posts”. It will display all of your post revisions, and you may be surprised to find hundreds of them! From this screen you can delete them all.


CSS Minification

This one is for experienced developers only. The stylesheets that come with BuddyBoss (in the _inc/css/ folder) are uncompressed and are thus quite long. A browser needs to read through all of them and this adds to page load speed. Theme authors do not release themes with minified CSS as normal users would have a difficult time figuring out how to edit the stylesheets, but if you are comfortable with code this is a great technique.

First, back up all of your stylesheets so you have the source files to return to later. I personally just duplicate the files and rename them, such as “default-source.css”, and then edit the original file.

Then use this CSS compressor: http://tools.w3clubs.com/cssmin/

Enter all of the code from your stylesheet into the top box, “crunch” it, and then paste the resulting minified code back into your stylesheet, copying over all of the uncompressed code. Your CSS will be reduced from thousands of lines to just 1 big block of CSS.

You can do the same trick with your JavaScript files with this JS compressor: http://jscompress.com/


Reliable Hosting

If you are on a shared hosting plan, it might be the case that your web host is “overselling” and there are too many websites sharing the same server as yours, putting a bottleneck in the pipeline. Switching web hosts should be considered a last resort, as it can be a real pain. But if all else fails this may be your best option to speed up your site. If you have a high traffic site you might consider getting a dedicated server, which will host only your site on one server. These are expensive, often $100/month or more.

37 Responses
  1. Excellent post! Thanks for all your work on putting all these parts together to one whole tutorial on improving BuddyPress speed and reliability. Looking forward to more similar posts here!

  2. Michael,

    Thanks so much for this post… very helpful. Quick question, I tried the WP DB Optimizer plugin and when clicking the button it returned this:

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/dpayne2/public_html/physician-assistant-ed.com/wp-content/plugins/wp-db-optimizer/wp-db-optimizer.php on line 76

    Any thoughts on what I can do to make this work?

  3. I noticed after setting up the caching that when a user has a notification (the little red number that appears in the top right nav bar), once that notification is taken care of (e.g., a friendship is accepted), that it remains until the caching resets. How could you turn that off?

    1. Turns out it had nothing to do with the Hypercache plugin. The problem was with the DB Cache Reloaded plugin. Not only would the notifications not go away but when individuals submitted anything on a wall or activity stream, this would not be published for several minutes. When I removed the DB Cache Reloaded plugin, the problem went away! I’m not sure if this problem is unique for me or if others have experienced it but I thought you should know.

  4. I’m sorry…I spoke too soon. What I should have said in my last post was “WOW!!!” I just tested these things on my Buddpress site and it is so much faster now! Thank you!

  5. Your recommendations works great on my buddypress site, but i have one problem.
    Status updates, comments and pretty much everything doesn’t show immediately but after minute or so.
    Am i doing something wrong or is this price i have to pay for faster site, because site is very active and people are making double and triple posts because they expect it to show immediately.

  6. I have tried everything on this page except for the CSS Tweak. I disabled all plugins except for the caching and buddypress and still my home page takes about 5 seconds to load. It also shows when I added <!– queries –> into the footer. I am using this in a school with about 200 students. They have been joined into groups for their class level and given a group blog. I’ve also created a personal blog for each student. I am on a virtual server with 768 Memory and 1.13 Ghz processor. I moved to this from a shared host hoping to improve performance.

    What would be my next step to improve this. It was unusable today with just 10 students trying to access it! The server finally became unresponsive and I had to restart it!

    Thanks.

  7. I sat down and followed this tips step by step, and guess what? My sluggish buddypress site is loading fine. I am planning on using Max CDN to make the site more blazing fast. However, when I went to their site, I used their live chat and my experience there is disappointing. The woman I chatted with said I should use w3Total Cache instead of hyper cache. I love this hyper cache and if all she can recommend is the super cache and w3Total Cache that you disapproved, then I will rather stay without their CDN. However, I like Max CDN, is there any way I can integrate Max CDN with Hyper Cache plugin assuming that woman never gave me that appalling info.

    1. Glad to hear your site is loading faster. Yes, you can integrated Max CDN or any other CDN via the regular WordPress media settings. If you contact Max CDN they should be able to tell you how to set up Max CDN within the WordPress media settings, assuming you talk to a better support person next time.

    2. I highly recommend CloudFlare. It works very well and it has a WordPress plugin for better integration. It also has a number of nice optional features (“apps”). There’s also a free tier, which is more than sufficient for most WordPress websites.

  8. You left out the possibility of using a VPS as dedicated-like option that provides more resources and server control than shared hosting, while being significantly cheaper than a straight dedicated server.

    1. That is a very difficult question to answer. Some plugins only run in the admin and have almost no overhead, while others consume a lot of resources. Typically you may have one or two specific plugins slowing down your site and the rest don’t matter, so you have to test and see.

      This plugin helps : https://wordpress.org/plugins/bwp-minify/

      It lets you combine CSS and JS from all of your plugins into one, negating the issue of too many files from too many plugins.

      But, still some plugins are poorly coded and consume a lot of resources on the server end.

  9. Would love to see an update to this with the latest and greatest of plugins and techniques. Original post was 4 years ago, a lot’s changed since then both with WP and with BP.

  10. I second comment above: an update would be great. I got as far as trying to set up hyper cache, but so much has changed, the installation instructions don’t make sense anymore.

  11. Hi i am implementing the steps to my bp site but when i add this (as written) in .htaccess i get an internal servererror 500. I am not a programmer so can not tell if there are any typos etc?

    [php]# Image and Flash content Caching for One Month

    Header set Cache-Control “max-age=2592000”
    [/php]

    1. Terje, you do not add the php tags, simple add this to your htaccess file:
      # Image and Flash content Caching for One Month
      Header set Cache-Control “max-age=2592000”

Leave a Comment

Your email address will not be published. Required fields are marked *