我有一个有以下信息的专用服务器:
128G RAM
6 cores/12 threads CPU, 3.4GHz
512 SSD storage
WHM/Cpanel latest
Apache/MySQL
Centos 7.x我在这个服务器上有一个网站,在每天的特定时间都有大量的流量,时间不到一个小时。根据谷歌分析公司的实时统计,在流量高峰时,大约有6000名用户。
服务器在大约500个用户的平均页面加载时间约为0.15秒,网站代码对mysql进行了非常优化。
服务器直到2000年的并发用户才会出现问题。在这个用户数之后,服务器的负载有时会达到100%及以上,mysql的负载会增加到600-900%,网站需要花费很长时间来加载和显示服务器繁忙的页面,而大多数时候,我必须重新启动mysql和apache服务器。
以下是我在Apache WHM中的当前设置:
Start Servers = 5
Minimum Spare Servers = 5
Maximum Spare Servers =10
Server Limit (Maximum: 20,000) = 5000
Max Request Workers = 5000
Max Connections Per Child = 10000
Max Keep-Alive Requests = unlimited
Timeout = 300以下是mysql在my.cnf中的设置,这是WHM的默认设置:
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[mysqld]
log-error=/var/lib/mysql/hosting.hostrose.com.err
performance-schema=0
default-storage-engine=MyISAM
innodb_file_per_table=1
innodb_buffer_pool_size=134217728
max_allowed_packet=268435456
open_files_limit=10000
max_connections=151我的问题是,对于这些vars来说,在没有重载或挂起服务器(特别是apache和mysql连接号)的情况下,为该数量的用户提供服务的最佳价值是什么。
发布于 2020-05-01 05:58:43
所提供的资料自相矛盾:
2000并发用户max_connections=151
同时,Apache将限制为20件。
我建议如下:
innodb_buffer_pool_size=134217728增加到90G更多讨论:http://mysql.rjweb.org/doc.php/myisam2innodb前者表示有多少连接同时连接到MySQL。后者表示目前有多少人在做某事。
mysql的负载达到600-900%,网站需要很长时间才能加载和显示服务器繁忙的页面。
这意味着您仍然有一些需要优化的查询。
要进一步分析(如果设置和查询),请遵循http://mysql.rjweb.org/doc.php/mysql_分析中的说明
发布于 2020-04-30 16:21:44
将MySQL最大连接增加到> 4000,并检查性能
https://serverfault.com/questions/1014998
复制相似问题