gpt4 book ai didi

performance - Apache2 - 非常高流量网站的 ServerLimit、MaxClients、MaxRequestsPerChild 的最佳值

转载 作者:行者123 更新时间:2023-12-03 13:03:47 33 4
gpt4 key购买 nike

我正在运行一个流量密集的网站(每天 10 万)。在高峰时间(1500 多个在线事件)网站速度会大大减慢并增加页面加载时间。 (图片也是)

我们在同一台服务器上使用前端 + mysql 数据库。有足够的未使用资源。

平均负载:1.47、1.63、1.73
htop:http://grabilla.com/02b13-02a8961d-bd7e-404c-9873-06e57bb7eab1.png

服务器配置:
E3 1230 (4 x 3.2Ghz)/16GB RAM/1Gbps 端口速度
CentOS 5.8

Apache 配置:

Timeout 150
KeepAlive Off
MaxKeepAliveRequests 1000
KeepAliveTimeout 15

<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>

<IfModule worker.c>
StartServers 2
MaxClients 450
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

CPU 使用率永远不会超过高峰时段的 2 平均负载。 MySQL服务器当时也有7~15%的使用率。我知道这不是数据库瓶颈,因为静态页面在高峰时段也需要很长时间才能加载。

任何优化这些值的提示将不胜感激,谢谢。

网站网址: http://goo.gl/XVPAA

最佳答案

假设您将 linux 与 prefork 一起使用:打开保持事件状态。如果您有恒定的流量,请增加服务器数量。降低您的存活时间,这样您就不会很快使您的连接饱和,并增加您对每个 child 的请求,因此服务器不会经常重新启动。你有很多内存,所以尽量提高你的内存使用率并减少你的 CPU 使用率。首先试试这个:

Timeout 150
KeepAlive On
MaxKeepAliveRequests 1000
KeepAliveTimeout 5

<IfModule prefork.c>
StartServers 20
MinSpareServers 20
MaxSpareServers 30
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 10000
</IfModule>

还要编辑 my.conf 并增加缓存和缓冲区。

关于performance - Apache2 - 非常高流量网站的 ServerLimit、MaxClients、MaxRequestsPerChild 的最佳值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13461367/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com