我有 apache 的默认最大工作人员,禁用连接重用非常低的内存和 CPU 利用率和负载,低 IO 延迟,但我的空闲工作人员似乎非常低。有时接近或接近 0 并且根本不稳定,它一吨高一低。我用很少的元素提供一个基本的 php 登录页面。
在我看来数学应该是
idle workers=256-(requests currently being processed)
但事实并非如此。 Apache 记分牌显示(如果我在正确的时间捕获它):
121 requests currently being processed, 10 idle workers
CRCCCCCCCCCCCCCCCCCCCCRCCCRCCCRCCCCRCWCWCCCCCCCCCCCRCCRCCCCRRCRC
CCCCCCCRCCCCCCRCCCCCCCCCCCCCCWR_CCCC_CCCCCCCRCCCRCCCCCCCCC.CCC..
RCCC.C.C.....R.................C.......C........................
C........C...C..........CR....C.C.....R...........C....C.R..C.R.
在我看来,“.”也是如此。表示空闲的 worker 。我错过了什么?我想确保没有 0 个空闲 worker 的微爆发影响我的服务。
最佳答案
https://www.liquidweb.com/kb/apache-performance-tuning-mpm-directives/#prefork
MinSpareServers
This directive defines a minimum number of spare children the Apache parent process can maintain in its memory. An additional server is a preforked idle Apache child that is ready to respond to a new incoming request. Having idle children waiting for new requests is essential for providing the fastest server response times. When the total idle children on the server drop below this value, a new child is preforked at the rate of one per second until this directive is satisfied. The “one per second” rule is in place to prevent surges of the creation process that overload the server, however, this failsafe comes at a cost. The one per second spawn rate is particularly slow when it comes to handling page requests. So it’s highly beneficial to make sure enough children are preforked and ready to handle incoming requests.
关于php - Apache 低空闲工作人员但不是最大请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59163031/