Register Arama Bugünkü Mesajlar Tüm Forumu Okundu Say

Reply
 
Thread Tools
Speed up XenForo site
 
TTayfun's Avatar
TTayfun
TTayfun has a brilliant futureTTayfun has a brilliant futureTTayfun has a brilliant futureTTayfun has a brilliant futureTTayfun has a brilliant futureTTayfun has a brilliant futureTTayfun has a brilliant futureTTayfun has a brilliant futureTTayfun has a brilliant futureTTayfun has a brilliant future
Gerçek Ad: Tayfun T.
Kayıt Tarihi: Nov 2017
Mesajlar: 170

Güzergah: Istanbul Anadolu
Show Printable Version Email this Page
yazan TTayfun 30 Dec 2017, 01:46
Oylama: (1 oy - 5.00 ortalama)

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.

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: Apache Performance: Disable .htaccess

I'm currently running Nginx by way of Centmin Mod LEMP.

3) Add expires headers (leverage browser caching).

See: Leverage browser caching | GTmetrix

4) Enable gzip compression.

See: Enable gzip compression | GTmetrix

5) Utilize front-end caching.

See: Defining a Cache | XenForo

I use Zend OpCache for opcode caching (comes with PHP 5.5 or higher)

6) Utilize back-end caching.

See: Defining a Cache | XenForo

I use Redis cache: https://xenforo.com/community/resour...is-cache.3965/

7) Consider utilizing page caching for guests

Caching pages for guests may help performance if a lot of your traffic is guest traffic. There are different ways to cache pages for guests depending on your setup:

[bd] Cache: https://xenforo.com/community/resources/bd-cache.2763/

DragonByte Optimise: https://xenforo.com/community/resour...optimise.5300/

Nginx fastcgi_cache: https://xenforo.com/community/resou...x-fastcgi_cache-full-page-guest-caching.5393/

LiteSpeed cache: https://xenforo.com/community/resour...ommunity.5047/

Cloudflare "Bypass Cache on Cookie" (Business and Enterprise plans only, $$$): https://blog.cloudflare.com/caching-...us-page-views/

Varnish cache: https://varnish-cache.org/

8) Tune MySQL (or MariaDB or Percona).

See: http://www.jeffwidman.com/blog/798/m...wordpress-vps/

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

9) 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.

10) Disable unnecessary features and addons, especially if test sites such as Webpagetest.org show that they are slowing your page.

11) Enable Minify CSS (under Options > Performance)

The exception to this would be if you are already using something else to minify CSS, eg, [bd] Cache or DragonByte Optimise combined with either Pagespeed module or Cloudflare .

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

See: https://xenforo.com/community/thread...-source.10177/

I use Google as my jQuery source. It isn't the fastest in my testing, but it's likely that visitors will already have it cached.

13) 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.

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

In particular, try to avoid ads that block page render.

15) 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.

See: https://xenforo.com/community/resour...th-a-cdn.4420/

You can use Webpagetest.org to test site performance from different geographic regions.

There are a couple addons which allow you to put your attachments on CDN:

[Tinhte] Image Attachment Optimization & CDN Support: https://xenforo.com/community/resour...n-support.909/

[bd] Attachment Store: https://xenforo.com/community/resour...nt-store.1779/

Keep in mind that there is some risk involved if you use the [bd] addon to move your attachments to a new location. You become dependent on the developer to continue timely support. The Tinhte addon leaves your files in place and rewrites their URLs.

Currently, I use the Tinhte addon to serve image attachments via KeyCDN.

Cloudflare will automatically serve attachments via CDN without needing either of the above two addons. Just use a custom page rule to cache the attachments in their edge servers. Here is the one I used when my sites were on Cloudflare:


Putting Xenforo CSS on a CDN requires either [bd] Cache or DragonByte Optimise to convert CSS to file or the use of a Cloudflare custom pagerule to cache css.php*.

16) 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 three addons that can do this for you:

Defer JS: https://xenforo.com/community/resources/defer-js.2972/

[bd] Cache: https://xenforo.com/community/resources/bd-cache.2763/

DragonByte Optimise: https://xenforo.com/community/resour...optimise.5300/

If you want to make sure that a particular javascript isn't called until after the page loads, you can use the method described here: https://varvy.com/pagespeed/defer-lo...avascript.html

I use the Defer JS addon to defer javascript.

17) Optimize image attachments and avatars on your server.

There are a couple addons which do this:

[Nobita] Image Optimizer: https://xenforo.com/community/resour...ptimizer.5317/

GoodForNothing Image Optimizer: https://xenforo.com/community/resour...ptimizer.3987/

Tip: Make sure you have good backups of your attachments before using any image optimizer.

18) Consider using an image delivery system which optimizes images further.

One easy option is to use Cloudflare (Pro or higher tier) which has built in image optimization functions (Polish and Mirage). Polish now includes the option to automatically convert images to webp for browsers which support that.

If you use the Tinhte or [bd] addons mentioned above to put attachments on CDN, you can use one of the CDNs that do additional image optimization (resizing, webp conversion, etc). There are a number of companies which do this, including Cloudinary, Imgix, Imagefly, and others.

One of these, ImageEngine by ScientiaMobile, resizes and optimizes images based on detection of the visitor's device. Some of the others claim to do the same thing, but they require a lot more configuration including modifications to your Xenforo setup. ImageEngine works right out of the box. Very simple setup if you use it with the Tinhte addon.

19) Try mod_pagespeed if you use Apache or ngx_pagespeed if you use Nginx.

The Pagespeed module can do many different optimizations for html, css, javascript, and images.

See: https://developers.google.com/speed/.../module/?hl=en

Pagespeed is a very effective way to resize images for mobile. Unlike ImageEngine it requires multiple page loads to optimize resources for mobile, but once it does so, the results are dramatic.

With Pagespeed: https://www.webpagetest.org/result/170102_WJ_1YY/

Without Pagespeed: https://www.webpagetest.org/result/170102_X7_1YW/

20) Try lazy loading images.

This can be done with Pagespeed module and [bd] Attachment Store together, or you can use this addon instead:

https://xenforo.com/community/resour...load-img.3979/

21) Offload attachment file serving.

You can do this using [bd] Attachment Store. Or if you use Nginx, then this addon provides another option using Nginx's X-Accel-Redirect:

https://xenforo.com/community/resour...s-by-xon.5042/

22) If possible, use http/2.

See: http://royal.pingdom.com/2015/06/11/http2-new-protocol/

23) If possible, use PHP7

See: http://www.zend.com/en/resources/php-7

24) Leave automatic serialization off unless you use an addon that requires it.



Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

Note that you will need to clear your cache after changing this setting!

See: http://framework.zend.com/manual/1.1...frontends.html

25) Consider adding preload hints for web fonts (if you use them)

See: https://www.bramstein.com/writing/pr...web-fonts.html

As always, make sure you test. Preloading web fonts may help or hinder performance depending on the rest of your setup.

See also:
https://www.smashingmagazine.com/201...s-it-good-for/
https://www.zachleat.com/web/preload/

I use the following after the <head> tag in PAGE_CONTAINER to preload Lato and Font Awesome on my sites. Has definitely improved performance.


Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

Some sites you can use to test site performance:
http://www.webpagetest.org/
https://gtmetrix.com/
http://tools.pingdom.com/fpt/
https://developers.google.com/speed/pagespeed/insights/

Keep in mind that the letter scores you get from those sites aren't necessarily reflective of real-world speed.

[Source]: İçerik Kaynağı

Views: 189
Reply With Quote
Reply

Thread Tools

Şunları Yapabilirsin
Yeni Konu Açmak
Konuya Cevap Yazmak
Eklenti Eklemek
Düzenleme Yapabilmek

Forum Atla


LD'de Yeni misin? Yardıma mı ihtiyacın var?

All times are GMT +3. The time now is 11:05.

Tasarım Özelliği | Genişlik: Geniş Renk: Speed up XenForo site Speed up XenForo site Speed up XenForo site Speed up XenForo site Speed up XenForo site