0

Just recently the application that I maintain started crashing, mysql's CPU usage is 100%... or more :) The application itself is quite old and has a lot of slow queries but before blaming it I want to check if it's not the mysql issue. I hate to ask but could someone take a look at SHOW ENGINE INNODB STATUS and tell me if there is anything suspicious in there?.

=====================================
2022-09-06 09:41:55 0x7fc0d07b6700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 19 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 331407 srv_active, 0 srv_shutdown, 746026 srv_idle
srv_master_thread log flush and writes: 1077433
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 10587175
OS WAIT ARRAY INFO: signal count 16395655
RW-shared spins 0, rounds 53351140, OS waits 6923021
RW-excl spins 0, rounds 53028151, OS waits 518758
RW-sx spins 2458, rounds 50803, OS waits 1261
Spin rounds per wait: 53351140.00 RW-shared, 53028151.00 RW-excl, 20.67 RW-sx
------------------------
LATEST FOREIGN KEY ERROR
------------------------

------------
TRANSACTIONS
------------
Trx id counter 51455398
Purge done for trx's n:o < 51455398 undo n:o < 0 state: running but idle
History list length 41
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421941565186184, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421941565188024, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421941565189864, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421941565183424, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421941565187104, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421941565182504, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421941565185264, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421941565180664, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421941565181584, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421941565184344, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421941565179744, 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
3407791191 OS file reads, 23186343 OS file writes, 2496201 OS fsyncs
1 pending preads, 0 pending pwrites
3625.23 reads/s, 16384 avg bytes/read, 124.73 writes/s, 14.53 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 3093, seg size 3095, 718207 merges
merged operations:
 insert 773740, delete mark 82990, delete 494
discarded operations:
 insert 0, delete mark 0, delete 0
Hash table size 34679, node heap has 1 buffer(s)
Hash table size 34679, node heap has 12 buffer(s)
Hash table size 34679, node heap has 73 buffer(s)
Hash table size 34679, node heap has 50 buffer(s)
Hash table size 34679, node heap has 8 buffer(s)
Hash table size 34679, node heap has 45 buffer(s)
Hash table size 34679, node heap has 2 buffer(s)
Hash table size 34679, node heap has 18 buffer(s)
32794.22 hash searches/s, 21657.81 non-hash searches/s
---
LOG
---
Log sequence number 94588304242
Log flushed up to   94588304242
Pages flushed up to 94588300431
Last checkpoint at  94588296730
0 pending log flushes, 0 pending chkp writes
1221882 log i/o's done, 3.05 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 137428992
Dictionary memory allocated 3122549
Buffer pool size   8192
Free buffers       634
Database pages     7349
Old database pages 2732
Modified db pages  191
Pending reads      1
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 105805584, not young 27891291271
0.00 youngs/s, 0.00 non-youngs/s
Pages read 3407821728, created 13603254, written 21494430
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 982 / 1000, young-making rate 0 / 1000 not 374 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 7349, unzip_LRU len: 0
I/O sum[276774]:cur[88], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
1 read views open inside InnoDB
Process ID=1, Main thread ID=140466150430464, state: sleeping
Number of rows inserted 428234279, updated 1035424, deleted 45779, read 70493463554
2454.98 inserts/s, 1.42 updates/s, 0.05 deletes/s, 66260.57 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================
6
  • Nothing exciting in InnoDB STATUS. But that is not the place to look. "High CPU" is almost always caused by a poorly indexed and/or poorly formulated query. The best way to find the naughtiest query is with the SlowLog
    – Rick James
    Sep 6, 2022 at 16:23
  • @Maarduk The next to last line of your SHOW ENGINE INNODB STATUS indicates 66,260.57 reads/s which seems to be extreme to me. The number of pages in your innodb buffer pool size indicates a size of 128MB which is NOT large enough for your application. Will ask for additional information to allow workload analysis of your system. Sep 6, 2022 at 19:58
  • Additional DB information request, please. RAM size, # cores, any SSD or NVME devices on MySQL Host server? Post TEXT data on justpaste.it and share the links. From your SSH login root, Text results of: A) SELECT COUNT(*) FROM information_schema.tables; B) SHOW GLOBAL STATUS; after minimum 24 hours UPTIME C) SHOW GLOBAL VARIABLES; D) SHOW FULL PROCESSLIST; E) STATUS; not SHOW STATUS, just STATUS; G) SHOW ENGINE INNODB STATUS; complete report for server workload tuning analysis to provide performance improving suggestions. Sep 6, 2022 at 20:02
  • AND very helpful OS information, includes - htop 1st page, if available, TERMINATE, top -b -n 1 for most active apps, top -b -n 1 -H for details on your mysql threads memory and cpu usage, ulimit -a for list of limits, iostat -xm 5 3 for IOPS by device & core/cpu count, df -h for Used - Free space by device, free -h for Used - Free Mem: and Swap:, cat /proc/meminfo includes VMallocUused, for server workload tuning analysis to provide suggestions. Sep 6, 2022 at 20:04
  • Hey @WilsonHauck thank you very much, took me some time to get all the data but here it is justpaste.it/88pbr hope I didn't miss anything. Thank you very much I really reaaally appreciate it :)
    – Maarduk
    Sep 8, 2022 at 12:36

1 Answer 1

1

Rate Per Second = RPS;

Suggestions to consider for your my.cnf [mysqld] section to reduce CPU busy

innodb_buffer_pool_size=2G  # from 128M to reduce innodb_buffer_pool_reads RPS of 3,142
read_rnd_buffer_size=32K  # from 256K to reduce handler_read_rnd_next RPS of 32,190
innodb_io_capacity=900  # from 200 to use more IOPS of your NVME storage devices 
net_buffer_length=96K  # from 16K to reduce packet in/out count

Please view profile for contact info and free Utility Scripts to assist with performance tuning. There are more adjustments to be accomplished.

12
  • 1
    Thank you @WilsonHauck, I appreciate it much :) I'll do the changes accordingly and when I'll finally have some more time I'll contact you :)
    – Maarduk
    Sep 9, 2022 at 11:58
  • @Maarduk Have you been able to apply the suggestions of Sep 8, 2022? Any significant results? Sep 27, 2022 at 21:28
  • 1
    Hey, yup I applied those changes but there were no significant results. But... I might have found where the issue is... Our application and the database runs in docker containers, just lately I was getting some error about communication packets, then, I analyzed the network traffic and it was full of TCP retransmissions, I suspect it might be causing performance issues, what are you thoughts about it? Am I on the right track? :) Thx
    – Maarduk
    Oct 3, 2022 at 12:04
  • @Maarduk My thoughts, yes, retransmissions will contribute to visual delays. If your docker container is using MySQL to host the data, provide similar Additional information for the MySQL instance that is providing the data for analysis, please. Oct 3, 2022 at 14:49
  • 1
    Hey, how are you doing? Hm, but would the retransmission explain high CPU and disk reads? I'm not sure what kind of additional information you mean, the info I send you via justpaste is about this DB instance. Thx
    – Maarduk
    Oct 4, 2022 at 7:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .