News for hackers. Stuff that matters.

bencroker

Re:Blinksy on Saturday October 11, 2025 @03:50AM (#45547418)
Definitely something I want to explore! For this demo in particular, I wanted to stick with native PHP tooling and Redis (ubiquitous in the PHP ecosystem).

Have yet to look into making Mercure work with Datastar’s SSE events, have you done so?

Re:Blinksy on Friday October 10, 2025 @04:11PM (#45543260)
Agreed! I have a WIP article in which I describe in the setup in more detail. I’ll also include load testing benchmarks as part of it. The key to reaching high scale is keeping things simple, and there’s really very little that the app is doing. Swoole and Redis are doing the heavy lifting, and they’re both heavily optimised for scale out-of-the-box.
Re:Blinksy on Friday October 10, 2025 @03:06PM (#45542569)
My goal with this demo was to build a real-time, multiplayer app that can scale to thousands of concurrent, long-lived connections. Using PHP.

Laravel Octane keeps the bootstrapped app loaded in memory, which can scale to thousands of requests per second for the toggling of cells. A separate script starts a Swoole HTTP server to make async I/O work in PHP for serving long-lived SSE connections. The event stream is compressed using gzip by the web server (standard Nginx). The app uses Redis pub/sub for real-time messaging, and a Redis key-value store for state persistence. Rate limiting on the server helps prevent automated bots causing too much havoc.

Finally, reactivity is powered by Datastar with one event listener and one long-lived SSE connection to the backend.

It all runs on a €4 Hetzner VPS.