[TUT] Speed up your XenForo site

XF1 [TUT] Speed up your XenForo site

Compatible XF Versions
1.4, 1.5
I've been working pretty hard to get my XenForo forums speedy and thought I'd share some lessons learned here. This isn't meant to be comprehensive where I explain everything. More of a checklist.

Some of these are rather obvious, for example...

1) Get a good host and a powerful server. I use and recommend Hivelocity, but there are lots of good hosts. Don't skimp on RAM.

Just a side note: I had read a lot about LiteSpeed being faster than Apache, and I leased LiteSpeed (2-CPU) for a long time. Recently I found through testing that Apache was at least as fast as LiteSpeed for my sites, which I assume has to do with my sites being relatively lower in activity (I have 6 XenForo sites on my server, the most active of which at the time of this writing is https://www.mu-43.com) and my server relatively powerful.

The point here is to test things for yourself before you go paying for something for years on end because someone said it was faster.

2) If you have a dedicated server running Apache, disable httaccess. Move all httaccess directives to httpd.conf first so that you can keep any necessary rewrites in place.

See: WordPress Performance: Stop using .htaccess!

upload_2017-12-13_15-50-36.gif Add expires headers (leverage browser caching).

See: Leverage browser caching | GTmetrix

4) Enable gzip compression.

See: Enable gzip compression | GTmetrix

5) Utilize caching.

See: Defining a Cache | XenForo

I use Zend OpCache for opcode caching (comes with PHP 5.5 or higher) and Memcached. There is also the option to use Redis instead of Memcached:Zend Redis Cache

6) Tune MySQL (or MariaDB or Percona).

See: MySQL Tuning Tutorial for a Xenforo or WordPress VPS by Jeff Widman

Side note: I hired @MattW to setup my server, caching, MariaDB, and more. Highly recommend his services! (no relationship other than happy customer). See: MattWServices

7) Don't use Google Integration.

It's nice for members to be able to sign in with Google (OAuth), but there is a big hit to page loading speed. Not worth it to me. I also removed Facebook likes from thread pages because of a small associated performance hit from that.

8) Disable unnecessary features and addons, especially if test sites such as Webpagetest.org are citing scripts from those addons.

9) Enable Minify CSS (under Options > Performance)

10) Experiment with different jQuery sources (also under Options > Performance)

See: What is 'jQuery Source'?

11) Delete the contents of sidebar_share_page template (social sharing) to increase front page load times. You can always revert if you want those back.

12) Get rid of low-performing ad networks, and minimize the number of ad passbacks (redirects).

1 upload_2017-12-13_15-50-36.gif Try a CDN to see if it makes a difference for your site. I've used MaxCDN, CloudFlare, CloudFront, and KeyCDN. All have their good and bad points. More often than not, I don't find that they help much, but your mileage may vary. You can use Webpagetest.org to test site performance from different geographic regions.

Right now I'm trying KeyCDN, and it certainly has improved my GTmetrix scores. Here are the current scores from my one site that currently doesn't have ads (ads ruin scores):


See: Speed up your site with a CDN

14) Defer javascript to the extent possible without breaking your site. This can be done in a variety of ways, including mod_pagespeed or CloudFlare. There are also two addons that can do this for you:
Defer JS: Defer JS
[bd] Cache: [bd] Cache

15) Besides defering javascript, [bd] Cache can also cache pages for guests and convert CSS to file.

I don't use the page caching for guests, but I do use CSS to file because it makes it possible for me to serve CSS with a CDN. Of note, I found that enabling CSS to file before setting up the CDN gave me white screens same as this:

[bd] Cache [Paid]

However, once my CDN was up and running, enabling CSS in that addon worked perfectly for me.

16) Optimize image attachments and avatars. I use this addon:

GoodForNothing Kraken

17) Try mod_pagespeed if you use Apache or ngx_pagespeed if you use Nginx. I haven't determined yet if this speeds up my sites and at this moment have it disabled, but some XenForo performance experts endorse it, so it's worth trying!

So far I've found these filters to work without apparent problems on my sites:

ModPagespeedEnableFilters canonicalize_javascript_libraries
ModPagespeedEnableFilters combine_css
ModPagespeedEnableFilters combine_javascript
ModPagespeedEnableFilters extend_cache
ModPagespeedEnableFilters extend_cache_pdfs
ModPagespeedEnableFilters inline_javascript
ModPagespeedEnableFilters lazyload_images
ModPagespeedEnableFilters insert_dns_prefetch
ModPagespeedEnableFilters remove_comments
ModPagespeedEnableFilters rewrite_css
ModPagespeedEnableFilters rewrite_javascript
ModPagespeedEnableFilters rewrite_images
ModPagespeedEnableFilters sprite_images

See: PageSpeed Module | Google Developers

Some sites you can use to test site performance:
WebPagetest - Website Performance and Optimization Test
GTmetrix | Website Speed and Performance Optimization
Pingdom Tools
PageSpeed Insights
First release
Last update
0.00 star(s) 0 ratings

More resources from shimmer