When executing proc_nice(), is it actually nice'ing Apache's thread?
If so, and if the current user (non-super user) can't renice to its original priority is killing the Apache thread appropriate (apache_child_terminate) on an Apache 2.0x server?
The issue is that I am trying to limit the impact of an app that allows the user to run Ad-Hack queries. The Queries can be massive and the resultant transform on the data requires a lot of Memory and CPU.
I've already re-written the process to be more stream based - helping with the memory consumption, but I would also like the process to run a lower priority. However I can't leave the Apache thread in low priority as we have a lot of high-priority web services running on this same box.
TIA
In that kind of situation, a solution if often to not do that kind of heavy work within the Apache processes, but either :
shell_exec
, for instance -- this is if you must work in synchronous mode (ie, if you cannot execute the task a couple of minutes later)As often as possible, especially if the heavy calculations take some time, I would go for the second solution :
Another (nice-looking, but I haven't tried it yet) solution would be to use some kind of tool like, for instance, Gearman :