Performance is key to any site, hopefully this guide will put you on the right track to optimize your site to perform while your community grows.
The server you have is the most important step to a fast website, overall performance starts with your hosts server and hardware.
Make sure you have a featureful and robust server such as Apache, or use Nginx as it is incredibly more efficient, but any server that can run PHP or MySQL should be fine.
If your community begins to grow tremendously, upgrade your hosting environment to a Virtual Private Server or better to a Dedicated Server to handle a large amount of users and posts per day. While it is possible to run bbPress on shared hosting environment, and could work pretty good for a small community, the more your community grows the more your site will slow down and the more that shared hosting is not a viable option.
bbPress and WordPress work best when it’s in a rich hosting environment. To look for recommended solutions to choose for your host, you may look at this list of featured WordPress hosts.
An excellent way to significantly improve performance is to install an Opcode Cacher on your server. This can improve page load and requests per second by caching PHP opcodes from previous requests.
To install an Opcode cacher you would need to contact your hosting provider and request that they either install it for you, or ask if they have a guide to help you install it on your server.
Please know that in most situations you will not be able to install an opcode cacher on a shared host, because of the large amount of memory you will need to run it.
Here is a list of well known Opcode cachers:
Object caching is caching complex SQL queries so they’re not performed multiple times within a page load. Using an object cacher will cache anything utilizing the WordPress caching API, which will stop WordPress from caching to the default options table and instead use whatever object caching back-end you have installed.
You will then need to choose the type of persistent caching that you would like to use. You can also use some of these Opcode cachers to also do object caching.
It also is possible to use these in memory object cachers on your site.
To make object caching work with WordPress, you will need to install a plugin which will add an object cache drop-in file to your WordPress site. There are multiple object cache backend plugins that will add this object cache drop-in file, like this one for APC or this one for Memcached for example, also W3 Total Cache supports most of them.
For a multi-server setup you may need to look into using Memcached.
On a shared server you may be able to use the disk to store frequently accessed data, but this might cause issues and actually slow down your site.
Page caching is great for your websites pages, blog posts, and your sites front page, but due to forums being highly dynamic and being constantly updated by users, page caching really depends on how you set up your bbPress forums.
If you only allow users to post when they are logged in, it is best to only serve cache to guest users. If you find an option in your plugin to set the cache refresh, make sure to set it to a short amount of time, like about an hour or two. Also after a bbPress post type is updated, most bbPress compatible cache plugins will flush the cache and everything should be fresh again.
If you allow users to post without registering to your site, page caching might not be very practical solution. Because of this, it is recommended to exclude the bbPress forum pages from page caching so that your forum pages will not show outdated information to guest users. If your forum is very active you may consider this too.
To disallow forum pages from Page caching, go into your favorite caching plugin and add these strings to the rejected pages/strings to cache setting.
If you have kept the forum root slug for your forums you can use this forums string for most of the bbPress pages, and also the topics string for the topics archive.
If you disabled the forum root slug in your forum settings, you may use these set of strings.
/forums/ /forum/ /topics/ /topic/ /reply/
If you have custom slugs set in your forum settings you can replace the strings I placed with your custom strings.
For better performance page caching it is possible to allow an opcode cacher, Redis. or Memcached to store your pages in memory, but keep in mind that forums tend to have a lot more cacheable pages and you may need to keep an eye on your RAM usage on your site.
This is optional.
When trashing posts, editing posts frequently, marking posts as spam, your database will begin to accumulate a lot of extra data. Even though each piece individually may be a few bytes of data, after awhile this data will begin to add up and may affect how long your server retrieves information from your database tables. Optimizing the database slightly improves performance and reduces the database size by cleaning up and removing the data that you may not need (like spam posts hogging down your database).
While you can optimize your database tables using the SQL command OPTIMIZE TABLE or running the function to optimize the database tables in phpMyAdmin by selecting each table and from the drop down menu and selecting Optimize Table, you can just use a handy WordPress plugin to optimize your database. Installing plugins like WP-DBManager, and WP-Sweep, or any other alternative, will allow you to optimize most of your database.
When optimizing your database with one of these plugins, you will likely see options to remove data like this. I am just going to tell you the options that in my opinion might be important and why you may not run it, and also why it may be useful to run one option. I also recommend optimizing your database at least once a month or two.
Before you do anything, it is recommended that you perform a database backup before running any options though, because removing the data is permanent.
- Removing revisions – While this might be useful especially if you edit your posts a crazy amount of times, bbPress uses the post revision system in WordPress for topic and reply edit logging. If you want to keep the edit logs on your posts, and other plugins might the revision system for Custom CSS plugin. If you feel like you might lose something important, do not run this.
- Removing Trashed/Deleted Posts – If you believe that any type of posts that you trashed, this includes topics, replies and blog posts are supposed to be deleted without any mistakes, you may run this.
- Remove Spam – This option usually includes spam comments. Spam comments can very well enlarge your database, they are usually auto-deleted at least once per month with WordPress, but using these plugins you can shorten the amount of time.
Since you could have a large amount of spam topics and replies, make sure that if are going to run this, that you might as well remove all your reply and topic spam.
- Go to Replies > All Replies or Topics > All Topics in the WordPress backend.
- Click the Spam action link, so you can see all the spam on the post type you’ve chosen.
- Now hit the Empty Spam button to remove all your post types spam.
- Optimize Tables – In WP-Sweep and WP-DBManger this should be similar to how phpMyAdmin would optimize your database tables.
Like anything in life, there is always more room to improve. Version 2.6 of bbPress will kick start some performance improvements and anyone able to help testing out and creating patches in the bbPress trac for existing trac tickets, or just contributing any possible code improvement suggestions for bbPress will be greatly appreciated.
- Remove unnecessary objects, features, and plugins – Only use what you need.
- Offload data to an external source – Using a CDN or an additional server to hold static content, can greatly reduce bandwidth, server load, and speed up your website.
- Enable Browser Caching
- CSS in head and JS in Footer
- Optimize images – If your users upload a lot of Gifs and JPEGs in your forums using a plugin for bbPress, you will notice that these images will slow down your topic load time. Enabling some kind of image optimization will reduce the size of these images and make posts with images load faster.
- Use Lazy Load – Using a lazy load plugin like Lazy Load or Rocket Lazy Load will minimize requests and only display images when they are visible to the user.
- Use Gzip compression
- How do you Measure Performance
- WordPress Optimization
- WordPress Performance
- WP Object Cache
- High Traffic Tips for WordPress
- Server Optimization