Theory
Theory

Reputation: 65

Laravel cron job running every minute doubles mysql connections

I'm running a cron job on a direct admin server that runs every minute and every minute the connections/processes almost triples to about 90 from about 30. They die right away and they drop back down to about 30.

https://laravel.com/docs/5.8/scheduling#scheduling-queued-jobs

I'm using the scheduler cron job

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

What would be creating all these connections?

I also have a problem when restarting the queue with php artisan queue:restart. A sleeping process starts that lasts forever, crashing the server eventually so I have to manually kill it.

edit here's a screenshot

Connections

Upvotes: 3

Views: 1220

Answers (1)

yk.
yk.

Reputation: 26

I think your job is having error. Try php artisan [your job command]. Check if it is running fine. Besides, don't you have a cron table to record your job status?

Upvotes: 0

Related Questions