gpt4 book ai didi

mysql - IIS PHP MySQL 服务器堆栈在重负载下不可用

转载 作者:行者123 更新时间:2023-11-29 05:56:26 25 4
gpt4 key购买 nike

我正在尝试构建一个能够应对非常繁忙的流量的 IIS 10/PHP 7.2/MySQL 5.7 Web 服务器。它是一个 48 核 Xeon Platinum 服务器,具有 188GB RAM。我正在使用 loader.io 执行负载测试。

负载测试导航到服务器上的一个 PHP 页面,该页面依次执行几个 MySQL 查询(以使其更真实)。

当我运行 loader.io 负载测试时,在大约 1500 个用户在网站上处于事件状态后,我可以在 IIS 日志中看到大量 500 和 503 错误,并且由于错误级别较高,测试停止。

我今天切换到 MySQL 持久连接以尝试提高性能。

我检查了PHP错误日志,没有错误。

我检查了 Windows Server 2016 系统日志,它说:

Aborted connection to db: 'xxxx' user: 'xxxx' host: 'localhost' (Got an error reading communication packets) For more information, see Help and Support Center at http://www.mysql.com.

这是我的 MySQL 配置:

max_connections=501
table_open_cache=2000
tmp_table_size=1G
thread_cache_size=100
key_buffer_size=2G
read_buffer_size=2G
read_rnd_buffer_size=2G
join_buffer_size=2G
sort_buffer_size=2G

这是我的 PHP 配置:

mysqli.max_persistent = 500
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
memory_limit = 128M

资源永远不会用完,但测试仍然失败。我可以更改配置或任何其他要测试的变量吗?谢谢

enter image description here

enter image description here

enter image description here

最佳答案

关于 my.cnf/ini [mysqld] 部分的建议

#read_buffer_size=2G
#read_rnd_buffer_size=2G
#join_buffer_size=2G
#sort_buffer_size=2G

这 4 行中的每一行都以# 开头,以导致使用 DEFAULTS。您对这些限制的使用是极端的。使用 MySQLCalculator.com 2 分钟将说明您请求的 RAM 占用量是极端的。

您的配置限制为大约 500 个连接,为什么您要在测试中尝试使用 1500 个连接来超速运行平台?

关于mysql - IIS PHP MySQL 服务器堆栈在重负载下不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49075547/

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