XenForo has brought a fresh outlook to forum software and is quickly becoming one of the most popular forum platforms around the globe. In this post, we will share with you techniques on ways you can speed up your XenForo forum to ensure fast load times for your visitors.
What is XenForo?
XenForo is a community forum software built on Zend Framework and was released in 2011. The software is developed and maintained by former vBulletin lead developers Kier Darby and Mike Sullivan.
According to Google Trends, activity around XenForo has been growing at a steady pace over the past four years, whereas vBulletin and Invision Power Board (IPBoard) have been declining.
XenForo is known for its easy pricing structure, built-in SEO, active development, fast support, as well as numerous add-ins available to accomplish almost any task.
Speed Up XenForo
Just as we described in our guide on how to speed up WordPress, XenForo can also become slow over time, especially because it is a community-based software. XenForo is much more resource heavy on your server and depending on your member activity, can be writing to your database constantly. Follow these steps below on how to speed up XenForo and keep it running fast, ensuring your visitors will return.
Speed Up Xenforo Index
- Navigate to the document root of your XenForo installation.
- Log in to your XenForo control panel and navigate to “Appearance” → “Styles” → [Your Style] → “Style Properties” → “General”.
- In the field “Path to Images” replace default “styles/default” with “http://yourzone-ab12.kxcdn.com/styles/default” and click on the “Update Style Properties” button to apply your new settings.
We highly recommend you utilize caching with your XenForo forum. You can do this by either using a caching add-on or by implementing the XenForo caching configuration, server side.
There is a popular add-on [bd] Cache from xfrocks.com that we recommend using. It can cache all of your built-in lists, views, and pages. It is possible to render a page with 0 database queries. Most people see page load times cut in half. This plugin works with back-end cache enabled or without.
Features of [bd] Cache
1. “Cache Pages” (guests only) for top speed
2. Admin can purge cache for individual page any time
3. “CSS to file” for faster serving, make it possible to put stylesheets behind CDN
4. “Defer JS” to make sure the page display in user browser as soon as possible.
If you are running Xenforo on a Redis server, here is a caching add-on: Zend Redis Cache
Server Side Caching
XenForo has documentation on how to define cache for both the front-end and the back-end.
Configuring the front-end is easy, and involves simply adding the following lines to your library/config.php file.
$config['cache']['enabled'] = true; $config['cache']['frontend'] = 'Core'; $config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
You can also cache sessions by adding the following.
$config['cache']['cacheSessions'] = true;
XenForo has three different caching methods you can implement for the backend.
- File back-end $config[‘cache’][‘backend’] = ‘File’;
- APC back-end $config[‘cache’][‘backend’] = ‘Apc’;
- Memcached back-end $config[‘cache’][‘backend’] = ‘Memcached’; $config[‘cache’][‘backendOptions’] = array( ‘compression’ => false, ‘servers’ => array( array( // your memcached server IP /address ‘host’ => ‘localhost’, // memcached port ‘port’ => 11211, ) ) );
Another recommended server-side option is to implement LiteSpeed. According to a case study from LiteSpeed, web server and MySQL optimization made ForoMTB’s XenForo installation 30x faster.
Now my board loads pages as if it were empty even with more than 3000 users connected. – ForoMTB
Before/After LiteSpeed + MySQL Optimization
Just like with any website, image optimization is very important with XenForo. Especially when it comes to dealing with large image attachments in threads. By optimizing your images, you are ensuring the fastest rendering time for your pages and your saving disk space on your server.
We recommend the GoodForNothing Kraken add-on that optimizes and compresses attached images on your boards.
Processed 453k images, saved 134.9GB of disk space resulting in 55% reduction. – talkbass.com
You have two options when it comes to compressing. You can defer the compression of image attachments using an add-on like GoodForNothing Shell Defer or you can compress them upon upload, meaning your visitors will experience a slight delay.
Delivery jQuery via a CDN will most likely always be faster than local because you can distribute it from multiple locations that are closer to the visitor. XenForo has a built-in option to change where jQuery is loaded from. To change this go into “Options” → “Performance” and at the bottom there is a jQuery source selection. The Google CDN is a good one to start with.
Xenforo has an option to minify CSS built-in. To enable this go into “Options” → “Performance” and enable “Minify CSS.”
The caching add-on [bd] Cache that we mentioned earlier also allows you to minify CSS.
Worked pretty well for me, increased my defer js from an F to a C! No longer failing 🙂 – Noobstradamus
As we just mentioned above, always analyze the number of HTTP requests your XenForo forum is making. One little tweak we recommend is to remove the sidebar sharing. This is a simple way to increase your front page load time.
To do this browse to “Appearance” → “Styles” → [Your Style] → “Templates” and click into the “sidebar_share_page” template. Then simply delete its contents. Anytime you would like to re-add this to the sidebar, simply revert the template.
By doing this, you will minimize DNS lookup on the front page.
Another form of caching you can leverage is browser caching. See the following snippets you can add to your
.htaccess file, such as enabling Gzip compression, adding expire headers, and disabling ETags.
Gzip compresses web pages and stylesheets at the server level before sending them over to the browser.
Expire headers tell the browser whether they should request a file from the server or grab it from the browser’s cache.
<ifModule mod_expires.c> ExpiresActive On ############################################ ## Add default Expires header ## http://developer.yahoo.com/performance/rules.html#expires <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> ExpiresDefault "access plus 1 year" </FilesMatch> </ifModule>
And last but not least, choosing fast Xenforo hosting can be one of the most important decisions you will make when trying to improve Xenforo performance. We recommend staying away from cheap shared hosting as they tend to overcrowd their servers and you will end up sharing resources between hundreds of people.
Do you have another way to speed up your XenForo forum that we missed? We would love to hear about it below in the comments.
original article: https://www.keycdn.com/blog/speed-up-xenforo/#caching