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;
浙公网安备 33010602011771号