Laravel Advanced & Architecture
8-10 Years (Tech Lead)
Hard
Production Scenario
How do you handle graceful worker restarts in Kubernetes / Docker for Laravel Queues and Octane?
Real-World Scenario / Incident Description
During Kubernetes rolling deployments, pods received `SIGTERM` and immediately died, terminating active payment processing jobs mid-flight and corrupting order status.
95 views
•
Updated 1 month ago
Graceful Termination Workflow
- Catch
SIGTERMin worker: In Kubernetes, setterminationGracePeriodSeconds: 120. - Supervisor Configuration: Set
stopwaitsecs = 120so Supervisor gives workers up to 2 minutes to finish processing current job before force killing (SIGKILL). - Queue Worker Command:
php artisan queue:work --stop-when-empty --max-time=3600 --timeout=90
Related Concepts:
#Kubernetes
#Docker
#Graceful Shutdown
#SIGTERM
#DevOps
More Laravel Advanced & Architecture Interview Questions
How does Laravel Octane handle state persistence across requests, and how do you prevent catastrophic memory leaks and data bleeding in singletons?
Read →
How do you prevent Deadlocks when processing concurrent financial transactions or inventory deductions across multiple queue workers in Laravel?
Read →
How does the Laravel Service Container resolve dependencies using Reflection, and what are the performance trade-offs in large applications?
Read →
How do you execute Zero-Downtime database migrations on tables with 50+ million rows without locking writes in production Laravel?
Read →
How do you architect Multi-Tenant database isolation in Laravel (Single DB vs Multi DB vs Schema Separation)?
Read →