Jmeter mySQL 性能测试
show variables like '%Query_cache%'; --查询缓存
show variables like 'thread'; -- 缓存在cache 中的线程数量 thread_catche_size
show status like 'Connections'; -- DB 已连接线程数
show status like '%thread%'; -- 当前连接线程状态
show variables like 'key_buffer_size'; --索引缓存大小
连接缓命中率 threads_cache_hit = (Connections -threads_created) / Connections * 100%
show global status like 'key_read'; --建议 < 0.1%
show global status like 'key_%';
索引缓存命中率,越大越好:
key_buffer_read_hits = (1-key_reads/Key_read_requests) * 100%
key_buffer_write_hits = (1-key_reads/Key_read_requests) * 100%
索引读取统计 key_blocks
理想的设置: key_blocks_unsed/(key_blicks_unused + key_blocks_used ) * 100% 约等于 80%;
show global status like 'key_blocks_u%';
并发连接数
show variables like 'max_connections'; --允许最大连接数
show global status like 'Max_used_Connections' --服务器响应的最大连接
-- Max_used_connections/ max_connections <= 85%
show global status like 'Connection'; --当前连接数
show variables like 'back_log'; --类似于线程队列,当无法响应请求是,就让线程排队,这个值就是队列长度,越小越好;
show variables like 'max_connect_errors'; --
临时表 tmpTable
show global status like 'created_tmp%';
show variables like 'tmp_table_size';
created_tmp_disk_tables / Created_tmp_files <= 25%; --没有参考意义?
MySQL 服务器对临时表的配置
show variables where Variable_name in ('tmp_table_size','max_heap_table_size') --临时表空间小于 max_heap_talbe_size 时,才能全部放入内存;
表扫描情况:
show global status like 'handler_read%';
show global status like 'com_select';
表扫描率 = handler_read_rnd_next / com_select ; 表扫描率超过4000,说明进行了太多扫描?很可能缩影没有建好,增加 read_buffer_size 值会有些好处,但最好不要超过8M;
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?