crazy-goat/workerman-bundle
Symfony bundle integrating Workerman to run a high-performance async HTTP server, scheduler and supervisor in pure PHP. Keeps the Symfony kernel/container alive between requests for faster apps. Supports SO_REUSEPORT and optional direct Request creation for speed.
GRPC_ENABLE_FORK_SUPPORT=1 if using gRPC extensions (risk of deadlocks).reload_strategy.memory to avoid leaks.php-inotify extension recommended for efficient file_monitor reloads (polling mode is CPU-intensive).CAP_NET_BIND_SERVICE (mitigate with reverse proxies like Nginx).trusted_hosts may expose the app to HTTP host header attacks.Request creation (bypassing PSR-7) is experimental; validate stability in production.SO_REUSEPORT requires Linux kernel support (not portable to Windows).workerman:server connections output suffice for debugging, or are custom metrics needed?php-event (recommended for performance), php-inotify (for efficient file monitoring).grpc (if used, requires GRPC_ENABLE_FORK_SUPPORT=1).SO_REUSEPORT and posix_kill() (for connection introspection) are POSIX-only.StaticFilesMiddleware (though Nginx is still better for high-throughput static assets).| Phase | Action | Risk | Mitigation |
|---|---|---|---|
| Evaluation | Benchmark Workerman vs. FPM for target workload (e.g., RPS, latency). | Performance misalignment. | Use workerman:server connections to monitor metrics. |
| Pilot | Deploy a non-critical endpoint (e.g., /health) with Workerman. |
Partial failure. | Keep FPM as fallback; use feature flags. |
| Middleware Refactor | Replace Symfony HTTP kernels with Workerman middlewares. | Breaking changes in request/response handling. | Test with StaticFilesMiddleware first. |
| Scheduler Migration | Move Cron jobs to Workerman’s scheduler (attribute-based or YAML). | Job timing discrepancies. | Test with PT1M (1-minute) intervals. |
| Static Files | Migrate static assets to StaticFilesMiddleware or keep Nginx. |
Performance regression. | Benchmark both; prefer Nginx for high traffic. |
| Full Cutover | Replace FPM with Workerman for all endpoints. | Downtime or errors. | Use blue-green deployment. |
KernelInterface middleware with MiddlewareInterface (see execution order).PDO::ATTR_PERSISTENT disabled).register_shutdown_function() with Workerman’s event hooks.php-event, php-inotify).WorkermanBundle to bundles.php.workerman.yaml (e.g., listen, processes).reload_strategy (e.g., file_monitor for dev, memory for prod).StaticFilesMiddleware.wrk or k6 to compare FPM vs. Workerman.workerman:server connections).-d) and monitor logs (stdout_file).workerman:server restart -g for zero-downtime updates.workerman.yaml (e.g., ports, processes, reload strategies).bin/console config:dump-reference workerman to document options.var/log/workerman.log and var/log/workerman.stdout.log.workerman:server connections.How can I help you explore Laravel packages today?