Mezzio + Swoole
summary
Combining Mezzio PSR-15 middleware with Swoole coroutines and task workers keeps the app bootstrapped in memory so APIs return faster, for example spawning a coroutine to send an email immediately returns a response while the mail sends in background, and Swoole clients claim benchmarks like 10,000 MySQL reads in ~0.2s. The build uses delegator/factory wrappers to reinstantiate timed‑out DB/ODM connections, relies on stateless services (no sessions), and requires provisioning enough workers because each worker handles one request and the manager respawns crashed workers.
AI-written summary · about
chapters (20)
- 0:00Introduction
- 1:56Why APIs need to be fast and modern demands
- 3:45Mezzio and its architecture
- 5:34Middleware in Mezzio
- 8:50Middleware reuse and attributes
- 13:48Swoole and its advantages
- 15:56Swoole request handling
- 17:22HTTP servers with Swoole
- 18:04Swoole coroutines and concurrency
- 20:37Mezzio + Swoole
- 21:40Offloading with coroutines
- 23:08Long-running tasks with workers
- 24:54Task management with delegators
- 25:59Cron jobs with Swoole
- 28:46Cron execution and events
- 29:51Swoole challenges
- 32:21Stateful services and timeouts
- 33:44Reliable DB connections
- 34:28Resources and documentation
- 35:15Q&A
related talks
54mSwoole: Issues and Production Use
35mSpeed up web APIs with Expressive and Swoole
48mBuilding Really Fast Applications
25mAsync PHP with Coroutines: Building Scalable Applications
38mBuilding Server Applications with Swoole
29mPanel Discussion
50mFault tolerant workflow orchestration on PHP
30mTim Macdonald :: Thoughtful Performance
