Long running PHP processes
summary
Long-running PHP CLI workers consume queues for hours and need supervision, graceful shutdown and restart-on-bounds rather than ad hoc screen processes. Use supervisord or systemd, catch SIGTERM with pcntl signal dispatch, poll with a 20s timeout so restarts finish between iterations, and restart when memory_get_usage(true) exceeds limits (typical per-worker 64–128 MB). Monitor with ps and New Relic, scale by running many short-lived PHP processes rather than making one monolith.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 3:03Examples
- 4:19Essential characteristic
- 5:08Limitations
- 6:35PHP Developer
- 8:17PHP Process Structure
- 11:01Supervision
- 14:39Stop
- 18:30Memory
- 21:01Global State
- 23:20bottlenecks
- 28:26tools
- 33:37conclusions
related talks
36mMemory Leaks in PHP: Detection, Prevention, Tooling
50mFault tolerant workflow orchestration on PHP
33mRunning PHP-Applications in a Multi-Process Container
31mFrom Runtime to Resilience: Scaling PHP
29mPanel Discussion
22mPHP Workers with systemd and Symfony Messenger
42mKubernetes for PHP developers
25mAsync PHP with Coroutines: Building Scalable Applications
