Speeding up site on Windows Server 2019

NealC

Well-known member
My site seems slow, not sure what to change. I have the IIS response headers to cache the styles and data folder for 3 days, not sure it's working though as page loads seem slow. I don't know if XF 2.x is defeating the cache, or what. PHP has zend_opcache enabled.

What can I do to improve performance of XF 2 on Windows Server? PHP 7.latest and MySQL is on a separate server.

 

Kirby

Well-known member
  • TTFB seems a bit slow
    Try to find out why (enable Debug mode, take a look at queries & page creation time)
  • Increase the cache time for styles, js, data
    There normally isn't a reason to cache this just for 3 days; usually we cache this for a year as all standard resources do have a cache buster (query string) anyway
  • Optimize images (if possible)
  • Make sure SVGs do get compressed
  • Reconsider if you really want to/must use Google fonts as fonts are render blocking
  • Reconsider if you really need 3 trackers (Google Analytics, Facebook and Bing)
  • Turn off the editor for guests, that does slows thing down significantly and from my erperience isn't use often anyway
  • Load jQuery locally
 
Last edited:

dknife

Well-known member
Turn off the editor for guests, that does slow thing down significantly and in my erperience isn't use often anyway
If guests aren't allowed to post, does it still load the editor at all? Is this recommendation related to the Admin option "Allow guests to use the rich text editor"?
 

Kirby

Well-known member
If guests aren't allowed to post, does it still load the editor at all?
If the option mentioned below and "Writing before registering" is active and one of the configured usergroups can post: Yes.

Is this recommendation related to the Admin option "Allow guests to use the rich text editor"?
Yep, this is exactly the option I was referring to - turn that off.

 
Last edited:

NealC

Well-known member
I ended up bringing up an Ubuntu 20.04 server which was a good experience for me being new to Linux. The site is amazingly faster but probably mainly due to the much better caching working on ubuntu apache vs IIS (probably something I wasn't doing right). With caching of images css etc. and also redis (thanks @Xon) my XF sites are screaming fast.
 
  • Like
Reactions: Xon

Kirby

Well-known member
With caching of images css etc. and also redis (thanks @Xon) my XF sites are screaming fast.
I actually wouldn't call this screaming fast but rather "still a lot to do" ;)

https://www.webpagetest.org/result/210918_BiDcZF_02cc667290e24d9f9a7ce8923fb03dd6
1631970505319.png

Things I would do
  • Fix caching
  • Get rid of Google Fonts
  • Get rid of Bing and Facebook tracking pixels
  • Deliver static resouces (JS/CSS) with Brotli instang of GZip (if supported by browser)
  • Optimize Image/Deliver public images as webp (if supported by browser)
  • Load jQuery locally
 
Last edited:

NealC

Well-known member
Thank you @Kirby - there is still work to do. It is faster than before and I appreciate the homework so I can continue to improve things. I'll get to work on the above soon.
 

m1ne

Well-known member
I ended up bringing up an Ubuntu 20.04 server which was a good experience for me being new to Linux. The site is amazingly faster but probably mainly due to the much better caching working on ubuntu apache vs IIS (probably something I wasn't doing right). With caching of images css etc. and also redis (thanks @Xon) my XF sites are screaming fast.

Windows definitely not ideal for hosting, for sure.
You'll see even more performance gains if you use OpenLiteSpeed/Litespeed.
 

NealC

Well-known member
I would appreciate anyone sharing their caching strategy in their .htaccess, or whever you have it for images, js, css, etc. Can you share your cache code?

Thanks
 

Kirby

Well-known member
I'd recommended to not use Apache at all and if you have to use Apache I'd try to disable .htaccess.

If you have to use Apache and you do not have special requirements smth. like

Code:
<LocationMatch "^/(js|styles|data)/">
Header set Cache-Control "max-age=31536000, public"
Header unset Last-Modified
Header unset ETag
FileETag None
</LocationMatch>
should work.

Otherwise just searching for "Apache Cache-Control" in your favourite search engine should bring up dozens of websites explaining how to configure caching.
 

NealC

Well-known member
What do you suggest @Kirby instead of Apache? This server is temporary, a newer fast one is coming online soon so I'll be doing this all over again. Linux (ubuntu) primary for XF sites.
 

Kirby

Well-known member
We use nginx, but (Open)LiteSpeed is popular as well and usally beats nginx in terms of performance.

So if you don't need all the bells and whistles that would be possible with nginx, take a look at (Open)LiteSpeed.
 
Top