简体   繁体   English

Apache(在Ubuntu上)随着时间的推移会产生大量任务。 为什么和应该/应该如何解决?

[英]Apache (on Ubuntu) spawns large number of tasks over time. Why & should/how I fix it?

I have about 4-6 files (per user), mostly static ones being requested from an AWS instance. 我大约有4-6个文件(每个用户),大多数是从AWS实例请求的静态文件。 Peak traffic is about 1K visitors at a time (via Google Analytics Real Time). 高峰流量一次(通过Google Analytics(分析)实时)大约有1000名访客。

The instance is powerful enough and it rarely peaks at 100% CPU, has free RAM. 该实例足够强大,几乎不会在100%CPU达到峰值,并具有可用RAM。 mpm_prefork is adjusted for 1480 simultaneous connections. 已将mpm_prefork调整为1480个同时连接。 After restarting Apache2, there are around 200 processes running during peaks. 重新启动Apache2之后,高峰期间大约有200个进程在运行。

However, over a couple of days the amount of processes seems to swell up and requires me to restart apache in order to negate the timeout errors for users. 但是, 几天后,进程数量似乎膨胀了 ,需要我重新启动apache才能消除用户的超时错误。

Am I missing anything? 我有什么想念的吗? Is this expected? 这是预期的吗?

You could set the MaxSpareServers directive to something very low like 10 or 20. When instances are not needed anymore (not serving anything or in a keep-alive state), you should only get 10 or 20 idle workers. 您可以将MaxSpareServers伪指令设置为非常低的值,例如10或20。当不再需要实例(不再提供任何服务或处于保持活动状态)时,您应该只获得10或20个空闲工作线程。

If the workers number remains the same even when serving no client, then you've got some problem. 如果即使不为客户服务,工作人员人数也保持不变,那么您就会遇到问题。 Check your keep-alive timeout setting, or disable keep-alive altogether and see it has some effect. 检查您的Keep-alive超时设置,或完全禁用Keep-Alive,并观察到它会起作用。 I've notice keep-alive is sometimes counterproductive, especially in busy environments. 我注意到保持活力有时适得其反,特别是在繁忙的环境中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM