Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
20-30个并发mysql连接导致RDS峰值超过80%_Mysql_Amazon Web Services_Amazon Rds - Fatal编程技术网

20-30个并发mysql连接导致RDS峰值超过80%

20-30个并发mysql连接导致RDS峰值超过80%,mysql,amazon-web-services,amazon-rds,Mysql,Amazon Web Services,Amazon Rds,因此,我们有一个AmazonRDS服务器,按照以下规格运行 实例类:r3.xlarge 我的问题是,当MySQL服务器经历多个并发连接(连接范围为30-40)时,CPU达到峰值 然而,根据监控统计数据,它应该能够处理远高于此水平的连接。这是mysqltuner的输出 >> MySQLTuner 1.7.1 - Major Hayden <major@mhtx.net> >> Bug reports, feature requests, and downlo

因此,我们有一个AmazonRDS服务器,按照以下规格运行

实例类:r3.xlarge

我的问题是,当MySQL服务器经历多个并发连接(连接范围为30-40)时,CPU达到峰值

然而,根据监控统计数据,它应该能够处理远高于此水平的连接。这是mysqltuner的输出

>>  MySQLTuner 1.7.1 - Major Hayden <major@mhtx.net>
>>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
>>  Run with '--help' for additional options and output filtering
[--] Skipped version check for MySQLTuner script
[OK] Logged in using credentials passed on the command line
[--] Assuming 31500 MB of physical memory
[!!] Assuming 0 MB of swap space (use --forceswap to specify)
[OK] Currently running supported MySQL version 5.7.16-log

-------- Log file Recommendations ------------------------------------------------------------------
[--] Log file: /rdsdbdata/log/error/mysql-error.log(0B)
[!!] Log file /rdsdbdata/log/error/mysql-error.log doesn't exist
[!!] Log file /rdsdbdata/log/error/mysql-error.log isn't readable.

-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA 
[--] Data in InnoDB tables: 31G (Tables: 318)
[OK] Total fragmented tables: 0

-------- CVE Security Recommendations --------------------------------------------------------------
[--] Skipped due to --cvefile option undefined

-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 35d 16h 32m 26s (396M q [128.632 qps], 22M conn, TX: 605G, RX: 157G)
[--] Reads / Writes: 77% / 23%
[--] Binary logging is enabled (GTID MODE: OFF)
[--] Physical Memory     : 30.8G
[--] Max MySQL memory    : 30.6G
[--] Other process memory: 3.1G
[--] Total buffers: 22.6G global + 3.2M per thread (2540 max threads)
[--] P_S Max memory usage: 0B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 23.0G (74.65% of installed RAM)
[!!] Maximum possible memory usage: 30.6G (99.63% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory
[OK] Slow queries: 0% (0/396M)
[OK] Highest usage of available connections: 4% (119/2540)
[OK] Aborted connections: 0.07%  (15572/22176276)
[!!] Query cache may be disabled by default due to mutex contention.
[!!] Query cache efficiency: 0.0% (0 cached / 160M selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (42K temp sorts / 7M sorts)
[!!] Joins performed without indexes: 67554
[!!] Temporary tables created on disk: 30% (4M on disk / 13M total)
[OK] Thread cache hit rate: 99% (23K created / 22M connections)
[!!] Table cache hit rate: 0% (2K open / 532K opened)
[OK] Open file limit used: 0% (33/65K)
[OK] Table locks acquired immediately: 100% (155K immediate / 155K locks)
[OK] Binlog cache memory access: 99.97% (39502400 Memory / 39516081 Total)

-------- Performance schema ------------------------------------------------------------------------
[--] Performance schema is disabled.
[--] Memory used by P_S: 0B
[--] Sys schema is installed.

-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is disabled.

-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.3% (3M used / 16M cache)
[OK] Key buffer size / total MyISAM indexes: 16.0M/51.0K
[!!] Read Key buffer hit rate: 83.5% (36K cached / 5K reads)

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[!!] InnoDB buffer pool / data size: 22.5G/31.4G
[OK] InnoDB log file size / InnoDB Buffer pool size: 2.5G * 2/22.5G should be equal 25%
[!!] InnoDB buffer pool instances: 20
[--] Number of InnoDB Buffer Pool Chunk : 180 for 20 Buffer Pool Instance(s)
[OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
[OK] InnoDB Read buffer efficiency: 100.00% (1166286556754 hits/ 1166290082453 total)
[!!] InnoDB Write Log efficiency: 89.64% (179749039 hits/ 200515885 total)
[OK] InnoDB log waits: 0.00% (0 waits / 20766846 writes)

-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is disabled.

-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB is disabled.

-------- XtraDB Metrics ----------------------------------------------------------------------------
[--] XtraDB is disabled.

-------- RocksDB Metrics ---------------------------------------------------------------------------
[--] RocksDB is disabled.

-------- Spider Metrics ----------------------------------------------------------------------------
[--] Spider is disabled.

-------- Connect Metrics ---------------------------------------------------------------------------
[--] Connect is disabled.

-------- Galera Metrics ----------------------------------------------------------------------------
[--] Galera is disabled.

-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] This is a standalone server.

-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
Reduce your overall MySQL memory footprint for system stability
Dedicate this server to your database for highest performance.
Adjust your join queries to always utilize indexes
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries which have no LIMIT clause
Increase table_open_cache gradually to avoid file descriptor limits
Beware that open_files_limit (65535) variable 
should be greater than table_open_cache (2000)
Performance should be activated for better diagnostics
Variables to adjust:
*** MySQL's maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables ***
query_cache_size (=0)
query_cache_type (=0)
query_cache_limit (> 1M, or use smaller result sets)
join_buffer_size (> 2.0M, or always use indexes with joins)
tmp_table_size (> 64M)
max_heap_table_size (> 64M)
table_open_cache (> 2000)
performance_schema = ON enable PFS
innodb_buffer_pool_size (>= 31G) if possible.
innodb_buffer_pool_instances(=22)
MySQLTuner 1.7.1-海登少校 >>错误报告、功能请求和下载http://mysqltuner.com/ >>使用“--help”运行以获取其他选项和输出筛选 [-]跳过了MySQLTuner脚本的版本检查 [确定]使用在命令行上传递的凭据登录 [-]假设物理内存为31500 MB [!!]假设交换空间为0 MB(使用--forceswap指定) [确定]当前运行支持的MySQL版本5.7.16-log --------日志文件建议------------------------------------------------------------------ [-]日志文件:/rdsdbdata/Log/error/mysql error.Log(0B) [!!]日志文件/rdsdbdata/Log/error/mysql-error.Log不存在 [!!]日志文件/rdsdbdata/Log/error/mysql-error.Log不可读。 --------存储引擎统计信息----------------------------------------------------------------- [--]状态:+ARCHIVE+BLACKHOLE+CSV-联邦+InnoDB+内存+MRG_MYISAM+MYISAM+性能模式 [-]InnoDB表中的数据:31G(表:318) [确定]碎片表总数:0 --------CVE安全建议-------------------------------------------------------------- [--]由于--cvefile选项未定义而跳过 --------性能指标----------------------------------------------------------------------- [--]截止时间:35d 16h 32m 26s(396M q[128.632 qps],22米连接,德克萨斯州:605G,接收:157G) [-]读/写:77%/23% [-]二进制日志记录已启用(GTID模式:关闭) [-]物理内存:30.8G [-]最大MySQL内存:30.6G [-]其他进程内存:3.1G [-]总缓冲区:22.6G全局+3.2M/线程(最多2540个线程) [-]P_S最大内存使用量:0B [-]Galera GCache最大内存使用量:0B [确定]达到的最大内存使用量:23.0G(占已安装RAM的74.65%) [!!]最大可能内存使用量:30.6G(占已安装RAM的99.63%) [!!]其他进程的总体内存使用可能超出内存 [确定]慢速查询:0%(0/396M) [确定]可用连接的最高使用率:4%(119/2540) [确定]中断的连接:0.07%(15572/22176276) [!!]由于互斥争用,查询缓存在默认情况下可能被禁用。 [!!]查询缓存效率:0.0%(0缓存/160M选择) [确定]每天查询缓存修剪:0 [确定]需要临时表的排序:0%(42K临时排序/7M排序) [!!]在没有索引的情况下执行的联接:67554 [!!]在磁盘上创建的临时表:30%(磁盘上400万个/1300万个) [确定]线程缓存命中率:99%(创建23K个/22M个连接) [!!]表缓存命中率:0%(2K打开/532K打开) [确定]使用的打开文件限制:0%(33/65K) [确定]立即获取的表锁:100%(155K立即/155K锁) [确定]Binlog缓存内存访问:99.97%(39502400内存/39516081总计) --------性能模式------------------------------------------------------------------------ [-]性能架构已禁用。 [-]P_S:0B使用的内存 [-]系统架构已安装。 --------线程池度量------------------------------------------------------------------------ [-]线程池状态已禁用。 --------MyISAM度量---------------------------------------------------------------------------- [!!]使用的密钥缓冲区:18.3%(使用3M/16M缓存) [确定]键缓冲区大小/MyISAM总索引:16.0M/51.0K [!!]读取密钥缓冲区命中率:83.5%(36K缓存/5K读取) --------InnoDB度量---------------------------------------------------------------------------- [-]已启用InnoDB。 [-]InnoDB线程并发性:0 [确定]每个表的InnoDB文件已激活 [!!]InnoDB缓冲池/数据大小:22.5G/31.4G [确定]InnoDB日志文件大小/InnoDB缓冲池大小:2.5G*2/22.5G应等于25% [!!]InnoDB缓冲池实例:20 [-]InnoDB缓冲池区块数:20个缓冲池实例180个 [确定]Innodb_buffer_pool_大小与Innodb_buffer_pool_chunk_大小和Innodb_buffer_pool_实例对齐 [确定]InnoDB读取缓冲区效率:100.00%(1166286556754次点击/116629082453次总计) [!!]InnoDB写入日志效率:89.64%(179749039次点击/200515885次总计) [确定]InnoDB日志等待:0.00%(0次等待/20766846次写入) --------AriaDB度量---------------------------------------------------------------------------- [-]已禁用AriaDB。 --------TokuDB度量---------------------------------------------------------------------------- [-]TokuDB已禁用。 --------XtraDB度量---------------------------------------------------------------------------- [-]XtraDB已禁用。 --------RocksDB度量--------------------------------------------------------------------------- [-]RocksDB已禁用。 --------蜘蛛指标---------------------------------------------------------------------------- [-]蜘蛛已禁用。 --------连接度量--------------------------------------------------------------------------- [-]连接已禁用。 --------伽莱拉度量---------------------------------------------------------------------------- [-]Galera已禁用。 --------复制度量----------------------------------------------------------------------- [-]Galera同步复制:否 [-]此服务器没有复制从属服务器。 [-]这是一台独立服务器。 --------推荐--------------------------------------------------------------------------- 一般性建议: 减少MySQL的总体内存占用,提高系统稳定性 将此服务器专用于数据库以获得最高性能。 调整联接查询以始终使用索引 进行调整时,使tmp_table_size/max_heap_table_size相等 减少你的选择
innodb_thread_concurrency=25  # from 0 mm/dd/ccyy to manage activity
innodb_buffer_pool_size=20G  # from 22.5G mm/dd/ccyy to reduce memory footprint
innodb_buffer_pool_instances=8  # from 20 mm/dd/ccyy should be fine
table_open_cache=10000  # from 2000 mm/dd/ccyy for your 532K opened in 35 days