XF 2.3 Performance improvements in XenForo 2.3.14

XenForo 2.3.14 is being released, all being well, next week.

In addition to the usual bug fixes and stability improvements, this upgrade also has a focus on performance. For quite some time we have all been dealing with what feels like a never ending influx of residential proxy bot swarms, DDoS attacks, aggressive crawlers (both AI and traditional) and scrapers.

Each time a request hits XenForo, the cost of this is a PHP worker connection, a database connection, CPU and memory, and unless your server is over-specced (they usually aren't) you have a finite pool of resources that real members are fighting for.

One of the biggest problems at the moment is automated traffic using residential proxy networks. This gives bad actors an upper-hand as the traffic often appears to be genuine, and human. You could ban an entire CIDR/AS Number that is being used for malicious purposes today, only to find that tomorrow those questionable IP addresses now belong to real users who cannot access your site.

Traditional detections and mitigations based on IP address alone are no longer effective. Attacks can send an extreme amount of volume and cause disruption with tens of thousands of IP addresses doing only one or two requests each.

In our recent experience, even Cloudflare and their premium mitigations for this, Cloudflare Superbot Fight Mode, are not always able to distinguish genuine human traffic from automation, and on their own, at least with default configurations, they are not enough. They are useful tools; if you're able to (or someone can on your behalf) dedicate hours per day towards monitoring your logs, detecting new patterns, writing rules to present challenges, while also trying to minimise the disruption to real humans, you're in a lucky position. But things move fast and it's difficult to stay on top for long, so we, as-in XenForo, now has to start looking inward at what we can do to lessen the impact and cost of some of these requests.

And that's what XenForo 2.3.14 is starting to do.

whats-new performance improvements​

Each guest visiting any whats-new page, including /posts, /profile-posts, /media, /resources now gets a single, shared, cached result that is returned from the root URL rather than returning a page generated from a specific numbered record. Every guest gets the same set of results and, if enabled, the HTML for those results is returned directly from the page cache. Care is also taken to ensure that under heavy concurrent traffic, there isn't a "cache stampede" effect when rebuilding the cached results. The cache records are now saved with the time the result was saved rather than from when the request started so that cached results are valid for longer when a site is under load and the stale cache records start taking longer to generate. "New profile posts" is also now constrained by the read marking data lifetime so less work is done to display this set of results.

Image proxy and oEmbed improvements​

Concurrent requests for the same image proxy or oEmbed record can no longer happen. If available, users are served the stale cache result until the new cached result is available, rather than multiple requests happening for the same resource concurrently.

oEmbed requests are now signed as previously oembed.php could fetch and store records for media that was not being shown on the page.

And the responses of image proxy and oembed requests can now be cached by browsers and CDNs more easily.

POST submission links now hardened​

Some URLs within XenForo, particularly the style, style variation, language and cookie consent URLs were previously GET requests with a unique CSRF token embedded within. On XenForo Cloud we see crawlers and bots following misc/style-varation links at a rate of over 10 million requests per-week, and similar volumes for the other URLs. Originally destined for XenForo 2.4, there is a new click handler you can opt into named link-post which submits a standard looking link as a POST request.

Limits on concurrent guest searches​

The number of searches that can be triggered by logged out users collectively is now constrained to a maximum of 4 concurrent requests at a time. Guests were triggering searches at a volume of 40 million requests per-week on XenForo Cloud. At that volume, searches were often causing PHP workers to become saturated and impact normal users.

Starting with XenForo 2.3.14, new installs will have guest searching disabled (via permissions) by default. Existing installations are not affected. However, we do still generally recommend disabling guest searching if it is not a relevant feature for your community.

"About" tab optimisations​

The way that the following and followers lists are generated for a member's "About" tab has changed to avoid using MySQL's RAND() function. This tab was expensive to run in some cases and was often being abused as such.

Better indexing for user-based searches for MySQL​

Some search requests that do not rely on keywords ("Recent content" and "Find all content by user") are now optimised to benefit from existing table indexes with PHP taking over some of the work to avoid full table scans for these specific searches.

Attachment caching​

Full-sized attachments are now cached for up to one-hour, previously not being cached at all. We were also touching the file-system or remote object storage for every attachment request to check for existence, even if it was going to be served from the cache anyway. Particularly for remote storage, this results in fewer existence checks which added time to those requests.

Guest page cache can now cache permanent redirects​

Previously, the guest page cache was only able to store and serve HTML and cached resulting from a successful HTTP code 200 request. In 2.3.14 we have now extended this to permanent redirects. This will apply to posts/<n> style links and goto/post/<n> style links which are computationally expensive as they have to find the thread, forum, specific page and generate the full URL before redirecting. These requests now store the original URL and its intended target so that the redirect can take place immediately without doing the additional work. On XenForo Cloud, hits to the common redirect routes were averaging over 15 million per week.

All of these changes are live now on XenForo community. Please open a bug report if you find anything that doesn't seem right when browsing as a guest.

If you are struggling with bots we highly recommend upgrading to XenForo 2.3.14 upon its release and continue to provide feedback on the types of traffic pressure you are seeing across the software. These changes are a good start but we do not view this game of whack-a-mole as being over by a long chalk. There'll always be more to do!

xenforo_performance_imrpovements_2_3_14.webp
 

whats-new performance improvements​

Each guest visiting any whats-new page, including /posts, /profile-posts, /media, /resources now gets a single, shared, cached result that is returned from the root URL rather than returning a page generated from a specific numbered record. Every guest gets the same set of results and, if enabled, the HTML for those results is returned directly from the page cache

Will this include /threads and /goto please? When I stopped them going to whats-new they started going direct to /threads and /goto although could only use links they had already scraped before.

misc-cookies gets loads of hits as well.
 
Just so I fully understand, we all think these bots are scraping (presumably for AI training), right? That means following internal links?

There's a lot of focus on search but is search the problem?
 
Just took a look on the Wayback Machine to compare and I've got x200 more guests than this time just over a year ago, so some performance improvement will be very welcome, thank you.
 
Certainly still aiming for this week but there is some other work that has come up related to the release that we are also preparing for.
The puppy is in the box ...

I worked for a SaaS company and I told people the closer to release, the higher the probability that something would delay it. So we wouldn't make exact predictions. But, like when you buy a puppy for your kids on Christmas, you can't wrap it up and put it under the tree two weeks before. No one wants a dead puppy. The puppy is still at the pet store. Then you get the puppy a couple days early, and the puppy is at the neighbor's. But right before you open the present, you get the puppy and put it in the box, and then let your kid open it. So for a really close release, the best we could tell them was the "puppy is in the box."
 
Think of it as one of your bills you need to pay for. This type of forum is not for free.

Honestly, when you pay that much money, you expect more significant improvements. Apart from this update—which follows the release of XenForo 2.3—and the 2.3.10 update, there haven’t been any noteworthy feature enhancements; it has felt as though the license fees paid over the last two years have gone to waste. I truly hope that the use of artificial intelligence will accelerate the development process, allowing us to feel that the money we’ve spent is finally justified.

I’m not sure how active your forum is, but forum users generally love new features—and the cost of purchasing third-party add-ons really takes a toll on one’s budget. We currently use over 100 add-ons, and the annual cost ends up being far higher than you might imagine. Our greatest wish is for some of these basic features to be integrated natively into XenForo.
 
Just so I fully understand, we all think these bots are scraping (presumably for AI training), right? That means following internal links?

There's a lot of focus on search but is search the problem?
From what I see on my end its almost all some sort of automated bots using residential and commercial proxies - the hardest ones to detect are in the US, but a key hallmark is that they will go to a page, not download any images, but potentially render the JavaScript, and then perform no human actions like even scrolling the page. Some of them will have impossible headers (example would be Safari on a version of iOS that never supported it) or other telling factors like a box monitor with 64+ CPU cores or Mandarin lettering in the headers. So they are detectable, just very few places are seeing how to do the detection including Cloudflare. reCAPTCHA actually does a good job of detecting it now better than Turnstile but not 100% perfect. What the purpose of the bot is could be anything. These could be infected systems on bot nets and/or credential scrapers/harvesters/or covert AI training from Chinese labs.
 
Back
Top Bottom