Stack Matrix Hub (9)
Symfony Messenger Async Consumers for Sylius Emails & Webhooks
Move order confirmation emails, ERP webhooks, and catalog syncs off checkout HTTP threads into bounded Redis-backed Messenger daemons.
145-195 MB/consumer · --memory-limit=192M · Checkout P95 < 140 ms
Why Synchronous SMTP & ERP Calls Starve Checkout Pools
When a flash sale triggers 40 checkouts per second, sending Twig-rendered order emails or calling external ERP webhooks synchronously holds PHP-FPM or FrankenPHP worker threads open for 400 to 1,800 ms per order. Routing SendEmailMessage and UpdateProductMessage to Redis streams keeps web threads sub-140 ms.
Enforcing --memory-limit and --time-limit on Long-Lived Consumers
Always run messenger:consume async with --time-limit=3600 and --memory-limit=192M under systemd or Supervisor. Add doctrine_close_connection and doctrine_clear_entity_manager middleware so accumulated entities never trigger Linux OOM kills.
Measured Thresholds & Configuration
| Queue Profile | Recommended Consumers | Memory Limit Flag | Total Async RAM Budget |
|---|---|---|---|
| 10k SKU Store (< 200 orders/hr) | 2 async workers | --memory-limit=160M | 320 MB |
| 50k SKU Store (200-1,000 orders/hr) | 3 - 4 async workers | --memory-limit=192M | 576 - 768 MB |
| 100k+ B2B ERP + Catalog Sync | 4 - 6 async workers | --memory-limit=224M | 896 - 1,344 MB |