【《高性能MySQL》读书笔记(2) 】 第2章 MySQL 基准测试

【时间】2021.12.21

【题目】《高性能MySQL》读书笔记(2)  第2章 MySQL 基准测试

本系列是数据《高性能MySQL》的读书笔记。

目录

一、简介

二、一些重要的图 

1、查询mysql状态的一些语句

2、http_load使用

3、sysbench 使用

4、MySQL的benchmark()函数

三、思维导图


一、简介

        本章主要介绍了MySQL的基准测试,包括:

  • 基准测试的作用:测试系统当前的运行情况/压测/寻找性能瓶颈
  • 基准测试的策略:针对整个系统的整体测试的集成式( full-stack)基准测试/单独测试 MySQL的单组件式( sing component )基准测试。
  • 测试指标:吞吐量(throughput )/响应时间或者延迟(latency)/并发量/可扩展性等
  • 基准测试方法:测试、记录数据、计算指标、分析。
  • 基准测试工具:ab、load_http;单独测试MySQL:sysbench/MySQL Benchmark Suite 

注意:这章主要是一些基准测试工具的使用,需要后面用到时再进回顾

二、一些重要的图 

1、查询mysql状态的一些语句

SHOW GLOBAL STATUS; #查询全局状态
mysql> SHOW ENGINE INNODB STATUS\G  /*查询innoDB引擎状态*/
*************************** 1. row ***************************
  Type: InnoDB
  Name:
Status:
=====================================
2021-12-21 16:41:16 0x7fcc34140700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 16 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 1 srv_active, 0 srv_shutdown, 3867 srv_idle
srv_master_thread log flush and writes: 3868
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 2
OS WAIT ARRAY INFO: signal count 2
RW-shared spins 0, rounds 4, OS waits 2
RW-excl spins 0, rounds 0, OS waits 0
RW-sx spins 0, rounds 0, OS waits 0
Spin rounds per wait: 4.00 RW-shared, 0.00 RW-excl, 0.00 RW-sx
------------
TRANSACTIONS
------------
Trx id counter 9475
Purge done for trx's n:o < 0 undo n:o < 0 state: running but idle
History list length 0
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421990325868368, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (write thread)
Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
 ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 0
470 OS file reads, 53 OS file writes, 7 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 0, seg size 2, 0 merges
merged operations:
 insert 0, delete mark 0, delete 0
discarded operations:
 insert 0, delete mark 0, delete 0
Hash table size 34673, node heap has 0 buffer(s)
Hash table size 34673, node heap has 0 buffer(s)
Hash table size 34673, node heap has 0 buffer(s)
Hash table size 34673, node heap has 0 buffer(s)
Hash table size 34673, node heap has 0 buffer(s)
Hash table size 34673, node heap has 0 buffer(s)
Hash table size 34673, node heap has 0 buffer(s)
Hash table size 34673, node heap has 0 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 2741034
Log flushed up to   2741034
Pages flushed up to 2741034
Last checkpoint at  2741025
0 pending log flushes, 0 pending chkp writes
10 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 137428992
Dictionary memory allocated 140621
Buffer pool size   8191
Free buffers       7859
Database pages     332
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 298, created 34, written 36
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 332, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Process ID=2485, Main thread ID=140515049232128, state: sleeping
Number of rows inserted 0, updated 0, deleted 0, read 9
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

1 row in set (0.01 sec)
mysql> SHOW FULL PROCESSLIST;
+----+------+-----------+-------+---------+------+----------+-----------------------+
| Id | User | Host      | db    | Command | Time | State    | Info                  |
+----+------+-----------+-------+---------+------+----------+-----------------------+
|  6 | root | localhost | mysql | Query   |    0 | starting | SHOW FULL PROCESSLIST |
+----+------+-----------+-------+---------+------+----------+-----------------------+
1 row in set (0.00 sec)

2、http_load使用

详见:测试工具_http_load

3、sysbench 使用

详见:【MySQL】Sysbench 性能压测_mysql sysbench

4、MySQL的benchmark()函数

三、思维导图

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值