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

hamzafaouzi's avatar

php 7.2 memory usage is really high with Laravel 5.6 should I downgrade to 7.1

Im running a Laravel 5.6 app on a 1gb droplet and I keep getting a high ram usage alert when I check the status php7.2 is using nearly 400mb , I disabled opcache , and set pm to ondemand in php-fpm config file , any suggestions guys Thank you

0 likes
4 replies
hamzafaouzi's avatar

yes Im using horizon , do you have any suggestion what I think I shoud do is remove horizon and set the supervisor to keep restarting the queue instead of horizon . Thanks a lot I'm waiting if you have any suggestions

bobbybouwmann's avatar

You can maybe use a cronjob (Laravels scheduler) to restart the queue every hour for example? Maybe you can do that with Horizon as well?

For example

php artisan horizon:terminate // gracefully terminate horizon
php artisan horizion // start it up again

You also need to do this for deployments so the queue will get the new fresh code!

Cronix's avatar

Also, note the docs:

Resource Considerations

Daemon queue workers do not "reboot" the framework before processing each job. Therefore, you should free any heavy resources after each job completes. For example, if you are doing image manipulation with the GD library, you should free the memory with imagedestroy when you are done.

You need to make sure you clean your resources out when done with a task. My memory usage doesn't climb and I have queues processing thousands of tasks daily and they only get rebooted when something new is deployed, which could be weeks/months in between deployments. While you can reboot the workers, it's a workaround and should be unnecessary, so it's masking the actual problem. I'd look more at your tasks and what you can do to clean them up to actually fix the problem.

Please or to participate in this conversation.