10 Tips on How to Speed up XenForo Forum

By Brian Jackson
Updated on December 30, 2022
10 Tips on How to Speed up XenForo Forum

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 remained relatively constant over the past five years, putting XenForo ahead of vBulletin and Invision Power Board (IPBoard).

Source: Google Trends

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.

1. Content delivery network

Implementing a content delivery network (CDN) with XenForo is quick and easy. By doing this, you will ensure you are serving your content from multiple locations around the globe so they are delivered faster to your visitors. KeyCDN has a very simple integration with XenForo.

2. Utilize caching

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.

Caching plugin

There is a popular add-on [bd] Cache 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 backend 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 style sheets 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 frontend and the backend.

Cache frontend

Configuring the frontend 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;

Cache backend

XenForo has three different caching methods you can implement for the backend.

  1. File backend:

    $config['cache']['backend'] = 'File';
    
  2. APC backend:

    $config['cache']['backend'] = 'Apc';
    
  3. Memcached backend:

    $config['cache']['backend'] = 'Memcached';
    $config['cache']['backendOptions'] = array(
        'compression' => false,
        'servers' => array(
            array(
                // your memcached server IP /address
                'host' => 'localhost',
    
                // memcached port
                'port' => 11211,
            )
        )
    );
    

LiteSpeed

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

3. Image 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 Nobita Image Optimizer add-on that optimizes and compresses attached images on your boards.

Processed 453,000 images, saved 134.9 GB of disk space resulting in 55% reduction.

- TalkBass.com

4. jQuery CDN vs local

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.

5. Minify CSS

XenForo has an option to minify CSS built-in. To enable this go into "Options" > "Performance" and enable "Minify CSS."

6. Defer JavaScript (move to bottom)

It is always recommended to defer JavaScript and place it right before the </body> tag. By default, XenForo loads JavaScript in the header that isn't the best for speed and is not what is recommended by Google PageSpeed Insights.

There is a free add-on, Defer JS, which collects JavaScript in post-view output and moves them to the bottom of the page. This has a noticeable impact on page-load times as pending HTTP requests postpone the rendering of a page while scripts aren't run anyways until everything is loaded.

Worked pretty well for me, increased my defer js from an F to a C! No longer failing :)

- Noobstradamus

You can also defer JavaScript using the [bd] Cache add-on we mentioned earlier.

7. Fewer add-ons

Just like with WordPress, the fewer plugins/add-ons in XenForo the better. Every add-on increases the number of HTTP requests you have as well as download times for whatever JavaScript or CSS file they are including. While a lot of these optimization tips we have talked about are add-ons, we always recommend speed testing your forum to see if you are gaining speed or losing it, as some add-ons are more efficient than others. Ask yourself, do you really need the add-on or is it just a cool feature you could live without.

8. Reduce HTTP requests

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.

9. Leverage browser caching

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 compression

Gzip compresses web pages and style sheets at the server level before sending them over to the browser.

<IfModule mod_deflate.c>
    # Compress HTML, CSS, JavaScript, Text, XML and fonts
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    AddOutputFilterByType DEFLATE application/x-font
    AddOutputFilterByType DEFLATE application/x-font-opentype
    AddOutputFilterByType DEFLATE application/x-font-otf
    AddOutputFilterByType DEFLATE application/x-font-truetype
    AddOutputFilterByType DEFLATE application/x-font-ttf
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE font/opentype
    AddOutputFilterByType DEFLATE font/otf
    AddOutputFilterByType DEFLATE font/ttf
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xml

    # Remove browser bugs (only needed for really old browsers)
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    Header append Vary User-Agent
</IfModule>

Expire headers

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>

10. Choose fast XenForo hosting

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. We suggest going with a VPS like DigitalOcean or Linode. The reason is because you will be in complete control of your resources. And if you aren't as tech savvy or don't want to manage your servers via CLI, ServerPilot is a great control panel alternative which works with XenForo and the VPS providers mentioned above.

Summary

As you can see, there are quite a few ways you can speed up XenForo. From implementing a CDN to caching, reducing HTTP requests, image optimization, minifying CSS, deferring JavaScript, and server level configs. Also having a good web host is equally important.

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.

  • Share

Supercharge your content delivery 🚀

Try KeyCDN with a free 14 day trial, no credit card required.

Get started

Comments

Comment policy: Comments are welcomed and encouraged. However, all comments are manually moderated and those deemed to be spam or solely promotional in nature will be deleted.
  • **bold**
  • `code`
  • ```block```
KeyCDN uses cookies to make its website easier to use. Learn more