过去一周,我的 VPS 上的网站加载速度非常慢,有时甚至会超时。您能否查看我的 Apache2“服务器状态”输出,如果发现任何有趣的东西,请告诉我?我看到很多“OPTIONS * HTTP/1.0”请求,其中客户端是本地主机 (127.0.0.1)。我真的不知道发生了什么。
http://news.sweetboxing.com/server-status
任何帮助将不胜感激。
缺口。
首次回复:
apache2.conf 摘录:
Timeout 300
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 2
##
## Server-Pool Size Regulation (MPM specific)
##
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
StartServers 1
MinSpareServers 1
MaxSpareServers 5
MaxClients 40
MaxRequestsPerChild 500
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
StartServers 1
MaxClients 40
MinSpareThreads 1
MaxSpareThreads 4
ThreadsPerChild 25
MaxRequestsPerChild 500
答案1
您的设置中是否运行了 cPanel?cPanel 使用“OPTIONS * HTTP/1.0”来检查服务器的状态,但它本身不会对服务器造成任何额外负载,因此我猜想还有其他问题,而且如果没有您提供的其他信息,很难提出其他建议。
检查状态页面以及浏览时http://www.sweetboxing.com和http://www.sweetmma.com它回复我很快。/server-status 页面也没有显示任何当前高负载,所以现在对你来说可能也很平静?
通常,您必须在页面加载缓慢时观察服务器,以便更好地了解问题所在,例如 Apache 是否配置为允许太少的连接,是否在高使用率下内存不足。也许您受到了攻击,或者只是有人从您的网站链接了一些热门内容?事后阅读日志以及在发生事件时主动监控性能通常会为您提供更多详细信息。
编辑1:
我确实认为,这个块的低值是导致您有时出现排队和性能低下的原因。尝试以下方法:
<IfModule mpm_prefork_module>
StartServers 10
MinSpareServers 5
MaxSpareServers 5
MaxClients 100
ServerLimit 100
MaxRequestsPerChild 100
</IfModule>