mysql锁监视器

Posted milkty

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql锁监视器相关的知识,希望对你有一定的参考价值。

根据MySQL锁监视器这篇文章来操作。

准备条件:大于5.6.16版本的mysql,登录mysql

 

 

开启 

 

set GLOBAL innodb_status_output=ON;
set GLOBAL innodb_status_output_locks=ON;

新增、修改表。
mysql> show create table my_test1_0\\G
*************************** 1. row ***************************
Table: my_test1_0
Create Table: CREATE TABLE `my_test1_0` (
`id` int(11) NOT NULL,
`col2` int(11) DEFAULT NULL,
`col3` varchar(64) DEFAULT NULL,
`col4` varchar(10) DEFAULT NULL,
`col5` varchar(64) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_col2` (`col2`),
KEY `idx_col3_col4` (`col3`,`col4`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.08 sec)

 

insert into my_test1_0(id ) values( 1 ),(2),(3);

update my_test1_0 set col5=\'jiji\' where id=1;

 

 

 

查看

 

  show engine innodb status\\G

 

结果:

 

mysql> show engine innodb status\\G
*************************** 1. row ***************************
  Type: InnoDB
  Name:
Status:
=====================================
2016-11-07 15:40:36 149c INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 0 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 3 srv_active, 0 srv_shutdown, 1528929 srv_idle
srv_master_thread log flush and writes: 1528919
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 19
OS WAIT ARRAY INFO: signal count 18
Mutex spin waits 142, rounds 276, OS waits 7
RW-shared spins 9, rounds 221, OS waits 6
RW-excl spins 1, rounds 150, OS waits 5
Spin rounds per wait: 1.94 mutex, 24.56 RW-shared, 150.00 RW-excl
------------
TRANSACTIONS
------------
Trx id counter 22306
Purge done for trx\'s n:o < 22306 undo n:o < 0 state: running but idle
History list length 446
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0, not started
MySQL thread id 11, OS thread handle 0x149c, query id 239 localhost ::1 root in
t
show engine innodb status
--------
FILE I/O
--------
I/O thread 0 state: wait Windows aio (insert buffer thread)
I/O thread 1 state: wait Windows aio (log thread)
I/O thread 2 state: wait Windows aio (read thread)
I/O thread 3 state: wait Windows aio (read thread)
I/O thread 4 state: wait Windows aio (read thread)
I/O thread 5 state: wait Windows aio (read thread)
I/O thread 6 state: wait Windows aio (write thread)
I/O thread 7 state: wait Windows aio (write thread)
I/O thread 8 state: wait Windows aio (write thread)
I/O thread 9 state: wait Windows aio (write thread)
Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] ,
 ibuf aio reads: 0, log i/o\'s: 0, sync i/o\'s: 0
Pending flushes (fsync) log: 0; buffer pool: 0
480 OS file reads, 55 OS file writes, 33 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 553253, node heap has 1 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 2555311
Log flushed up to   2555311
Pages flushed up to 2555311
Last checkpoint at  2555311
0 pending log writes, 0 pending chkp writes
18 log i/o\'s done, 0.00 log i/o\'s/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total memory allocated 136052736; in additional pool allocated 0
Dictionary memory allocated 101103
Buffer pool size   8192
Free buffers       7737
Database pages     454
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 448, created 6, written 33
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/

LRU len: 454, 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
Main thread id 3908, state: sleeping
Number of rows inserted 3, updated 1, deleted 0, read 1
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.08 sec)

mysql>

 

以上是关于mysql锁监视器的主要内容,如果未能解决你的问题,请参考以下文章

内置锁synchronized的几个要注意的对象监视器

java线程同步--同步方法

博客2

Synchronized理解及用法

InnoDB Monitors (InnoDB 监视器)

java synchronized关键字的底层实现