Can you try adding a --sleep=1 to your queue:work command and see if that improves the memory consumption a little bit? https://laravel.com/docs/10.x/queues#worker-sleep-duration
High memory usage with laravel queue
I'm using laravel queue to perform background tasks.
After starting the queue (either with "php artisan queue:work" or with supervisor), htop indicates a memory usage of ~2GB for the process - even with no jobs in the queue.
Here's "sudo systemctl status supervisor" with numprocs = 1 :
supervisor.service - Supervisor process control system for UNIX Loaded: loaded (supervisor.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2023-06-23 11:39:35 CEST; 7s ago Main PID: 2850495 (supervisord) Tasks: 2 (limit: 618982) Memory: 1.9G CPU: 2.574s CGroup: /system.slice/supervisor.service ├─2850495 supervisord -n -c /etc/supervisor/supervisord.conf └─2850496 php artisan queue:work --max-time=10800 --timeout=20 --tries=1
You can see the memory usage at 1.9G (without any job in the queue)
I doesnt seem to increase while processing jobs so I guess I can exclude a memory leak.
Any idea on why the usage is so high ?
Please or to participate in this conversation.