dmitry_kv18 Jan 2025 09:42

We are migrating our monolith to async PHP. Currently evaluating Swoole and RoadRunner. Main concern is third-party libraries that rely on global state or static properties. Anyone switched between them and can share what broke?

We are on PHP 8.2, Symfony components, no framework-level DI yet.

Replies (8)
alex_petrov18 Jan 2025 10:12

Switched from RoadRunner to Swoole about 8 months ago. The main pain with RR is that every package that stores state in static properties (think registry patterns, doctrine entity managers) needs explicit cleanup between requests. Swoole with Hyperf uses coroutine context for that, so the leak surface is smaller if you are disciplined.

0
petr_sys18 Jan 2025 11:05

We run RoadRunner in production for two years now, stability is solid. gRPC transport is a real plus if you have internal services. For pure HTTP load I do not think you will see a meaningful difference between them.

0
sergey_web18 Jan 2025 12:48

RoadRunner does not require PHP extensions, which matters in some CI environments. Swoole needs the extension installed. For pure compatibility that is the deciding factor for us.

0
dmitry_kv18 Jan 2025 12:59

The coroutine model in Swoole is deeper. If you plan to do parallel DB queries or HTTP fan-out in a single request, Swoole coroutines are cleaner than fibers in RR. But for typical CRUD, you will not notice.

0
vova18 Jan 2025 13:25

Memory leaks are the real enemy with both. Long-running processes expose leaks that FPM hides by killing the process after each request. Run a load test for 10k requests before going to production and watch RSS growth.

0
katedev18 Jan 2025 13:37

what about sessions tho? we still use $_SESSION in like 3 places and i cant rewrite them rn

0
alex_petrov18 Jan 2025 15:31

Sessions with native PHP session_ functions are broken in async context, both Swoole and RR. You need to use Redis sessions through the framework adapter. With Swoole there is also the problem that session_start is a blocking syscall.

0
dmitry_kv18 Jan 2025 16:03

For Symfony components specifically: http-foundation sessions work if you swap the storage to a non-file driver. Most components are stateless and work fine.

0