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

问题描述 投票:1回答:2

我正在尝试构建一个能够应对非常繁忙流量的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 syslog,它说:

中止与db的连接:'xxxx'user:'xxxx'host:'localhost'(读取通信包时出错)有关更多信息,请参阅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

mysql iis-10
2个回答
1
投票

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

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

使用#引导这四行中的每一行,以使用DEFAULTS。您使用这些限制是极端的。使用MySQLCalculator.com 2分钟将说明您请求的RAM占用空间极端。

您的配置仅限于大约500个连接,为什么您在测试中尝试使用1500过度驱动平台?


1
投票

你的my.cnf / ini [mysqld]的建议(在分析了808秒的正常运行时间之后)

thread_cache_size=100  # from 2000, v 5.7 5.1.5 CAP at 100 suggestion
innodb_io_capacity=1000  # from 200  unless you test for Random Write IOPS and get your own capacity
eq_range_index_dive_limit=32  # from 200, if U can not find in 32, 200 will not either
expire_logs_days=5  # from 0, so you have limited historical logs vs nothing
innodb_lru_scan_depth=100  # from 1024 to avoid overrun of page_cleaners volume
innodb_page_cleaners=64  # from 4 for auto limit = innodb_buffer_pool_instances
innodb_read_ahead_threshold=8  # from 56 will RD next extent/avoid wait
innodb_read_io_threads=64  # from 4  see dba.stackexchange Q 5666 9/12/11 Rolando
innodb_thread_concurrency=0  # from 32  Rolando explains why - to use cores
innodb_write_io_threads=64  # from 4  turn it LOOSE SE 5666 explains
innodb_stats_sample_pages=32  # from 8 for more accurate cardinality
#max_allowed_packet=1G  # lead to use DEFAULT

当你需要超过DEFAULT时,在SESSION SET @ max_allowed_pa​​cket = nnnnn中最多1G,这是infile允许的限制

max_join_size=1M  # from a huge # for a reasonable limit of rows
max_seeks_for_key=32  # from a huge # to limit OPTIMIZER endless search
max_write_lock_count=16  # from a huge # to allow RD after nn locks
sql_select_limit=1M  # from a huge # to limit ROWS selected
open_files_limit=50000  # from 502048 for more useful max
query_alloc_block_size=32K  # from 8192 to avoid RAM alloc frequency
query_cache_size=0  # from 1M keep your RAM for useful purpose, not using QC
query_cache_limit=1K  # from 1M to conserve RAM while QC not in use
query_cache_min_res_unit=512 # from 4096 will allow more results in QC
query_prealloc_size=32K  # from 8192 to avoid RAM alloc frequency
updatable_views_with_limit=NO  # from YES to reduce handler_external_lock
wait_timeout=3600  # from 28800 seconds, idle connections need to release rscrs, login will be required.

我今天早上的想法。在新的pastebin中发布时,很乐意重新使用新的GS和GV进行分析。

© www.soinside.com 2019 - 2024. All rights reserved.