I have a job that chunks data from the database and then queues up between 10000 to 20000 emails.
I have only two processes running but during the time we are processing all these emails our cpu usage spikes to around 50%. During times when we have no jobs our cpu usage sits at 0%
supervisord.conf
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/user/www/production/artisan queue:work database --queue=high,default,low --sleep=3 --tries=3
user=user
autostart=true
autorestart=true
redirect_stderr=true
numprocs=2
I've looked at a few other posts talking about this but most of them are dealing with issues from older versions of laravel.
How can I reduce the cpu usage and is there an easy way for me to debug this?