Configure a PHP script to use minimal system resources?

Asked

Viewed 49 times

1

I have a php script that is not heavy, basically it makes a giant amount of records in a Mariadb database. The point is that this robot will take a few hours (maybe more than a day) to fully run, but that’s not the problem. The point is that I need to reserve a MINIMUM memory and CPU allocation for this script, so that the execution of it does not harm other more critical points of the system.

Any tips for this? I just found how to do the opposite.

  • 1

    When it runs it locks the rest by consuming all the machine processing? Did you ever analyze which part of the code is responsible for that bottleneck? Perhaps it would be more interesting to review the code from this in order to remove the bottleneck than to limit the processing - and perhaps doing so decreases even the running time.

  • There is no bottleneck. What I want is, in fact, a guarantee that, as long as this robot is running, it doesn’t get in the way of the system, I want it to run at least necessary. Since he will be doing a large number of bank access, I need this done without interfering with the rest of the system. A process in the background using the minimum necessary to work.

  • If the server is Apache with php 7 and you are given to maintain . htaccess, create a directory for that your script and within . htacces from this directory put <IfModule mod_php7.c> php_value memory_limit 32M </IfModule>, assuming the desired limit is 32Mb.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.