title: Laravel Artisan Queues - high cpu usage
body: <p>I have set up queues in Laravel for my processing scripts.
  I am using beanstalkd and supervisord.
  There are 6 different tubes for different types of processing.</p>
  
  <p>The issue is that for each tube, artisan is constantly spawning workers every second.
  The worker code seems to sleep for 1 second and then the worker thread uses 7-15% cpu, multiply this by 6 tubes... and I would like to have multiple workers per tube.. my cpu is being eaten up.</p>
  
  <p>I tried changing the 1 second sleep to 10 seconds.
  This helps but there is still a huge cpu spike every 10 seconds when the workers wake back up.
  I am not even processing anything at this time because the queues are completely empty, it is simply the workers looking for something to do.</p>
  
  <p>I also tested to see the cpu usage of laravel when I refreshed the page in a brower and that was hovering around 10%.. I am on a low end rackspace instance right now so that could explain it but still... it seems like the workers spin up a laravel instance every time they wake up.</p>
  
  <p>Is there no way to solve this? Do I just have to put a lot of money into a more expensive server just to be able to listen to see if a job is ready?</p>
  
  <p>EDIT:</p>
  
  <p>Found a solution... it was to NOT use the artisan queue:listener or queue:work
  I looked into the queue code and there doesn't seem to be a way around this issue, it requires laravel to load every time a worker checks for more work to do.</p>
  
  <p>Instead I wrote my own listener using pheanstalk.
  I am still using laravel to push things into the queue, then my custom listener is parsing the queue data and then triggering an artisan command to run.</p>
  
  <p>Now my cpu usage for my listeners is under %0, the only time my cpu shoots up now is when it actually finds work to do and then triggers the command, I am fine with that.</p>