PostgreSQL vs MySQL Performance: Real Benchmarks Compared
Last updated: 7 November 2026. See the update log at the end."Which is faster, PostgreSQL or...
Step 7 of 10
Shared hosting has no Supervisor, and it stops long-running processes. So don't keep a worker running. Start one from cron, let it finish the queue, and let it exit.
Set QUEUE_CONNECTION=database in .env.
Make sure the jobs and failed_jobs tables exist. New Laravel installs create them with the default migrations.
Add the schedule below, and the cron job from the previous chapter.
Schedule::command('queue:work --stop-when-empty --tries=3 --max-time=50')
->everyMinute()
->withoutOverlapping(10);
--stop-when-empty exits once there is nothing left, so no process lingers.--max-time=50 stops after 50 seconds, so one run ends before the next one starts.--tries=3 gives up on a failing job after three attempts, and it goes to failed_jobs.withoutOverlapping(10) stops two workers running together. The lock expires after 10 minutes, in case a run was killed.If your cron runs every 5 minutes, use ->everyFiveMinutes(). Jobs then wait up to 5 minutes, which is fine for most emails.
Newsletters can use up your host's hourly email limit, and then password-reset emails fail too. Put bulk mail on its own queue, and process the important queue first:
queue:work --queue=default,newsletter --stop-when-empty --max-time=50
Each run would keep going forever. Cron would start another every minute, until you hit your process limit and see 508 errors.
Yes, QUEUE_CONNECTION=sync runs them during the request. It needs no cron, but visitors wait for slow jobs like emails.
Last updated: 7 November 2026. See the update log at the end."Which is faster, PostgreSQL or...
Last updated: 8 November 2026. See the update log at the end.Laravel gives you safe defaults...
Last updated: 5 November 2026. See the update log at the end.In a normal PHP-FPM request,...
We use cookies to improve your experience and analyze traffic. By continuing, you agree to our Privacy Policy.