i guess that the --stop-when-empty options refers to the queue work command; not affecting supervisor behaviour;
Yes.
If you want to stop supervisor when the queue is empty, how would you automatically start it again when there are new jobs in the queue? Doesn't manually stopping and starting supervisor defeats its purpose?
If your issue is supervisor restarting processes two quickly when your queues are a long time empty, consider using the -sleep option instead of the --stop-when-empty option.
As stated in the docs, the --stop-when-empty options is useful when you want to process the queue and be done:
The --stop-when-empty option may be used to instruct the worker to process all jobs and then exit gracefully. This option can be useful when processing Laravel queues within a Docker container if you wish to shutdown the container after the queue is empty:
reference: https://laravel.com/docs/9.x/queues#processing-all-queued-jobs-then-exiting
Something like this:
command=/opt/plesk/php/8.0/bin/php /path/to/artisan queue:work --queue=backups_line_1 --sleep=60
This will make the queue sleep for 60 seconds when the queue is empty, without killing the process.
I guess what is impacting your server's performance is the creation/killing of many process in a a short time. An idle queue worker should not have a noticeable impact on your server's memory nor performance.
To avoid memory leaks, I usually combine my workers with --sleep (with a lower --sleep value) and --max-jobs. So the worker is not checking the queue frequently when it is empty (from the --sleep option), and its process gets killed once in a while to avoid eventual memory leaks from a very long running process ( from the --max-jobs options) as supervisor will restart the worker when it is killed.