Related posts
- Centrifugo at forum scale, loopback only
My setup script now installs Centrifugo, the realtime server my XenForo add-on uses for live posts, typing and presence. It is a verified release binary on loopback, in a unit that scores 1.1 in systemd-analyze, behind one exact nginx location with small tunnel buffers. A load test to 10,000 sockets set the defaults, and a run to 50,000 showed why the old default was wrong.
- Removing HTTP/3 from nginx cost nothing
My setup script now builds nginx without HTTP/3, because every site sits behind Cloudflare, which talks to the origin over TCP anyway. The A/B against the previous release came out flat on every XenForo tier, and a slow drift in the test data was a reminder to only compare arms run side by side.
- Who compresses a logged-in XenForo page? 12 % of PHP, one fastcgi_param, and a clock that lied
Profiling the member pages of a XenForo forum showed zlib eating 12 % of PHP-FPM CPU: XenForo gzips its own pages at level 9 inside the worker. Moving that to Angie gave +5 % on the forum index and +9 % on thread pages. Along the way, a CPU turbo budget faked a 27 % speed-up, and three other ideas did not survive measurement.
When I added Centrifugo to my setup script, I left one question open. The gate for every change to the script is that no XenForo page tier loses requests per second or p99. That gate exists so a release can’t quietly make the forum slower. Centrifugo is different from a compiler flag or an nginx option, though. It’s a new opt-in service that runs next to the forum. So the question isn’t whether the code got slower; it’s what the forum gives up while thousands of member sockets are open on the same box.
This post answers the throughput half of that question, on the Xeon E-2236 test host. Page p99 with sockets open is still unmeasured.
The method#
loopback-tiers.sh, 100 connections, 10 s per tier): cached guest home and thread pages, and logged-in member home and thread pages.One thing shapes every number below. The load generator that holds the sockets ran on the same 12-thread box as nginx, PHP, MariaDB and Centrifugo. Its CPU time counts against the pages. A real forum’s sockets come from members’ browsers, not from a process on the server, so each drop below is an upper bound on what Centrifugo costs.
The realistic run: 4,000 sockets#
4,000 sockets is a normal peak for my largest boards, and 10,000 is about the most they reach. One socket is one open member tab; guests never connect. For the publish rate I used 5 thread and 5 personal publishes per second, ten messages a second.
Every message was delivered, at a p50 of 3 ms and a p99 of 12 ms.
So at a normal peak, the pages lost 1.5 to 3.7 % of their requests per second, and that includes the load generator’s own CPU. On this rig, that’s the most the feature cost a forum that uses it.
The stress run: 10,000 sockets#
To see where the box runs out, I repeated it at 10,000 sockets with the original load test’s publish rate: 100 thread and 20 personal publishes per second. With every thread publish fanned out to that channel’s subscribers, that’s about 50,000 WebSocket frames a second through nginx.
That’s a big drop, and it isn’t a regression. It’s twelve threads running nginx, PHP-FPM, MariaDB, Centrifugo and a load generator pushing 50,000 frames a second, all at once. The pages lose what the other work takes. On a host that doesn’t run
--centrifugo, nothing changes: the service is opt-in, and without it there is no unit, no nginx location and no booked memory.Why this passes the gate#
The gate asks whether a change makes the same work slower. Hosts without
--centrifugodon’t run the service at all, so for them nothing changes. On a host with it, the server is doing more work, and the right question is whether that cost is acceptable. At a realistic peak it’s under 4 % of requests per second with a pessimistic rig. At twelve times the realistic publish rate and 2.5 times the sockets, it’s about a third, which tells you where this box’s capacity is, not that something got worse. That covers throughput; whether page p99 holds with sockets open is the part I haven’t measured.What to plan for#
conns=autoplans 10,000, andconns=Nplans more. That number sizes file limits, nginx’s connection table and the memory booking.What I didn’t measure#
For a forum at its normal peak, live posts, typing and presence cost the pages under 4 % of their throughput on this rig. At a much higher publish rate with more sockets, the cost was about a third, so plan from your busiest threads and peak members online, not from the total member count.