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
 
My experience is that forum users generally do not care about new features. They mostly care that posting messages and DMs work. ie that they can post text and images and have discussions about them.

Not for our community. Members need performance, new features and stable forum experience. Of course these are our experiences.
 
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.
This is pretty much the same we have been monitoring for some time. They load javascript since they flood Google Analytics, with 0.1s session durations and so on. Cloudflare does a pretty good job but things get more complicated depending how international your forum is. Cloudflare still leaks sometimes and usually from the US.

Limiting search is just one of the mitigation efforts and based on our experience turning it off for guests barely limits the bot swarms but can help keep the site up.

In addition to this update I strongly recommend having a WAF. Even the Cloudflare free plan is good enough (for most sites). Blocking IP-blocks is useless. This isn't your grandfather's internet anymore.
 
My experience is that forum users generally do not care about new features. They mostly care that posting messages and DMs work. ie that they can post text and images and have discussions about them.
I agree, especially in recent times. People posting on smart devices in particular don't want a screen full of clutter and most people don't use a fraction of the functions on offer regardless of device.
 
My experience is that forum users generally do not care about new features. They mostly care that posting messages and DMs work. ie that they can post text and images and have discussions about them.

Not for our community. Members need performance, new features and stable forum experience. Of course these are our experiences.
My experience tallies more with that of @Mr Lucky but I suspect a lot depends on your community/audience. My group is small and mostly about community. We have barely touched a lot of 2.2 and 2.3 features so are not in a hurry for more. A stable, working, secure community matters more than new features so I am more about stability releases like 2.3.14 than a feature-laden major upgrade. So I guess that I am saying that you're both right within the context of your communities. I am disappointed by the slow pace of 2.4 but not suffering from the lack of it. And 3.0 likely won't be happening on my site unless things pick up substantially there.
 
Last edited:
I'll take Friday or Sat/Sun over delaying further. Slower traffic on the weekend and we have some extra time to play with it :)
Thank Chris.
 

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.
So I am building something that touches all over core xf post time methods. I have been trying to stay to a dev pattern of matching xf style 1:1 and not duplicating any existing functionality outside of edge cases (like in a customized encryption engine) where even the potential of the core updating a method I use by extending core XF is too risky to not have entire control of chain of events or scope in my infra/arch. Is this going to be fully baked and ready for 2.3.14 or should I continue to use the workaround I hade made concerning this already?


I only ask because my versioning requires me to put the origin version of xf it was baked for as a prefix to my version base scope and because I haven't released it yet it is trivial to push the internal versioning I use to 2.3.14.74 rather than running up the flec point up for the next version I am going to cook off in a matter of hours here. I will do the switch over gracefully if it works as a replacement for my workaround otherwise I will release it under the 2.3.13.x chain since it would truly be built on 2.3.13 and run lifecycle from: last updates ({xf}.{flec}) 2.3.13.x -> X-final like: 2.3.13.74.2.6.3.101-final but it would obviously for human reasons have a different readable name associated with it and that extended version logic expressed after {official_Name}:(version_String). I know this sounds pedantic but it's the only way to keep track off all the individual and sometimes overlapping network of things I am doing at the moment and this would help me before I start uploading addons to establish a best practices and hard guidelines outline to discipline myself with before putting a chain of resource up here. I only ask because it's fresh in my mind and I solved for this when I needed to extend XF regarding some obscure thing that doesn't matter at this site and including my own custom CSRF method or not seems worthy of the ask (since this particular portion of the addon hits the ui side of things where people can actually post and not some obscure backend or gated tool of some sort.)
 
Yes, the link-post click handler will be available in XenForo 2.3.14. Whether it is a suitable replacement for your existing workaround depends on what your workaround actually does.
 
Yes, the link-post click handler will be available in XenForo 2.3.14. Whether it is a suitable replacement for your existing workaround depends on what your workaround actually does.
Fair, it's marinated pretty deep for my purposes but could use a core xf extended method as it originally did as a one line change so that tracks. I am just hoping there is enough parity where I could lock the file to a .null extension in case an update ever happens that breaks the architecture of what I am doing where it touches user interactions (because it also hits the acp and has it's own api/cli/daemon stuff that auths constantly for updated ttl bundles for transactional metering and logging/fingerprinting though this all actually work extending core originally and still technically does if I want to use it, hence the question).


thanks, for quick ups.
 
It would be very beneficial for us—and even more so for you (as you would gain significantly from a large number of renewed licenses)—if you offered a discount on renewals for Black Friday. Given that the updates you release are practically non-existent, or at the very least not significant enough to justify a $75 renewal fee, it’s a hard sell.
Personally, I have two licenses that I haven’t renewed for years, and honestly, if this is the level of updates provided, I’ll continue to skip them.
I already know the standard response—that you don’t offer discounts—but I have to wonder: how can you be indifferent to the fact that hundreds, if not thousands, of users are choosing not to renew, resulting in a massive financial loss for you?
 
It would be very beneficial for us—and even more so for you (as you would gain significantly from a large number of renewed licenses)—if you offered a discount on renewals for Black Friday. Given that the updates you release are practically non-existent, or at the very least not significant enough to justify a $75 renewal fee, it’s a hard sell.
Personally, I have two licenses that I haven’t renewed for years, and honestly, if this is the level of updates provided, I’ll continue to skip them.
I already know the standard response—that you don’t offer discounts—but I have to wonder: how can you be indifferent to the fact that hundreds, if not thousands, of users are choosing not to renew, resulting in a massive financial loss for you?
Do what i do. Split them up. Get the main one renewed. Then maybe in a month's time get the next biggest one renewd.
 
I have to wonder: how can you be indifferent to the fact that hundreds, if not thousands, of users are choosing not to renew, resulting in a massive financial loss for you?
Because that isn't accurate.

You're correct. We don't routinely offer discounts. We sometimes do, but they are rarely tied to any specific seasonal event.
 
Back
Top Bottom