Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

NielsNumbers's avatar

How to prevent artisan command from killing my system?

I have an artisan command that I need to exectue on my live server. It takes about 5 hours. How can I run this command, without using all system resources (CPU/Memory)? I don't care if it even takes a week, I just want to make sure its not using 100% of my system resources (it creates a lot of mysql queries). Its also possible to split the command in many jobs, but then I still don't know how to tell the jobs not ot use 100%. Is there any solution for this kind of issue?

0 likes
2 replies
bobbybouwmann's avatar

It's probably better to introduce a second server that will process all the jobs. This is called a worker server. It will only process any new jobs from the queue. On your application server, you just create the jobs and don't hammer down on the CPU anymore.

NielsNumbers's avatar

So on the working server I have the same Laravel application and the queue worker is only run on the workingserver? Sounds like a good solution, however this 5h command does only need to run one single time, then never again.

Please or to participate in this conversation.