[英]Does PHP proc_nice leave Apache threads at new priority setting?
When executing proc_nice(), is it actually nice'ing Apache's thread? 当执行proc_nice()时,实际上对Apache的线程好吗?
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? 如果是这样,并且当前用户(非超级用户)是否无法忠于其原始优先级,那将杀死Apache 2.0x服务器上适当的Apache线程(apache_child_terminate)?
The issue is that I am trying to limit the impact of an app that allows the user to run Ad-Hack queries. 问题是我试图限制允许用户运行Ad-Hack查询的应用程序的影响。 The Queries can be massive and the resultant transform on the data requires a lot of Memory and CPU.
查询可能非常庞大,对数据的最终转换需要大量的内存和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.
但是,我不能将Apache线程的优先级设置为低,因为我们有许多高优先级的Web服务都在同一盒子上运行。
TIA TIA
In that kind of situation, a solution if often to not do that kind of heavy work within the Apache processes, but either : 在这种情况下,一种解决方案通常是不在Apache进程中执行此类繁重的工作,但是:
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) shell_exec
类的程序运行外部PHP进程-这是如果您必须以同步模式工作(即,如果几分钟后无法执行任务)
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 : 另一个(看起来不错,但我还没有尝试过)解决方案是使用某种工具,例如Gearman :
Gearman provides a generic application framework to farm out work to other machines or processes that are better suited to do the work.
Gearman提供了一个通用的应用程序框架,可以将工作分配到更适合执行该工作的其他机器或进程。
It allows you to do work in parallel, to load balance processing, and to call functions between languages.它允许您并行执行工作,进行负载平衡处理以及在语言之间调用函数。
It can be used in a variety of applications, from high-availability web sites to the transport of database replication events.它可用于各种应用程序,从高可用性网站到数据库复制事件的传输。
In other words, it is the nervous system for how distributed processing communicates.换句话说,它是分布式处理如何通信的神经系统。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.