mysql .net connector connection pool wasted - mysql

I have asp.net mvc 3 application using mysql database and mysql .net connector. Application is using membership, role, profile providers and subsonic3 as data layer. Application is able to waste very big number of connections and eventually it crashes with timeout exception. I cloned server/application setup and I managed to reproduce issue with 10 connections limit. Info I have for now is below. For the beginning what does "Cleaning up" in innoDb transaction status means? I found this info: http://dev.mysql.com/doc/refman/5.0/en/general-thread-states.html but I dont see how transaction can stay in that status. Off course I desperately need any info that can help.
I actually debugged Subsonic code and I don't see that its doing anything wrong. When I become more desperate I guess I will do it again. Now I am trying to see whats happening in connector. Connections listed below are wasted i.e. not reusable.
Connections:
mysql> SHOW FULL PROCESSLIST;
+----+------+-----------------+------------+---------+------+-------+-----------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------------+------------+---------+------+-------+-----------------------+
| 2 | root | localhost:49167 | NULL | Query | 0 | init | SHOW FULL PROCESSLIST |
| 15 | root | localhost:49360 | somedbname | Sleep | 260 | | NULL |
| 16 | root | localhost:49361 | NULL | Sleep | 260 | | NULL |
| 19 | root | localhost:49437 | somedbname | Sleep | 3969 | | NULL |
| 20 | root | localhost:49439 | somedbname | Sleep | 3702 | | NULL |
| 21 | root | localhost:49440 | somedbname | Sleep | 3396 | | NULL |
| 22 | root | localhost:49457 | somedbname | Sleep | 3102 | | NULL |
| 23 | root | localhost:49460 | somedbname | Sleep | 2802 | | NULL |
| 24 | root | localhost:49478 | somedbname | Sleep | 1929 | | NULL |
| 26 | root | localhost:49497 | somedbname | Sleep | 1629 | | NULL |
| 27 | root | localhost:49498 | somedbname | Sleep | 1329 | | NULL |
+----+------+-----------------+------------+---------+------+-------+-----------------------+
11 rows in set (0.00 sec)
InnoDb status:
=====================================
2013-02-13 07:54:01 790 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 46 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 311 srv_active, 0 srv_shutdown, 14316 srv_idle
srv_master_thread log flush and writes: 14623
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 300
OS WAIT ARRAY INFO: signal count 296
Mutex spin waits 207, rounds 6140, OS waits 111
RW-shared spins 200, rounds 6000, OS waits 172
RW-excl spins 1, rounds 480, OS waits 15
Spin rounds per wait: 29.66 mutex, 30.00 RW-shared, 480.00 RW-excl
------------
TRANSACTIONS
------------
Trx id counter 7160
Purge done for trx's n:o < 7157 undo n:o < 0 state: running but idle
History list length 650
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 7159, not started
MySQL thread id 27, OS thread handle 0xb6c, query id 11259 localhost ::1 root cleaning up
---TRANSACTION 7124, not started
MySQL thread id 26, OS thread handle 0xc88, query id 11080 localhost ::1 root cleaning up
---TRANSACTION 0, not started
MySQL thread id 2, OS thread handle 0x790, query id 11270 localhost ::1 root init
SHOW ENGINE INNODB STATUS
---TRANSACTION 7005, not started
MySQL thread id 24, OS thread handle 0xde0, query id 10510 localhost ::1 root cleaning up
---TRANSACTION 6865, not started
MySQL thread id 23, OS thread handle 0x1d0, query id 9615 localhost ::1 root cleaning up
---TRANSACTION 6697, not started
MySQL thread id 22, OS thread handle 0x874, query id 8824 localhost ::1 root cleaning up
---TRANSACTION 6647, not started
MySQL thread id 21, OS thread handle 0xfa8, query id 8546 localhost ::1 root cleaning up
---TRANSACTION 6531, not started
MySQL thread id 20, OS thread handle 0x910, query id 8019 localhost ::1 root cleaning up
---TRANSACTION 6243, not started
MySQL thread id 19, OS thread handle 0x740, query id 6886 localhost ::1 root cleaning up
---TRANSACTION 0, not started
MySQL thread id 15, OS thread handle 0x75c, query id 11268 localhost 127.0.0.1 root cleaning up
--------
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
1017 OS file reads, 3059 OS file writes, 2067 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 17393, node heap has 1 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 2556460
Log flushed up to 2556460
Pages flushed up to 2556460
Last checkpoint at 2556460
0 pending log writes, 0 pending chkp writes
852 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total memory allocated 8585216; in additional pool allocated 0
Dictionary memory allocated 142202
Buffer pool size 512
Free buffers 255
Database pages 256
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 988, created 63, written 1772
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: 256, 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 1240, state: sleeping
Number of rows inserted 49, updated 955, deleted 0, read 5238
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================
Web app gets stuck with following exception and isnt usable until app pool is recycled.
System.Configuration.Provider.ProviderException: An exception occurred.
Please check the Event Log. ---> MySql.Data.MySqlClient.MySqlException:
error connecting: Timeout expired.
The timeout period elapsed prior to obtaining a connection from the pool.
This may have occurred because all pooled connections were in use and max
pool size was reached.

OK I will provide some debugging steps that can be reused in similar situations to wash myself a little.
I did upgrade to Version=6.6.5.0. I downloaded source and attached debugger to connector and pool was working all right but I still had same issue. Connections from pool were not reused.
I added watch to private MySqlPool.inUsePool; And saw that all stuck connections are in use there. By adding another watch (in fact 10 of them): inUsePool[0-10].reader.Command.CommandText
helped me identify part in code that wasn't closing reader/connection. All connections that were stuck were indeed occupied by my reader. All had same SQL Command text that is called only once in application.

Related

Skew in mysql memory usage compared to configured values

MySQL v8.0.23, InnoDB engine
I have configured innodb buffer pool size =80GB, and max threads used are 423. However, there is significant difference in memory consumed by mysql vs expected max value of RAM usage. What could be the contributing factors for the extra 17GB?
SELECT ( ##key_buffer_size + ##innodb_buffer_pool_size + 423 * (##read_buffer_size + ##read_rnd_buffer_size + ##sort_buffer_size + ##join_buffer_size + ##tmp_table_size )) / (1024*1024*1024)
AS MAX_MEMORY_GB;
+---------------+
| MAX_MEMORY_GB |
+---------------+
| 86.5277 |
+---------------+
As per above, max usage of memory ~87GB. However, top and free show following:
free -mh
total used free shared buff/cache available
Mem: 119G 104G 876M 908K 14G 13G
Swap: 0B 0B 0B
top -o %MEM
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
26502 mysql 20 0 0.103t 0.102t 12120 S 113.3 86.7 265894:41 mysqld
129344 root 19 -1 352404 138448 133868 S 0.0 0.1 9:12.45 systemd-journal
Output of pt-mysql-summary
# InnoDB #####################################################
Version | 8.0.23
Buffer Pool Size | 80.0G
Buffer Pool Fill | 90%
Buffer Pool Dirty | 0%
File Per Table | ON
Page Size | 16k
Log File Size | 2 * 512.0M = 1.0G
Log Buffer Size | 32M
Flush Method | fsync
Flush Log At Commit | 0
XA Support |
Checksums |
Doublewrite | ON
R/W I/O Threads | 32 32
I/O Capacity | 200
Thread Concurrency | 0
Concurrency Tickets | 5000
Commit Concurrency | 0
Txn Isolation Level |
Adaptive Flushing | ON
Adaptive Checkpoint |
Checkpoint Age | 3M
InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
Oldest Transaction | 0 Seconds
History List Len | 36
Read Views | 0
Undo Log Entries | 1 transactions, 2 total undo, 2 max undo
Pending I/O Reads | 0 buf pool reads, 0 normal AIO, 0 ibuf AIO, 0 preads
Pending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page); 0 AIO, 0 sync, 0 log IO (0 log, 0 chkp); 0 pwrites
Pending I/O Flushes | 478553 buf pool, 0 log
Transaction States | 1xACTIVE (PREPARED), 4xnot started
You are missing a critical ( and ) in your query, the following may be more accurate for you.
SELECT ( ##key_buffer_size + ##innodb_buffer_pool_size + ( 423 * (##read_buffer_size + ##read_rnd_buffer_size + ##sort_buffer_size + ##join_buffer_size + ##tmp_table_size ))) / (1024*1024*1024)
AS MAX_MEMORY_GB;

Why am I getting this error in MariaDB Galera Clutser?

I am using Galera Cluster, and recently encountered the following error while restarting MariaDB.
It consists of a total of 3 nodes.
When only the first node is running, DB access is possible, but when the second node is executed, the following error message is displayed and the cluster is not formed.
Why?
MariaDB Version: 10.4.20
mariadb | =====================================
mariadb | 2022-08-11 12:00:11 0x7f37339cf700 INNODB MONITOR OUTPUT
mariadb | =====================================
mariadb | Per second averages calculated from the last 60 seconds
mariadb | -----------------
mariadb | BACKGROUND THREAD
mariadb | -----------------
mariadb | srv_master_thread loops: 3 srv_active, 0 srv_shutdown, 74 srv_idle
mariadb | srv_master_thread log flush and writes: 76
mariadb | ----------
mariadb | SEMAPHORES
mariadb | ----------
mariadb | OS WAIT ARRAY INFO: reservation count 20
mariadb | --Thread 139884474328832 has waited at dict0dict.cc line 880 for 232.00 seconds the semaphore:
mariadb | Mutex at 0x556c68691100, Mutex DICT_SYS created dict0dict.cc:824, lock var 2
mariadb |
mariadb | --Thread 139874768164608 has waited at srv0srv.cc line 2011 for 242.00 seconds the semaphore:
mariadb | X-lock on RW-latch at 0x556c68691130 created in file dict0dict.cc line 833
mariadb | a writer (thread id 139875057460992) has reserved it in mode exclusive
mariadb | number of readers 0, waiters flag 1, lock_word: 0
mariadb | Last time write locked in file dict0stats.cc line 2486
mariadb | OS WAIT ARRAY INFO: signal count 13
mariadb | RW-shared spins 19, rounds 487, OS waits 13
mariadb | RW-excl spins 17, rounds 103, OS waits 2
mariadb | RW-sx spins 0, rounds 0, OS waits 0
mariadb | Spin rounds per wait: 25.63 RW-shared, 6.06 RW-excl, 0.00 RW-sx
mariadb | ------------
mariadb | TRANSACTIONS
mariadb | ------------
mariadb | Trx id counter 2908999983
mariadb | Purge done for trx's n:o < 2908999981 undo n:o < 0 state: running but idle
mariadb | History list length 4
mariadb | LIST OF TRANSACTIONS FOR EACH SESSION:
mariadb | ---TRANSACTION 421359460385048, COMMITTED IN MEMORY flushing log
mariadb | 0 lock struct(s), heap size 1128, 0 row lock(s), undo log entries 2
mariadb | ---TRANSACTION 421359460380824, not started
mariadb | 0 lock struct(s), heap size 1128, 0 row lock(s)
mariadb | --------
mariadb | FILE I/O
mariadb | --------
mariadb | I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
mariadb | I/O thread 1 state: waiting for completed aio requests (log thread)
mariadb | I/O thread 2 state: waiting for completed aio requests (read thread)
mariadb | I/O thread 3 state: waiting for completed aio requests (read thread)
mariadb | I/O thread 4 state: waiting for completed aio requests (read thread)
mariadb | I/O thread 5 state: waiting for completed aio requests (read thread)
mariadb | I/O thread 6 state: waiting for completed aio requests (write thread)
mariadb | I/O thread 7 state: waiting for completed aio requests (write thread)
mariadb | I/O thread 8 state: waiting for completed aio requests (write thread)
mariadb | I/O thread 9 state: waiting for completed aio requests (write thread)
mariadb | Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
mariadb | ibuf aio reads:, log i/o's:, sync i/o's:
mariadb | Pending flushes (fsync) log: 0; buffer pool: 0
mariadb | 129125 OS file reads, 323 OS file writes, 57 OS fsyncs
mariadb | 0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
mariadb | -------------------------------------
mariadb | INSERT BUFFER AND ADAPTIVE HASH INDEX
mariadb | -------------------------------------
mariadb | Ibuf: size 1, free list len 4026, seg size 4028, 0 merges
mariadb | merged operations:
mariadb | insert 0, delete mark 0, delete 0
mariadb | discarded operations:
mariadb | insert 0, delete mark 0, delete 0
mariadb | Hash table size 2212699, node heap has 0 buffer(s)
mariadb | Hash table size 2212699, node heap has 0 buffer(s)
mariadb | Hash table size 2212699, node heap has 0 buffer(s)
mariadb | Hash table size 2212699, node heap has 0 buffer(s)
mariadb | Hash table size 2212699, node heap has 2 buffer(s)
mariadb | Hash table size 2212699, node heap has 2 buffer(s)
mariadb | Hash table size 2212699, node heap has 2 buffer(s)
mariadb | Hash table size 2212699, node heap has 3 buffer(s)
mariadb | 0.00 hash searches/s, 0.00 non-hash searches/s
mariadb | ---
mariadb | LOG
mariadb | ---
mariadb | Log sequence number 1202450201026
mariadb | Log flushed up to 1202450200636
mariadb | Pages flushed up to 1202450196728
mariadb | Last checkpoint at 1202450196719
mariadb | 1 pending log flushes, 0 pending chkp writes
mariadb | 35 log i/o's done, 0.00 log i/o's/second
mariadb | ----------------------
mariadb | BUFFER POOL AND MEMORY
mariadb | ----------------------
mariadb | Total large memory allocated 8606711808
mariadb | Dictionary memory allocated 407480
mariadb | Buffer pool size 513728
mariadb | Free buffers 384737
mariadb | Database pages 128982
mariadb | Old database pages 47768
mariadb | Modified db pages 136
mariadb | Percent of dirty pages(LRU & free pages): 0.026
mariadb | Max dirty pages percent: 75.000
mariadb | Pending reads 0
mariadb | Pending writes: LRU 0, flush list 20, single page 0
mariadb | Pages made young 0, not young 0
mariadb | 0.00 youngs/s, 0.00 non-youngs/s
mariadb | Pages read 128851, created 131, written 282
mariadb | 0.00 reads/s, 0.00 creates/s, 0.00 writes/s
mariadb | No buffer pool page gets since the last printout
mariadb | Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
mariadb | LRU len: 128982, unzip_LRU len: 0
mariadb | I/O sum[0]:cur[0], unzip sum[0]:cur[0]
mariadb | ----------------------
mariadb | INDIVIDUAL BUFFER POOL INFO
mariadb | ----------------------
mariadb | ---BUFFER POOL 0
mariadb | Buffer pool size 64216
mariadb | Free buffers 48110
mariadb | Database pages 16104
mariadb | Old database pages 5964
mariadb | Modified db pages 20
mariadb | Percent of dirty pages(LRU & free pages): 0.031
mariadb | Max dirty pages percent: 75.000
mariadb | Pending reads 0
mariadb | Pending writes: LRU 0, flush list 20, single page 0
mariadb | Pages made young 0, not young 0
mariadb | 0.00 youngs/s, 0.00 non-youngs/s
mariadb | Pages read 16100, created 4, written 31
mariadb | 0.00 reads/s, 0.00 creates/s, 0.00 writes/s
mariadb | No buffer pool page gets since the last printout
mariadb | Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
mariadb | LRU len: 16104, unzip_LRU len: 0
mariadb | I/O sum[0]:cur[0], unzip sum[0]:cur[0]
mariadb | ---BUFFER POOL 1
mariadb | Buffer pool size 64216
mariadb | Free buffers 48038
mariadb | Database pages 16177
mariadb | Old database pages 5991
mariadb | Modified db pages 5
mariadb | Percent of dirty pages(LRU & free pages): 0.008
mariadb | Max dirty pages percent: 75.000
mariadb | Pending reads 0
mariadb | Pending writes: LRU 0, flush list 0, single page 0
mariadb | Pages made young 0, not young 0
mariadb | 0.00 youngs/s, 0.00 non-youngs/s
mariadb | Pages read 16177, created 0, written 8
mariadb | 0.00 reads/s, 0.00 creates/s, 0.00 writes/s
mariadb | No buffer pool page gets since the last printout
mariadb | Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
mariadb | LRU len: 16177, unzip_LRU len: 0
mariadb | I/O sum[0]:cur[0], unzip sum[0]:cur[0]
mariadb | ---BUFFER POOL 2
mariadb | Buffer pool size 64216
mariadb | Free buffers 48125
mariadb | Database pages 16089
mariadb | Old database pages 5959
mariadb | Modified db pages 0
mariadb | Percent of dirty pages(LRU & free pages): 0.000
mariadb | Max dirty pages percent: 75.000
mariadb | Pending reads 0
mariadb | Pending writes: LRU 0, flush list 0, single page 0
mariadb | Pages made young 0, not young 0
mariadb | 0.00 youngs/s, 0.00 non-youngs/s
mariadb | Pages read 16089, created 0, written 0
mariadb | 0.00 reads/s, 0.00 creates/s, 0.00 writes/s
mariadb | No buffer pool page gets since the last printout
mariadb | Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
mariadb | LRU len: 16089, unzip_LRU len: 0
mariadb | I/O sum[0]:cur[0], unzip sum[0]:cur[0]
mariadb | ---BUFFER POOL 3
mariadb | Buffer pool size 64216
mariadb | Free buffers 48078
mariadb | Database pages 16137
mariadb | Old database pages 5976
mariadb | Modified db pages 64
mariadb | Percent of dirty pages(LRU & free pages): 0.100
mariadb | Max dirty pages percent: 75.000
mariadb | Pending reads 0
mariadb | Pending writes: LRU 0, flush list 0, single page 0
mariadb | Pages made young 0, not young 0
mariadb | 0.00 youngs/s, 0.00 non-youngs/s
mariadb | Pages read 16137, created 0, written 65
mariadb | 0.00 reads/s, 0.00 creates/s, 0.00 writes/s
mariadb | No buffer pool page gets since the last printout
mariadb | Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
mariadb | LRU len: 16137, unzip_LRU len: 0
mariadb | I/O sum[0]:cur[0], unzip sum[0]:cur[0]
mariadb | ---BUFFER POOL 4
mariadb | Buffer pool size 64216
mariadb | Free buffers 48092
mariadb | Database pages 16124
mariadb | Old database pages 5972
mariadb | Modified db pages 46
mariadb | Percent of dirty pages(LRU & free pages): 0.072
mariadb | Max dirty pages percent: 75.000
mariadb | Pending reads 0
mariadb | Pending writes: LRU 0, flush list 0, single page 0
mariadb | Pages made young 0, not young 0
mariadb | 0.00 youngs/s, 0.00 non-youngs/s
mariadb | Pages read 16124, created 0, written 46
mariadb | 0.00 reads/s, 0.00 creates/s, 0.00 writes/s
mariadb | No buffer pool page gets since the last printout
mariadb | Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
mariadb | LRU len: 16124, unzip_LRU len: 0
mariadb | I/O sum[0]:cur[0], unzip sum[0]:cur[0]
mariadb | ---BUFFER POOL 5
mariadb | Buffer pool size 64216
mariadb | Free buffers 48143
mariadb | Database pages 16071
mariadb | Old database pages 5952
mariadb | Modified db pages 1
mariadb | Percent of dirty pages(LRU & free pages): 0.002
mariadb | Max dirty pages percent: 75.000
mariadb | Pending reads 0
mariadb | Pending writes: LRU 0, flush list 0, single page 0
mariadb | Pages made young 0, not young 0
mariadb | 0.00 youngs/s, 0.00 non-youngs/s
mariadb | Pages read 16071, created 0, written 1
mariadb | 0.00 reads/s, 0.00 creates/s, 0.00 writes/s
mariadb | No buffer pool page gets since the last printout
mariadb | Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
mariadb | LRU len: 16071, unzip_LRU len: 0
mariadb | I/O sum[0]:cur[0], unzip sum[0]:cur[0]
mariadb | ---BUFFER POOL 6
mariadb | Buffer pool size 64216
mariadb | Free buffers 48087
mariadb | Database pages 16129
mariadb | Old database pages 5973
mariadb | Modified db pages 0
mariadb | Percent of dirty pages(LRU & free pages): 0.000
mariadb | Max dirty pages percent: 75.000
mariadb | Pending reads 0
mariadb | Pending writes: LRU 0, flush list 0, single page 0
mariadb | Pages made young 0, not young 0
mariadb | 0.00 youngs/s, 0.00 non-youngs/s
mariadb | Pages read 16066, created 63, written 63
mariadb | 0.00 reads/s, 0.00 creates/s, 0.00 writes/s
mariadb | No buffer pool page gets since the last printout
mariadb | Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
mariadb | LRU len: 16129, unzip_LRU len: 0
mariadb | I/O sum[0]:cur[0], unzip sum[0]:cur[0]
mariadb | ---BUFFER POOL 7
mariadb | Buffer pool size 64216
mariadb | Free buffers 48064
mariadb | Database pages 16151
mariadb | Old database pages 5981
mariadb | Modified db pages 0
mariadb | Percent of dirty pages(LRU & free pages): 0.000
mariadb | Max dirty pages percent: 75.000
mariadb | Pending reads 0
mariadb | Pending writes: LRU 0, flush list 0, single page 0
mariadb | Pages made young 0, not young 0
mariadb | 0.00 youngs/s, 0.00 non-youngs/s
mariadb | Pages read 16087, created 64, written 68
mariadb | 0.00 reads/s, 0.00 creates/s, 0.00 writes/s
mariadb | No buffer pool page gets since the last printout
mariadb | Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
mariadb | LRU len: 16151, unzip_LRU len: 0
mariadb | I/O sum[0]:cur[0], unzip sum[0]:cur[0]
mariadb | --------------
mariadb | ROW OPERATIONS
mariadb | --------------
mariadb | 0 queries inside InnoDB, 0 queries in queue
mariadb | 0 read views open inside InnoDB
mariadb | Process ID=1, Main thread ID=139874768164608, state: enforcing dict cache limit
mariadb | Number of rows inserted 0, updated 0, deleted 0, read 200
mariadb | 0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
mariadb | Number of system rows inserted 5, updated 0, deleted 4, read 9
mariadb | 0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
mariadb | ----------------------------
mariadb | END OF INNODB MONITOR OUTPUT
mariadb | ============================
Well, unfortunately, you did not include an error. Or that's what it looks like. The output that you have included is nothing out of ordinary - this is a result of a SHOW ENGINE INNODB STATUS; command, which exposes some of the internals. Based on this, it shows that you have a fairly unused server with very limited traffic. There were two transactions running, one of them got locked on some of the rows. You still have free memory in the InnoDB buffer pool. Nothing that would point towards any issues.
In general, the problem with the Galera cluster could be that the second node did not join the cluster properly. Unless all nodes are in "Primary" state, as shown in the output of SHOW STATUS LIKE 'wsrep_cluster_status'; If the node is not in the primary state, you won't be able to run queries against that node (unless you have set wsrep_dirty_reads, then you can run SELECTs, but that's another story). This is intended to ensure that you won't be getting stale reads (dataset on the non-Primary node is outdated as it is not part of the cluster).

After upgrading to MySQL 8. Total large memory allocated = 0

So maybe I missed something but I haven't found an answer yet.. I upgraded from MySQL 5.7 to 8 and using the same my.cnf file. When I run "show engine innodb status\G", it shows Total large memory allocated = 0.
In MySQL 5.7, Total large memory allocated = 87912611840
Can someone clear this up for me? TIA
Details...
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 0
Dictionary memory allocated 375221
Buffer pool size 5242410
Free buffers 5229168
Database pages 13236
Old database pages 5040
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 13094, created 142, written 158
778.00 reads/s, 0.06 creates/s, 10.18 writes/s
Buffer pool hit rate 571 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 13236, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
my.cnf
[mysqld]
socket=/var/lib/mysql/mysql.sock
user=mysql
performance_schema=ON
datadir=/var/lib/mysql
#tmpdir=/var/lib/tmp
skip-name-resolve
key_buffer_size = 20M
max_allowed_packet = 64M
tmp_table_size = 512M
max_heap_table_size = 512M
join_buffer_size = 1M
ft_min_word_len = 3
bulk_insert_buffer_size = 32M
# InnoDB Settings
innodb_data_file_path = ibdata1:10M:autoextend
innodb_buffer_pool_size = 80G
default_storage_engine=InnoDB
innodb_log_file_size = 256M # default: 48M
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
sql_mode = ''
log-error=/var/log/mysqld.log
[mysqld_safe]
pid-file=/var/run/mysqld/mysqld.pid
open-files-limit=98304
mysql> show variables like 'innodb_buffer%';
+-------------------------------------+----------------+
| Variable_name | Value |
+-------------------------------------+----------------+
| innodb_buffer_pool_chunk_size | 134217728 |
| innodb_buffer_pool_dump_at_shutdown | ON |
| innodb_buffer_pool_dump_now | OFF |
| innodb_buffer_pool_dump_pct | 25 |
| innodb_buffer_pool_filename | ib_buffer_pool |
| innodb_buffer_pool_in_core_file | ON |
| innodb_buffer_pool_instances | 8 |
| innodb_buffer_pool_load_abort | OFF |
| innodb_buffer_pool_load_at_startup | ON |
| innodb_buffer_pool_load_now | OFF |
| innodb_buffer_pool_size | 85899345920 |
+-------------------------------------+----------------+

mysql crashing on queries to some tables

We are running mariadb 10.3.25:
$ mysql --version
mysql Ver 15.1 Distrib 10.3.25-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
It seems that there is some sort of corruption in some of our databases’ tables.
Exhibit A:
MariaDB [etherpad]> select * from store;
ERROR 2013 (HY000): Lost connection to MySQL server during query
In the meantime, this happens in the log:
Jan 16 19:51:52 hostname mysqld[31236]: 2021-01-16 19:51:52 0x7f0c884b8700 InnoDB: Assertion failure in file /build/mariadb-10.3-RRxkin/mariadb-10.3-10.3.25/storage/innobase/row/row0sel.cc line 2972
Jan 16 19:51:52 hostname mysqld[31236]: InnoDB: Failing assertion: prebuilt->trx->isolation_level == TRX_ISO_READ_UNCOMMITTED
Jan 16 19:51:52 hostname mysqld[31236]: InnoDB: We intentionally generate a memory trap.
Jan 16 19:51:52 hostname mysqld[31236]: InnoDB: [...]
Jan 16 19:51:52 hostname mysqld[31236]: 210116 19:51:52 [ERROR] mysqld got signal 6 ;
Jan 16 19:51:52 hostname mysqld[31236]: This could be because you hit a bug. It is also possible that this binary
Jan 16 19:51:52 hostname mysqld[31236]: or one of the libraries it was linked against is corrupt, improperly built,
Jan 16 19:51:52 hostname mysqld[31236]: or misconfigured. This error can also be caused by malfunctioning hardware.
Jan 16 19:51:52 hostname mysqld[31236]: [...]
Jan 16 19:51:52 hostname mysqld[31236]: We will try our best to scrape up some info that will hopefully help
Jan 16 19:51:52 hostname mysqld[31236]: diagnose the problem, but since we have already crashed,
Jan 16 19:51:52 hostname mysqld[31236]: something is definitely wrong and this may fail.
Jan 16 19:51:52 hostname mysqld[31236]: Server version: 10.3.25-MariaDB-0+deb10u1-log
Jan 16 19:51:52 hostname mysqld[31236]: key_buffer_size=16777216
Jan 16 19:51:52 hostname mysqld[31236]: read_buffer_size=131072
Jan 16 19:51:52 hostname mysqld[31236]: key_buffer_size=16777216 [55/647]
Jan 16 19:51:52 hostname mysqld[31236]: read_buffer_size=131072
Jan 16 19:51:52 hostname mysqld[31236]: max_used_connections=16
Jan 16 19:51:52 hostname mysqld[31236]: max_threads=153
Jan 16 19:51:52 hostname mysqld[31236]: thread_count=22
Jan 16 19:51:52 hostname mysqld[31236]: It is possible that mysqld could use up to
Jan 16 19:51:52 hostname mysqld[31236]: key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 352736 K bytes of memory
Jan 16 19:51:52 hostname mysqld[31236]: Hope that's ok; if not, decrease some variables in the equation.
Jan 16 19:51:52 hostname mysqld[31236]: Thread pointer: 0x7f0c500093b8
Jan 16 19:51:52 hostname mysqld[31236]: Attempting backtrace. You can use the following information to find out
Jan 16 19:51:52 hostname mysqld[31236]: where mysqld died. If you see no messages after this, something went
Jan 16 19:51:52 hostname mysqld[31236]: terribly wrong...
Jan 16 19:51:52 hostname mysqld[31236]: stack_bottom = 0x7f0c884b7dd8 thread_stack 0x30000
Jan 16 19:51:52 hostname mysqld[31236]: /usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x563337b2b05e]
Jan 16 19:51:52 hostname mysqld[31236]: /usr/sbin/mysqld(handle_fatal_signal+0x54d)[0x56333765e09d]
Jan 16 19:51:53 hostname mysqld[31236]: /lib/x86_64-linux-gnu/libpthread.so.0(+0x12730)[0x7f0c91ef1730]
Jan 16 19:51:53 hostname mysqld[31236]: /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x10b)[0x7f0c914ae7bb]
Jan 16 19:51:53 hostname mysqld[31236]: /lib/x86_64-linux-gnu/libc.so.6(abort+0x121)[0x7f0c91499535]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(+0x4e3433)[0x5633373a2433]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(+0x4d5d6c)[0x563337394d6c]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(+0x9d8814)[0x563337897814]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(+0x9dcdcf)[0x56333789bdcf]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(+0x918681)[0x5633377d7681]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(_ZN7handler11ha_rnd_nextEPh+0x127)[0x563337662db7]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(_Z13rr_sequentialP11READ_RECORD+0x1c)[0x56333776a43c]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x1e3)[0x5633374bdf03]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(_ZN4JOIN10exec_innerEv+0xaaa)[0x5633374e01ba]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(_ZN4JOIN4execEv+0x33)[0x5633374e03d3]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex+0xef)[0x5633374deaaf]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x14d)[0x5633374df38d]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(+0x5c1d8c)[0x563337480d8c]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x5857)[0x56333748d087]
Jan 16 19:51:53 hostname mysqld[31236]: /usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_statebb+0x1c9)[0x56333748f879]
Jan 16 19:51:54 hostname mysqld[31236]: /usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x111d)[0x56333749172d]
Jan 16 19:51:54 hostname mysqld[31236]: /usr/sbin/mysqld(_Z10do_commandP3THD+0x122)[0x563337492e82]
Jan 16 19:51:54 hostname mysqld[31236]: /usr/sbin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x23a)[0x5633375641ba]
Jan 16 19:51:54 hostname mysqld[31236]: /usr/sbin/mysqld(handle_one_connection+0x3d)[0x56333756433d]
Jan 16 19:51:55 hostname mysqld[31236]: /lib/x86_64-linux-gnu/libpthread.so.0(+0x7fa3)[0x7f0c91ee6fa3]
Jan 16 19:51:55 hostname mysqld[31236]: /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f0c915704cf]
Jan 16 19:51:55 hostname mysqld[31236]: Trying to get some variables.
Jan 16 19:51:55 hostname mysqld[31236]: Some pointers may be invalid and cause the dump to abort.
Jan 16 19:51:55 hostname mysqld[31236]: Query (0x7f0c50012e20): select * from store
Jan 16 19:51:55 hostname mysqld[31236]: Connection ID (thread ID): 733
Jan 16 19:51:55 hostname mysqld[31236]: Status: NOT_KILLED
Jan 16 19:51:55 hostname mysqld[31236]: Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,de
rived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_joi
n_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_d
erived=on,split_materialized=on
Jan 16 19:51:55 hostname mysqld[31236]: The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
Jan 16 19:51:55 hostname mysqld[31236]: information that should help you find out what is causing the crash.
Jan 16 19:51:55 hostname mysqld[31236]: Writing a core file...
Jan 16 19:51:55 hostname mysqld[31236]: Working directory at /var/lib/mysql
Jan 16 19:51:55 hostname mysqld[31236]: Resource Limits:
Jan 16 19:51:55 hostname mysqld[31236]: Limit Soft Limit Hard Limit Units
Jan 16 19:51:55 hostname mysqld[31236]: Max cpu time unlimited unlimited seconds
Jan 16 19:51:55 hostname mysqld[31236]: Max file size unlimited unlimited bytes
Jan 16 19:51:55 hostname mysqld[31236]: Max data size unlimited unlimited bytes
Jan 16 19:51:55 hostname mysqld[31236]: Max file size unlimited unlimited bytes [0/647]
Jan 16 19:51:55 hostname mysqld[31236]: Max data size unlimited unlimited bytes
Jan 16 19:51:55 hostname mysqld[31236]: Max stack size 8388608 unlimited bytes
Jan 16 19:51:55 hostname mysqld[31236]: Max core file size 0 unlimited bytes
Jan 16 19:51:55 hostname mysqld[31236]: Max resident set unlimited unlimited bytes
Jan 16 19:51:55 hostname mysqld[31236]: Max processes 15390 15390 processes
Jan 16 19:51:55 hostname mysqld[31236]: Max open files 65536 65536 files
Jan 16 19:51:55 hostname mysqld[31236]: Max locked memory 65536 65536 bytes
Jan 16 19:51:55 hostname mysqld[31236]: Max address space unlimited unlimited bytes
Jan 16 19:51:55 hostname mysqld[31236]: Max file locks unlimited unlimited locks
Jan 16 19:51:55 hostname mysqld[31236]: Max pending signals 15390 15390 signals
Jan 16 19:51:55 hostname mysqld[31236]: Max msgqueue size 819200 819200 bytes
Jan 16 19:51:55 hostname mysqld[31236]: Max nice priority 0 0
Jan 16 19:51:55 hostname mysqld[31236]: Max realtime priority 0 0
Jan 16 19:51:55 hostname mysqld[31236]: Max realtime timeout unlimited unlimited us
Jan 16 19:51:55 hostname mysqld[31236]: Core pattern: core
Jan 16 19:52:02 hostname mysqld[6672]: [... innodb crash recovery ...]
A very similar thing happens with some other tables as well.
What I tried:
I wanted to dump all data, purge the entire mariadb installation and restore. Unsurprisingly, mysqldump runs into the same corruption (?) and the database crashes during the dump.
I tried following a guide that advises to create a MyISAM table and fill that with data from the innodb table, but this fails for the same reason.
What can be done about this? Naturally, we need the data in these tables. It appears that once the query hits a certain record/block (I am oblivious to inner workings of mysql) it crashes the server. So how do we salvage the data?
UPDATE 2021-01-18 as requested, here are the variables and status queries:
MariaDB [(none)]> show global variables like '%thread%';
+-----------------------------------------+---------------------------+
| Variable_name | Value |
+-----------------------------------------+---------------------------+
| aria_repair_threads | 1 |
| binlog_optimize_thread_scheduling | ON |
| debug_no_thread_alarm | OFF |
| innodb_encryption_threads | 0 |
| innodb_purge_threads | 4 |
| innodb_read_io_threads | 4 |
| innodb_thread_concurrency | 0 |
| innodb_thread_sleep_delay | 10000 |
| innodb_write_io_threads | 4 |
| max_delayed_threads | 20 |
| max_insert_delayed_threads | 20 |
| myisam_repair_threads | 1 |
| performance_schema_max_thread_classes | 50 |
| performance_schema_max_thread_instances | -1 |
| slave_domain_parallel_threads | 0 |
| slave_parallel_threads | 0 |
| thread_cache_size | 8 |
| thread_concurrency | 10 |
| thread_handling | one-thread-per-connection |
| thread_pool_idle_timeout | 60 |
| thread_pool_max_threads | 65536 |
| thread_pool_oversubscribe | 3 |
| thread_pool_prio_kickup_timer | 1000 |
| thread_pool_priority | auto |
| thread_pool_size | 1 |
| thread_pool_stall_limit | 500 |
| thread_stack | 196608 |
| wsrep_slave_threads | 1 |
+-----------------------------------------+---------------------------+
28 rows in set (0.001 sec)
MariaDB [(none)]> show global status like '%thread%';
+------------------------------------------+-------+
| Variable_name | Value |
+------------------------------------------+-------+
| Delayed_insert_threads | 0 |
| Performance_schema_thread_classes_lost | 0 |
| Performance_schema_thread_instances_lost | 0 |
| Slow_launch_threads | 0 |
| Threadpool_idle_threads | 0 |
| Threadpool_threads | 0 |
| Threads_cached | 7 |
| Threads_connected | 12 |
| Threads_created | 98 |
| Threads_running | 6 |
| wsrep_applier_thread_count | 0 |
| wsrep_rollbacker_thread_count | 0 |
| wsrep_thread_count | 0 |
+------------------------------------------+-------+
13 rows in set (0.001 sec)
MariaDB [(none)]> show global variables like '%timeout%';
+---------------------------------------+----------+
| Variable_name | Value |
+---------------------------------------+----------+
| connect_timeout | 10 |
| deadlock_timeout_long | 50000000 |
| deadlock_timeout_short | 10000 |
| delayed_insert_timeout | 300 |
| idle_readonly_transaction_timeout | 0 |
| idle_transaction_timeout | 0 |
| idle_write_transaction_timeout | 0 |
| innodb_flush_log_at_timeout | 1 |
| innodb_lock_wait_timeout | 50 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| lock_wait_timeout | 86400 |
| net_read_timeout | 600 |
| net_write_timeout | 600 |
| rpl_semi_sync_master_timeout | 10000 |
| rpl_semi_sync_slave_kill_conn_timeout | 5 |
| slave_net_timeout | 60 |
| thread_pool_idle_timeout | 60 |
| wait_timeout | 28800 |
+---------------------------------------+----------+
19 rows in set (0.001 sec)
MariaDB [(none)]> show global status like '%timeout%';
+-------------------------------------+-------+
| Variable_name | Value |
+-------------------------------------+-------+
| Binlog_group_commit_trigger_timeout | 0 |
| Master_gtid_wait_timeouts | 0 |
| Ssl_default_timeout | 0 |
| Ssl_session_cache_timeouts | 0 |
+-------------------------------------+-------+
4 rows in set (0.001 sec)
MariaDB [(none)]> show global status like '%aborted%';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| Aborted_clients | 3 |
| Aborted_connects | 0 |
+------------------+-------+
2 rows in set (0.001 sec)
The server has 5 GB of RAM.
About the store table:
MariaDB [etherpad]> show create table store;
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| store | CREATE TABLE `store` (
`key` varchar(100) COLLATE utf8_bin NOT NULL DEFAULT '',
`value` longtext COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin |
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)
MariaDB [etherpad]> select count(*) from store;
+----------+
| count(*) |
+----------+
| 779443 |
+----------+
1 row in set (1 min 19.378 sec)
Here is the iostat info:
$ iostat -xm 5 3
Linux 4.14.0-0.bpo.3-amd64 (hostname) 01/18/2021 _x86_64_ (1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
8.63 2.39 16.53 22.68 0.23 49.54
Device r/s w/s rMB/s wMB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util
xvdap2 7.67 37.91 0.07 0.67 0.13 37.91 1.67 50.00 16.35 2.54 0.05 9.40 18.01 4.35 19.82
xvdap1 0.51 1.25 0.00 0.01 0.02 0.07 3.58 5.64 7.52 27.01 0.03 4.15 4.24 1.63 0.29
avg-cpu: %user %nice %system %iowait %steal %idle
18.51 2.21 15.49 55.33 0.40 8.05
Device r/s w/s rMB/s wMB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util
xvdap2 4.00 157.80 0.02 1.53 0.00 71.00 0.00 31.03 5.80 55.33 7.93 4.00 9.92 4.37 70.72
xvdap1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
avg-cpu: %user %nice %system %iowait %steal %idle
8.96 2.44 15.68 15.27 0.41 57.23
Device r/s w/s rMB/s wMB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util
xvdap2 0.00 22.20 0.00 0.40 0.00 35.40 0.00 61.46 0.00 22.81 0.30 0.00 18.27 4.11 9.12
xvdap1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
UPDATE 2021-01-24: I tried to pinpoint the problem by quasy-bisecting the table with limit clauses and found that out of the ~800,000 records, every query that selects records after 663,187 crashes the DB. The few records preceding the 663,187. one contain seemingly mangled data, see below.
MariaDB [etherpad]> select * from store limit 663184, 1\G;
*************************** 1. row ***************************
key:
value:
f[Y
f[팩
Does this not hint at data corruption? What could I do about the problem? Get rid of these records?
From the information available at this time, consider in your my.cnf [mysqld] section
innodb_buffer_pool_size=2G # to use 40% of available RAM
REMOVE thread_cache_size to allow default sizing (or set it to 256)
REMOVE thread_stack to allow default calc of slightly larger thread_stack per ref man
When we know number of cores/cpus we may be able to provide additional suggestions.
When more than 1 cpu's are available, additional suggestions could be provided.
Your query: select count(*) from store;
may complete in less than a minute if your tried
SELECT COUNT(key) FROM store;
to only cause reading of the index, rather than every row.
Have a GREAT 2021.

Mysql CPU usage during update operation

I am facing an issue with high mysql load in particularly whole of the CPU gets consumed. We have 16core cpu's. A job runs which imports certain data in csv format to database. When this starts the CPU goes high and mysql gets hung. Below
INNODB ENGINE STATUS
mysql> show engine innodb status\G;
*************************** 1. row ***************************
Type: InnoDB
Name:
Status:
=====================================
180614 21:27:28 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 27 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 1113759 1_second, 1113758 sleeps, 111273 10_second, 1177 background, 1177 flush
srv_master_thread log flush and writes: 1120485
----------
SpgaPHORES
----------
OS WAIT ARRAY INFO: reservation count 6324138, signal count 163497140
Mutex spin waits 3563712357, rounds 2684759736, OS waits 3547098
RW-shared spins 28930883, rounds 72633117, OS waits 977277
RW-excl spins 8651762, rounds 274697595, OS waits 1300580
Spin rounds per wait: 0.75 mutex, 2.51 RW-shared, 31.75 RW-excl
------------------------
LATEST DETECTED DEADLOCK
------------------------
180609 5:00:01
*** (1) TRANSACTION:
TRANSACTION 192A64A2D3, ACTIVE 1 sec starting index read
UPDATE products SET hjmpTS = 80060 ,modifiedTS='2018-06-09 05:00:01' WHERE GK = 8816144056321
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 971922 page no 31354 n bits 136 index `PRIMARY` of table `pgagmcb_prd`.`products` trx id 192A64ACB2 lock_mode X locks rec but not gap
*** WE ROLL BACK TRANSACTION (1)
------------
TRANSACTIONS
------------
Trx id counter 19C4CE52B2
Purge done for trx's n:o < 19C4CE1594 undo n:o < 0
History list length 821
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0, not started
MySQL thread id 392730, OS thread handle 0x7f09af186700, query id 5877276140 localhost root
show engine innodb status
---TRANSACTION 19C4CE4A6D, not started
MySQL thread id 392695, OS thread handle 0x7f09c5bef700, query id 5877273919 prgkptomcat02 118.21.1.11 pgag_oauth_prd
---TRANSACTION 19C4CA0181, not started
MySQL thread id 392677, OS thread handle 0x7f09c8a5d700, query id 5876980085 prgkptomcat04 118.21.1.13 pgag_oauth_prd
---TRANSACTION 19C4CE52B1, not started
MySQL thread id 392667, OS thread handle 0x7f09aebf0700, query id 5877276137 prgkptomcat04 118.21.1.13 pgagmcb_prd
---TRANSACTION 19C4CDC68D, not started
MySQL thread id 392642, OS thread handle 0x7f11a4161700, query id 5877238586 118.21.1.14 pgagmcb_prd
---TRANSACTION 19C4CDBF35, not started
MySQL thread id 392641, OS thread handle 0x7f09af0c3700, query id 5877236562 118.21.1.14 pgagmcb_prd
---TRANSACTION 19C4C412C3, not started
MySQL thread id 392586, OS thread handle 0x7f09c5a28700, query id 5876568407 prgkptomcat02 118.21.1.11 pgagmcb_prd
---TRANSACTION 19C4C70266, not started
MySQL thread id 392584, OS thread handle 0x7f09ae966700, query id 5876773008 prgkptomcat02 118.21.1.11 pgagmcb_prd
---TRANSACTION 19C4CAFCC7, not started
MySQL thread id 392525, OS thread handle 0x7f09c43d0700, query id 5877046769 prgkptomcat02 118.21.1.11 pgag_oauth_prd
---TRANSACTION 19C4CAFD1F, not started
MySQL thread id 392523, OS thread handle 0x7f09c8daa700, query id 5877046862 prgkptomcat02 118.21.1.11 pgag_oauth_prd
---TRANSACTION 19C4CAFD07, not started
MySQL thread id 392524, OS thread handle 0x7f09c5820700, query id 5877046837 prgkptomcat02 118.21.1.11 pgag_oauth_prd
---TRANSACTION 19C4CDE3C3, not started
MySQL thread id 392490, OS thread handle 0x7f09c5d75700, query id 5877246447 118.21.1.14 pgag_oauth_prd
---TRANSACTION 19C4CDCB36, not started
MySQL thread id 392485, OS thread handle 0x7f09aefbf700, query id 5877239893 prgkptomcat03 118.21.1.12 pgagmcb_prd
---TRANSACTION 19C4CE52A3, not started
MySQL thread id 392451, OS thread handle 0x7f09af71c700, query id 5877276127 prgkptomcat04 118.21.1.13 pgagmcb_prd
---TRANSACTION 19C4C92CF9, not started
MySQL thread id 392449, OS thread handle 0x7f09c5f7d700, query id 5876922937 prgkptomcat04 118.21.1.13 pgagmcb_prd
---TRANSACTION 19C4CE52A6, not started
MySQL thread id 392442, OS thread handle 0x7f09af38e700, query id 5877276129 prgkptomcat04 118.21.1.13 pgagmcb_prd
---TRANSACTION 19C4CE4F03, not started
MySQL thread id 392421, OS thread handle 0x7f09af30c700, query id 5877275162 prgkptomcat02 118.21.1.11 pgagmcb_prd
---TRANSACTION 19C4C9B259, not started
MySQL thread id 392415, OS thread handle 0x7f09c4597700, query id 5876958837 prgkptomcat02 118.21.1.11 pgagmcb_prd
---TRANSACTION 19C4CAE196, not started
MySQL thread id 392402, OS thread handle 0x7f09c8c65700, query id 5877039508 prgkptomcat01 118.21.1.10 pgagmcb_prd
---TRANSACTION 19C4CE52A1, not started
MySQL thread id 392383, OS thread handle 0x7f09aeaab700, query id 5877276126 prgkptomcat04 118.21.1.13 pgagmcb_prd
---TRANSACTION 19C4CE52AA, not started
MySQL thread id 392382, OS thread handle 0x7f09c4c72700, query id 5877276132 prgkptomcat04 118.21.1.13 pgagmcb_prd
---TRANSACTION 19C4CDBDE9, not started
MySQL thread id 392352, OS thread handle 0x7f09c5082700, query id 5877236203 118.21.1.14 pgagmcb_prd
---TRANSACTION 19C4CE5279, not started
MySQL thread id 392350, OS thread handle 0x7f09c4db7700, query id 5877276084 118.21.1.14 pgagmcb_prd
---TRANSACTION 19C4CDEAEF, not started
MySQL thread id 392323, OS thread handle 0x7f09c48e4700, query id 5877248380 118.21.1.14 pgagmcb_prd
---TRANSACTION 19C4CE52A5, not started
MySQL thread id 392322, OS thread handle 0x7f09c56db700, query id 5877276112 118.21.1.14 pgagmcb_prd
---TRANSACTION 19C4CE4BD9, not started
MySQL thread id 392319, OS thread handle 0x7f09c6523700, query id 5877274310 prgkptomcat02 118.21.1.11 pgagmcb_prd
---TRANSACTION 19C4CC77FB, not started
MySQL thread id 392297, OS thread handle 0x7f09c538e700, query id 5877148868 prgkptomcat02 118.21.1.11 pgagmcb_prd
---TRANSACTION 19C4C70074, not started
MySQL thread id 392296, OS thread handle 0x7f09c8a9e700, query id 5876772482 prgkptomcat02 118.21.1.11 pgagmcb_prd
---TRANSACTION 19C4CD042D, not started
MySQL thread id 392295, OS thread handle 0x7f09ae5d8700, query id 5877186230 prgkptomcat02 118.21.1.11 pgagmcb_prd
---TRANSACTION 19C4CE2C0A, not started
MySQL thread id 392293, OS thread handle 0x7f09c5aeb700, query id 5877265779 118.21.1.14 pgagmcb_prd
---TRANSACTION 19C4CE3571, not started
MySQL thread id 392283, OS thread handle 0x7f09c6627700, query id 5877268313 prgkptomcat04 118.21.1.13 pgagmcb_prd
---TRANSACTION 19C4CC96A6, not started
MySQL thread id 392282, OS thread handle 0x7f09c40c4700, query id 5877156935 prgkptomcat04 118.21.1.13 pgagmcb_prd
---TRANSACTION 19C4C930C7, not started
MySQL thread id 392281, OS thread handle 0x7f09c8e2c700, query id 5876923943 prgkptomcat04 118.21.1.13 pgagmcb_prd
---TRANSACTION 19C4C6F0A5, not started
MySQL thread id 392278, OS thread handle 0x7f09c569a700, query id 5876768228 prgkptomcat02 118.21.1.11 pgagmcb_prd
---TRANSACTION 19C4CC399F, not started
MySQL thread id 392276, OS thread handle 0x7f09c471d700, query id 5877132036 prgkptomcat02 118.21.1.11 pgagmcb_prd
---TRANSACTION 19C4CE52A0, not started
MySQL thread id 392234, OS thread handle 0x7f09c5249700, query id 5877276138 118.21.1.14 pgagmcb_prd Opening tables
SELECT item_t0.GK FROM cartentries item_t0 WHERE ( item_t0.p_order =8995720658987) AND (item_t0.TypeGKString=8796094496850 ) order by item_t0.EntryNumber ASC, item_t0.createdTS ASC
---TRANSACTION 19C4CE369D, not started
MySQL thread id 392232, OS thread handle 0x7f09c8be3700, query id 5877268619 prgkptomcat04 118.21.1.13 pgagmcb_prd
---TRANSACTION 19C4CAE1B0, not started
MySQL thread id 392136, OS thread handle 0x7f09c4d76700, query id 5877039534 prgkptomcat01 118.21.1.10 pgagmcb_prd
---TRANSACTION 19C4CAE1AA, not started
MySQL thread id 392135, OS thread handle 0x7f09c4fbf700, query id 5877039527 prgkptomcat01 118.21.1.10 pgagmcb_prd
---TRANSACTION 19C4CE5272, not started
MySQL thread id 392114, OS thread handle 0x7f09c50c3700, query id 5877276077 prgkptomcat01 118.21.1.10 pgagmcb_prd
---TRANSACTION 19C4CE32D8, not started
MySQL thread id 392027, OS thread handle 0x7f11a409e700, query id 5877267604 prgkptomcat03 118.21.1.12 pgagmcb_prd
---TRANSACTION 19C4CDBDEE, not started
MySQL thread id 391944, OS thread handle 0x7f11a4224700, query id 5877236208 118.21.1.14 pgagmcb_prd
---TRANSACTION 19C4CA0332, not started
MySQL thread id 391874, OS thread handle 0x7f09c5aaa700, query id 5876980541 prgkptomcat04 118.21.1.13 pgag_oauth_prd
---TRANSACTION 19C4CE50B6, not started
MySQL thread id 391814, OS thread handle 0x7f09c5eba700, query id 5877275617 prgkptomcat02 118.21.1.11 pgagmcb_prd
---TRANSACTION 19C4CE1588, not started
MySQL thread id 391776, OS thread handle 0x7f09c5d34700, query id 5877259853 118.21.1.14 pgagmcb_prd
---TRANSACTION 19C4CE52AF, not started
mysql tables in use 1, locked 1
MySQL thread id 391692, OS thread handle 0x7f11a40df700, query id 5877276141 118.21.1.14 pgagmcb_prd init
UPDATE cronjobs SET hjmpTS = 8629763 ,modifiedTS='2018-06-14 21:27:28',p_endtime='2018-06-14 21:27:28' WHERE GK = 8811756159477
Trx read view will not see trx with id >= 19C4CE527F, sees < 19C4CE4C4D
---TRANSACTION 19C4CE524E, ACTIVE 0 sec fetching rows
mysql tables in use 2, locked 0
MySQL thread id 392064, OS thread handle 0x7f09afb2c700, query id 5877276038 prgkptomcat01 118.21.1.10 pgagmcb_prd Sending data
MySQL thread id 392062, OS thread handle 0x7f09c55d7700, query id 5877275109 prgkptomcat01 118.21.1.10 pgagmcb_prd Sending data
SELECT item_t0.GK FROM addresses item_t0 WHERE ( item_t0.p_pkid ='29001499' AND item_t0.p_billingaddress =0 AND item_t0.p_shippingaddress =1) AND (item_t0.TypeGKString=8796094103634 ) UNION ALL SELECT item_t0.GK FROM pointofserviceaddress item_t0 WHERE ( item_t0.p_pkid ='29001499' AND item_t0.p_billingaddress =0 AND item_t0.p_shippingaddress =1) AND (item_t0.TypeGKString=8797338533970 )
Trx read view will not see trx with id >= 19C4CE4ECF, sees < 19C4CE4A1C
---TRANSACTION 19C4CE4EC4, ACTIVE 0 sec
mysql tables in use 2, locked 0
MySQL thread id 392067, OS thread handle 0x7f09affff700, query id 5877275099 prgkptomcat01 118.21.1.10 pgagmcb_prd Sending data
h id >= 19C4CE4C62, sees < 19C4CE48E5
---TRANSACTION 19C4CE4C4D, ACTIVE 0 sec fetching rows
mysql tables in use 2, locked 0
MySQL thread id 392059, OS thread handle 0x7f09c430d700, query id 5877274440 prgkptomcat01 118.21.1.10 emagmcb_prd Sending data
SELECT item_t0.GK FROM addresses item_t0 WHERE ( item_t0.p_pkid ='20087352' AND item_t0.p_billingaddress =0 AND item_t0.p_shippingaddress =1) AND (item_t0.TypeGKString=8796094103634 ) UNION ALL SELECT item_t0.GK FROM pointofserviceaddress item_t0 WHERE ( item_t0.p_pkid ='20087352' AND item_t0.p_billingaddress =0 AND item_t0.p_shippingaddress =1) AND (item_t0.TypeGKString=8797338533970 )
Trx read view will not see trx with id >= 19C4CE4C4E, sees < 19C4CE48E5
--------
FILE I/O
--------
I/O thread 0 state: waiting for i/o request (insert buffer thread)
I/O thread 1 state: waiting for i/o request (log thread)
I/O thread 2 state: waiting for i/o request (read thread)
I/O thread 3 state: waiting for i/o request (read thread)
I/O thread 4 state: waiting for i/o request (read thread)
I/O thread 5 state: waiting for i/o request (read thread)
I/O thread 6 state: waiting for i/o request (write thread)
I/O thread 7 state: waiting for i/o request (write thread)
I/O thread 8 state: waiting for i/o request (write thread)
I/O thread 9 state: waiting for i/o request (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
689458 OS file reads, 21884164 OS file writes, 5163807 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 22.07 writes/s, 5.22 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 156723, seg size 156725, 39554 merges
merged operations:
insert 106864, delete mark 147895, delete 47175
discarded operations:
insert 0, delete mark 0, delete 0
Hash table size 63749393, node heap has 66107 buffer(s)
11918.00 hash searches/s, 20228.44 non-hash searches/s
---
LOG
---
Log sequence number 3872974342573
Log flushed up to 3872974307599
Last checkpoint at 3872972346157
0 pending log writes, 0 pending chkp writes
1520749 log i/o's done, 1.33 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total memory allocated 32967229440; in additional pool allocated 0
Dictionary memory allocated 5343676
Buffer pool size 1966080
Free buffers 901470
Database pages 998503
Old database pages 368568
Modified db pages 1090
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 4341, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 889753, created 108750, written 32815581
0.00 reads/s, 0.15 creates/s, 30.44 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 998503, 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
22 read views open inside InnoDB
Main thread process no. 11805, id 139679969232640, state: sleeping
Number of rows inserted 4605702, updated 110022489, deleted 3897802, read 309526373829
0.81 inserts/s, 49.85 updates/s, 0.56 deletes/s, 1280085.96 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================
[client]
port = 3306
socket = /AB/mysql/logs/mysql.sock
[mysqld]
port = 3306
bind-address = 0.0.0.0
socket = /AB/mysql/logs/mysql.sock
basedir = /AB/mysql
user = mysql
tmpdir = /AB/mysql_temp_files
character-set-server = utf8
datadir = /AB/mysql/data
default-storage-engine = InnoDB
expire_logs_days = 10
general_log = 0
general_log_file = /AB/mysql/logs/general-log.log
innodb_buffer_pool_size = 30G
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 0
key_buffer_size = 16M
log_error = /AB/mysql/logs/mysqld-error.log
log_queries_not_using_indexes = 1
long_query_time = 5
log-bin = /AB/mysql/binlog/mysql-bin
max_allowed_packet = 35M
max_binlog_size = 100M
max_connect_errors = 100000
max_connections = 910
myisam_recover = BACKUP
query_cache_limit = 2M
query_cache_size = 0
query_cache_type = 0
skip-external-locking
slow_query_log = 0
slow_query_log_file = /AB/mysql/logs/mysqld-slow-queries.log
table_open_cache = 256
thread_cache_size = 8
thread_stack = 256K
transaction-isolation = READ-COMMITTED
############################
# MySql replication - Master
############################
server_id = 1
binlog_format = row
binlog-ignore-db=mysql # input the database that should be ignored for replication
binlog-ignore-db=performance_schema
binlog-ignore-db=pkgmcb_eldas
replicate-wild-ignore-table=mysql.% #disable slave replication for mysql db
relay-log = /AB/mysql/mysql-relay-bin
relay-log-index = /AB/mysql/mysql-relay-bin.index
master-info-file = /AB/mysql/mysql-master.info
relay-log-info-file = /AB/mysql/mysql-relay-log-info
[mysqld_safe]
log-error = /AB/mysql/logs/mysqld.log
socket = /AB/mysql/logs/mysql.sock
pid-file = /AB/mysql/logs/mysqld.pid
[mysqldump]
max_allowed_packet = 16M
quick
[mysql]
no_auto_rehash
mysql> show global status;
+------------------------------------------+---------------+
| Variable_name | Value |
+------------------------------------------+---------------+
| Aborted_clients | 13 |
| Aborted_connects | 3753 |
| Binlog_cache_disk_use | 32815 |
| Binlog_cache_use | 92017182 |
| Bytes_received | 1617086123131 |
| Bytes_sent | 2825568326969 |
| Com_admin_commands | 37462 |
| Com_change_db | 2 |
| Com_commit | 128435552 |
| Com_create_table | 18730 |
| Com_delete | 15234374 |
| Com_delete_multi | 37450 |
| Com_drop_table | 18725 |
| Com_insert | 4603989 |
| Com_insert_select | 18725 |
| Com_purge_before_date | 13 |
| Com_rollback | 15159 |
| Com_select | 5360296742 |
| Com_set_option | 257428949 |
| Com_show_charsets | 4 |
| Com_show_collations | 6371 |
| Com_show_engine_status | 4870 |
| Com_show_processlist | 1187 |
| Com_show_status | 95630 |
| Com_show_tables | 21 |
| Com_show_triggers | 0 |
| Com_show_variables | 21400 |
| Com_update | 110599528 |
| Compression | OFF |
| Connections | 392731 |
| Created_tmp_disk_tables | 77030 |
| Created_tmp_files | 445171 |
| Created_tmp_tables | 665507495 |
| Delayed_errors | 0 |
| Delayed_insert_threads | 0 |
| Delayed_writes | 0 |
| Flush_commands | 1 |
| Handler_commit | 5774785433 |
| Handler_delete | 3897802 |
| Handler_discover | 0 |
| Handler_prepare | 402020246 |
| Handler_read_first | 161347921 |
| Handler_read_key | 32213287627 |
| Handler_read_last | 2 |
| Handler_read_next | 47210732684 |
| Handler_read_prev | 32726 |
| Handler_read_rnd | 215354676 |
| Handler_read_rnd_next | 482467384071 |
| Handler_rollback | 170 |
| Handler_savepoint | 0 |
| Handler_savepoint_rollback | 0 |
| Handler_update | 221011669 |
| Handler_write | 21797614285 |
| Innodb_buffer_pool_pages_data | 998503 |
| Innodb_buffer_pool_bytes_data | 16359473152 |
| Innodb_buffer_pool_pages_dirty | 1029 |
| Innodb_buffer_pool_bytes_dirty | 16859136 |
| Innodb_buffer_pool_pages_flushed | 32815553 |
| Innodb_buffer_pool_pages_free | 901470 |
| Innodb_buffer_pool_pages_misc | 66107 |
| Innodb_buffer_pool_pages_total | 1966080 |
| Innodb_buffer_pool_read_ahead_rnd | 0 |
| Innodb_buffer_pool_read_ahead | 207758 |
| Innodb_buffer_pool_read_ahead_evicted | 0 |
| Innodb_buffer_pool_read_requests | 390826699904 |
| Innodb_buffer_pool_reads | 645677 |
| Innodb_buffer_pool_wait_free | 0 |
| Innodb_buffer_pool_write_requests | 887071687 |
| Innodb_data_fsyncs | 5163787 |
| Innodb_data_pending_fsyncs | 0 |
| Innodb_data_pending_reads | 0 |
| Innodb_data_pending_writes | 0 |
| Innodb_data_read | 14588825600 |
| Innodb_data_reads | 689458 |
| Innodb_data_writes | 21884132 |
| Innodb_data_written | 1155002425856 |
| Innodb_dblwr_pages_written | 32815553 |
| Innodb_dblwr_writes | 918315 |
| Innodb_have_atomic_builtins | ON |
| Innodb_log_waits | 0 |
| Innodb_log_write_requests | 234974909 |
| Innodb_log_writes | 1390975 |
| Innodb_os_log_fsyncs | 1505727 |
| Innodb_os_log_pending_fsyncs | 0 |
| Innodb_os_log_pending_writes | 0 |
| Innodb_os_log_written | 79636049408 |
| Innodb_page_size | 16384 |
| Innodb_pages_created | 108750 |
| Innodb_pages_read | 889753 |
| Innodb_pages_written | 32815553 |
| Innodb_row_lock_current_waits | 0 |
| Innodb_row_lock_time | 195660 |
| Innodb_row_lock_time_avg | 0 |
| Innodb_row_lock_time_max | 2243 |
| Innodb_row_lock_waits | 1286068 |
| Innodb_rows_deleted | 3897802 |
| Innodb_rows_inserted | 4605700 |
| Innodb_rows_read | 309520074518 |
| Innodb_rows_updated | 110022225 |
| Innodb_truncated_status_writes | 0 |
| Key_blocks_not_flushed | 0 |
| Key_blocks_unused | 13396 |
| Key_blocks_used | 5921 |
| Key_read_requests | 1782635934 |
| Key_reads | 0 |
| Key_write_requests | 292962271 |
| Key_writes | 0 |
| Last_query_cost | 0.000000 |
| Max_used_connections | 266 |
| Not_flushed_delayed_rows | 0 |
| Open_files | 5 |
| Open_streams | 0 |
| Open_table_definitions | 400 |
| Open_tables | 256 |
| Opened_files | 959559 |
| Opened_table_definitions | 43623 |
| Opened_tables | 21935444 |
| Performance_schema_cond_classes_lost | 0 |
| Performance_schema_cond_instances_lost | 0 |
| Performance_schema_file_classes_lost | 0 |
| Performance_schema_file_handles_lost | 0 |
| Performance_schema_file_instances_lost | 0 |
| Performance_schema_locker_lost | 0 |
| Performance_schema_mutex_classes_lost | 0 |
| Performance_schema_mutex_instances_lost | 0 |
| Performance_schema_rwlock_classes_lost | 0 |
| Performance_schema_rwlock_instances_lost | 0 |
| Performance_schema_table_handles_lost | 0 |
| Performance_schema_table_instances_lost | 0 |
| Performance_schema_thread_classes_lost | 0 |
| Performance_schema_thread_instances_lost | 0 |
| Prepared_stmt_count | 0 |
| Qcache_free_blocks | 0 |
| Qcache_free_memory | 0 |
| Qcache_hits | 0 |
| Qcache_inserts | 0 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 0 |
| Qcache_queries_in_cache | 0 |
| Qcache_total_blocks | 0 |
| Queries | 5877263773 |
| Questions | 5877218009 |
| Rpl_status | AUTH_MASTER |
| Select_full_join | 1085194 |
| Select_full_range_join | 0 |
| Select_range | 106321329 |
| Select_range_check | 0 |
| Select_scan | 491596929 |
| Slave_heartbeat_period | 0.000 |
| Slave_open_temp_tables | 0 |
| Slave_received_heartbeats | 0 |
| Slave_retried_transactions | 0 |
| Slave_running | OFF |
| Slow_launch_threads | 0 |
| Slow_queries | 407546261 |
| Sort_merge_passes | 631000 |
| Sort_range | 4293576025 |
| Sort_rows | 17877617809 |
| Sort_scan | 13049200 |
| Table_locks_immediate | 7035027122 |
| Table_locks_waited | 0 |
| Tc_log_max_pages_used | 0 |
| Tc_log_page_size | 0 |
| Tc_log_page_waits | 7 |
| Threads_cached | 5 |
| Threads_connected | 102 |
| Threads_created | 7052 |
| Threads_running | 21 |
| Uptime | 1123494 |
| Uptime_since_flush_status | 1123494 |
+------------------------------------------+---------------+
289 rows in set (0.00 sec)
Any help is really appreciated. Thanks
Analysis of Global Status and Variables:
Observations:
Version: 5.5.47-log
30 GB of RAM
Uptime = 13d 00:04:54
You are not running on Windows.
Running 64-bit version
You appear to be running entirely (or mostly) InnoDB.
The More Important Issues:
What did you mean by "30G assigned for mysql"? I see that the buffer_pool is set to that. That is reasonable if you have more than 30G of RAM available for all of MySQL. If the 40GB machine is mostly dedicated to MySQL, then 30G for buffer_pool is good.
Time to upgrade to 5.6. The table_cache is being hit rather hard, but table_open_cache_hits and _misses are not available until 5.6. Meanwhile, see if this helps:
table_open_cache = 500
InnoDB's log is churning like mad. Recommend the following. Caution -- it is complex to change:
innodb_log_file_size = 128M
What are you doing to cause so many rows to be deleted? Perhaps you are "reloading" a table? There are faster ways than using DELETE. Tell us what is up so we can tailor a solution.
There are lots of clues of frequent and/or slow queries. Please turn on the slowlog and have the following
log_queries_not_using_indexes = OFF -- ON is just clutter
Don't decrease long_query_time until you have fixed some of the 362 slow queries/sec.
After a day, let's summarize and analyze what is in the slowlog.
Creating and dropping table once a minute? What's up?
tx_isolation = READ-COMMITTED -- What's up?
These will help some:
innodb_buffer_pool_instances = 16
thread_cache_size = 20
join_buffer_size = 256K
Details and other observations:
( Key_blocks_used * 1024 / key_buffer_size ) = 5,921 * 1024 / 16M = 36.1% -- Percent of key_buffer used. High-water-mark.
-- Lower key_buffer_size to avoid unnecessary memory usage.
( innodb_buffer_pool_size / _ram ) = 30720M / 30720M = 100.0% -- % of RAM used for InnoDB buffer_pool
( (key_buffer_size / 0.20 + innodb_buffer_pool_size / 0.70) / _ram ) = (16M / 0.20 + 30720M / 0.70) / 30720M = 143.1% -- Most of available ram should be made available for caching.
-- http://mysql.rjweb.org/doc.php/memory
( Opened_tables ) = 21,935,444 / 1123494 = 20 /sec -- Frequency of opening Tables
-- increase table_open_cache
( innodb_buffer_pool_size / innodb_buffer_pool_instances ) = 30720M / 1 = 30720MB -- Size of each buffer_pool instance.
-- An instance should be at least 1GB. In very large RAM, have 16 instances.
( Innodb_buffer_pool_pages_free / Innodb_buffer_pool_pages_total ) = 901,470 / 1966080 = 45.9% -- Pct of buffer_pool currently not in use
-- innodb_buffer_pool_size is bigger than necessary?
( Innodb_os_log_written / (Uptime / 3600) / innodb_log_files_in_group / innodb_log_file_size ) = 79,636,049,408 / (1123494 / 3600) / 2 / 5M = 24.3 -- Ratio
-- (see minutes)
( Uptime / 60 * innodb_log_file_size / Innodb_os_log_written ) = 1,123,494 / 60 * 5M / 79636049408 = 1.23 -- Minutes between InnoDB log rotations Beginning with 5.6.8, this can be changed dynamically; be sure to also change my.cnf.
-- (The recommendation of 60 minutes between rotations is somewhat arbitrary.) Adjust innodb_log_file_size. (Cannot change in AWS.)
( Innodb_rows_deleted / Innodb_rows_inserted ) = 3,897,802 / 4605700 = 0.846 -- Churn
-- "Don't queue it, just do it." (If MySQL is being used as a queue.)
( Innodb_row_lock_waits ) = 1,286,068 / 1123494 = 1.1 /sec -- How often there is a delay in getting a row lock.
-- May be caused by complex queries that could be optimized.
( innodb_stats_on_metadata ) = ON -- Re-analyze table when touching stats.
-- ON is likely to slow down certain SHOWs and information_schema accesses.
( innodb_thread_concurrency ) = 0 -- 0 = Let InnoDB decide the best for concurrency_tickets.
-- Set to 0 or 64. This may cut back on CPU.
( innodb_print_all_deadlocks ) = OFF -- Whether to log all Deadlocks.
-- If you are plagued with Deadlocks, turn this on. Caution: If you have lots of deadlocks, this may write a lot to disk.
( join_buffer_size / _ram ) = 131,072 / 30720M = 0.00% -- 0-N per thread. May speed up JOINs (better to fix queries/indexes) (all engines) Used for index scan, range index scan, full table scan, each full JOIN, etc.
-- If large, decrease join_buffer_size to avoid memory pressure. Suggest less than 1% of RAM. If small, increase to 0.01% of RAM to improve some queries.
( query_prealloc_size / _ram ) = 8,192 / 30720M = 0.00% -- For parsing. Pct of RAM
( query_alloc_block_size / _ram ) = 8,192 / 30720M = 0.00% -- For parsing. Pct of RAM
( net_buffer_length / max_allowed_packet ) = 16,384 / 35M = 0.04%
( local_infile ) = ON
-- local_infile = ON is a potential security issue
( Questions ) = 5,877,218,009 / 1123494 = 5231 /sec -- Queries (outside SP) -- "qps"
-- >2000 may be stressing server
( Queries ) = 5,877,263,773 / 1123494 = 5231 /sec -- Queries (including inside SP)
-- >3000 may be stressing server
( Created_tmp_tables ) = 665,507,495 / 1123494 = 592 /sec -- Frequency of creating "temp" tables as part of complex SELECTs.
( Com_delete / Com_insert ) = 15,234,374 / 4603989 = 330.9% -- Deletes / Inserts (as a pct). (Ignores LOAD, REPLACE, etc.)
( Select_scan ) = 491,596,929 / 1123494 = 437 /sec -- full table scans
-- Add indexes / optimize queries (unless they are tiny tables)
( Select_scan / Com_select ) = 491,596,929 / 5360296742 = 9.2% -- % of selects doing full table scan. (May be fooled by Stored Routines.)
-- Add indexes / optimize queries
( Sort_merge_passes ) = 631,000 / 1123494 = 0.56 /sec -- Heafty sorts
-- Increase sort_buffer_size and/or optimize complex queries.
( innodb_autoinc_lock_mode ) = 1 -- Galera: desires 2 -- 2 = "interleaved"; 1 = "consecutive" is typical; 0 = "traditional".
( log_slow_queries ) = OFF -- Whether to log slow queries. (Before 5.1.29, 5.6.1)
( slow_query_log ) = OFF -- Whether to log slow queries. (5.1.12)
( long_query_time ) = 5.000000 = 5 -- Cutoff (Seconds) for defining a "slow" query.
-- Suggest 2
( Slow_queries ) = 407,546,261 / 1123494 = 362 /sec -- Frequency (Slow queries per sec)
-- Rework slow guys; improve indexes; watch disk space for slow log file
( Slow_queries / Questions ) = 407,546,261 / 5877218009 = 6.9% -- Frequency (% of all queries)
-- Find slow queries; check indexes.
( log_queries_not_using_indexes ) = ON -- Whether to include such in slowlog.
-- This clutters the slowlog; turn it off so you can see the real slow queries. And decrease long_query_time to catch most interesting queries.
( max_connect_errors ) = 100,000 -- A small protection against hackers.
-- Perhaps no more than 200.
( Threads_running - 1 ) = 21 - 1 = 20 -- Active threads (concurrency when data collected)
-- Optimize queries and/or schema
( Threads_created / Connections ) = 7,052 / 392731 = 1.8% -- Rapidity of process creation
-- Increase thread_cache_size (non-Windows)
( thread_cache_size / max_connections ) = 8 / 910 = 0.88%
-- (0 for Windows)
( Threads_running / thread_cache_size ) = 21 / 8 = 2.62 -- Threads: current / cached (Not relevant when using thread pooling)
-- Optimize queries
Abnormally large:
Binlog_cache_use = 82 /sec
Bytes_received = 1439336 /sec
Com_commit = 114 /sec
Com_create_table = 60 /HR
Com_delete = 14 /sec
Com_delete_multi = 0.033 /sec
Com_drop_table = 60 /HR
Com_purge_before_date = 0.042 /HR
Com_select = 4771 /sec
Com_set_option = 229 /sec
Com_update = 98 /sec
Created_tmp_files = 0.4 /sec
Handler_commit = 5140 /sec
Handler_prepare = 357 /sec
Handler_read_first = 143 /sec
Handler_write = 19401 /sec
Innodb_buffer_pool_pages_free = 901,470
Select_range = 95 /sec
Sort_range = 3821 /sec
Sort_rows = 15912 /sec
Tc_log_page_waits = 7
Threads_running = 21
Additional suggestions (Jun 21, 2018) to consider for your Linux and my.cnf-ini [mysqld] section
. for Linux since your limit is 1024, in Linux command,
ulimit -n 30000 # to increase Open Files handle count
. for your my.cnf
table_open_cache=10000 # from 256 to lower 20 opened_tables per SECOND
table_definition_cache=800 # from 400 to lower 43,623 opened_table_definitions
open_files_limit=13000 # from 4550 to lower opened_files of 959,559 in 13 days, 1 RPS.
Suggestions to consider for your my.cnf-ini [mysqld] section
max_connections=500 # from 910 only 266 max_used in 13 days
thread_cache_size=100 # from 8 to minimize thread churn and reduce threads_created
read_rnd_buffer_size=128K # from 256K to lower handler_read_rnd_next RPS
key_cache_age_threshold=64800 # from 300 seconds to read same data again
key_cache_division_limit=50 # from 100 for Hot/Warm cache
innodb_buffer_pool_size=24G # from 32G 17G was in use when GLOBAL STATUS recorded
. with your version 5.5.nn special handling required, see REFMAN for next 2.
innodb_log_buffer_size=128M # from 8M to support ~30 minutes
innodb_log_file_size=512M # from 5M for rotation every couple hours
max_write_lock_count=16 # to allow RD after nn locks vs possible wait on 4Billion locks
sort_buffer_size=3M # from 2M to reduce sort_merge_passes
thread_concurrency=30 # from 10 for expedited completion
for additional assistance please find contact information in my profile, Network profile.
(Second answer -- addressing the queries.)
No PRIMARY KEY? Naughty. Does that table have a column (or combination of columns) that is 'naturally' Unique? If so consider making the PK from it/them.
INDEX(p_pkid, p_billingaddress, p_shippingaddress, TypeGKString), in any order, will help the SELECT performance significantly, thereby speeding things up and decreasing CPU consumption.
INDEX(GK) is needed for the UPDATE, (Where's the SHOW CREATE TABLE cronjobs?)
Don't use BIGINT (8 bytes) for columns that need it. (How many different "genders" are there??) (Consider CHAR(2) CHARACTER SET ascii for country.) See TINYINT (1 byte) and its friends.
(Yes, this in my 3rd answer. This time to spell out findings for newer SHOW GLOBAL STATUS.)
Hmmm... I used the old SHOW VARIABLEs, so some of the advice is based on values from that. If you have followed my previous advice, then I need a new copy of SHOW GLOBAL VARIABLES.
Observations:
Version: 5.5.47-log
40 GB of RAM
Uptime = 11d 23:29:02
You are not running on Windows.
Running 64-bit version
You appear to be running entirely (or mostly) InnoDB.
The More Important Issues:
See this about changing innodb_log_file_size. (Or see the 5.5 manual, etc)
innodb_log_file_size = 80M -- too much waiting for the log. See above
innodb_buffer_pool_instances = 16 -- minor contention relief
table_open_cache = 512 -- bumping entries out of this cache has some impact
thread_cache_size = 200 -- process creation is somewhat costly
log_queries_not_using_indexes = OFF -- otherwise clutter
See this for finding the 'worst' queries for us to help you optimize.
Yikes, 268 queries/sec taking more than 5 seconds.
Deleting a lot more often than inserting? What is going on?
9K SETs per second? What is going on?
Why did you choose READ-COMMITTED?
Hundreds of Threads_running usually implies that MySQL is stumbling over itself, and it might be better to throttle the number of connections in the client. Some benchmarks show that 5.6 and 5.7 actually handle this situation better; 5.5 tends to decline in throughtput (queries/sec) after a few dozen connections. Consider upgrading, also since you are 3 major revisions behind.
Details and other observations:
( Opened_tables ) = 13,001,730 / 1034942 = 13 /sec -- Frequency of opening Tables
-- increase table_open_cache
( innodb_buffer_pool_size / innodb_buffer_pool_instances ) = 30720M / 1 = 30720MB -- Size of each buffer_pool instance.
-- An instance should be at least 1GB. In very large RAM, have 16 instances.
( Innodb_os_log_written / (Uptime / 3600) / innodb_log_files_in_group / innodb_log_file_size ) = 45,704,499,200 / (1034942 / 3600) / 2 / 5M = 15.2 -- Ratio
-- (see minutes)
( Uptime / 60 * innodb_log_file_size / Innodb_os_log_written ) = 1,034,942 / 60 * 5M / 45704499200 = 1.98 -- Minutes between InnoDB log rotations Beginning with 5.6.8, this can be changed dynamically; be sure to also change my.cnf.
-- (The recommendation of 60 minutes between rotations is somewhat arbitrary.) Adjust innodb_log_file_size. (Cannot change in AWS.)
( Innodb_rows_deleted / Innodb_rows_inserted ) = 3,412,394 / 4031801 = 0.846 -- Churn
-- "Don't queue it, just do it." (If MySQL is being used as a queue.)
( Innodb_row_lock_waits ) = 256,120 / 1034942 = 0.25 /sec -- How often there is a delay in getting a row lock.
-- May be caused by complex queries that could be optimized.
( innodb_stats_on_metadata ) = innodb_stats_on_metadata = ON -- Re-analyze table when touching stats.
-- ON is likely to slow down certain SHOWs and information_schema accesses.
( innodb_thread_concurrency ) = 0 -- 0 = Let InnoDB decide the best for concurrency_tickets.
-- Set to 0 or 64. This may cut back on CPU.
( innodb_print_all_deadlocks ) = innodb_print_all_deadlocks = OFF -- Whether to log all Deadlocks.
-- If you are plagued with Deadlocks, turn this on. Caution: If you have lots of deadlocks, this may write a lot to disk.
( net_buffer_length / max_allowed_packet ) = 16,384 / 35M = 0.04%
( local_infile ) = local_infile = ON
-- local_infile = ON is a potential security issue
( bulk_insert_buffer_size / _ram ) = 8M / 40960M = 0.02% -- Buffer for multi-row INSERTs and LOAD DATA
-- Too big could threaten RAM size. Too small could hinder such operations.
( Questions ) = 15,894,065,519 / 1034942 = 15357 /sec -- Queries (outside SP) -- "qps"
-- >2000 may be stressing server
( Queries ) = 15,894,107,993 / 1034942 = 15357 /sec -- Queries (including inside SP)
-- >3000 may be stressing server
( Created_tmp_tables ) = 501,042,067 / 1034942 = 484 /sec -- Frequency of creating "temp" tables as part of complex SELECTs.
( (Com_insert + Com_update + Com_delete + Com_replace) / Com_commit ) = (4031334 + 54661875 + 13451091 + 0) / 4930449084 = 0.0146 -- Statements per Commit (assuming all InnoDB)
-- Low: Might help to group queries together in transactions; High: long transactions strain various things.
( Com_delete / Com_insert ) = 13,451,091 / 4031334 = 333.7% -- Deletes / Inserts (as a pct). (Ignores LOAD, REPLACE, etc.)
( Select_scan ) = 348,481,657 / 1034942 = 336 /sec -- full table scans
-- Add indexes / optimize queries (unless they are tiny tables)
( Select_scan / Com_select ) = 348,481,657 / 1029506656 = 33.8% -- % of selects doing full table scan. (May be fooled by Stored Routines.)
-- Add indexes / optimize queries
( Sort_merge_passes ) = 297,216 / 1034942 = 0.29 /sec -- Heafty sorts
-- Increase sort_buffer_size and/or optimize complex queries.
( Com_insert + Com_delete + Com_delete_multi + Com_replace + Com_update + Com_update_multi ) = (4031334 + 13451091 + 34494 + 0 + 54661875 + 0) / 1034942 = 70 /sec -- writes/sec
-- 50 writes/sec + log flushes will probably max out I/O write capacity of normal drives
( log_slow_queries ) = log_slow_queries = OFF -- Whether to log slow queries. (Before 5.1.29, 5.6.1)
( slow_query_log ) = slow_query_log = OFF -- Whether to log slow queries. (5.1.12)
( long_query_time ) = 5 -- Cutoff (Seconds) for defining a "slow" query.
-- Suggest 2
( Slow_queries ) = 277,531,287 / 1034942 = 268 /sec -- Frequency (Slow queries per sec)
-- Rework slow guys; improve indexes; watch disk space for slow log file
( Slow_queries / Questions ) = 277,531,287 / 15894065519 = 1.7% -- Frequency (% of all queries)
-- Find slow queries; check indexes.
( log_queries_not_using_indexes ) = log_queries_not_using_indexes = ON -- Whether to include such in slowlog.
-- This clutters the slowlog; turn it off so you can see the real slow queries. And decrease long_query_time to catch most interesting queries.
( max_connect_errors ) = 100,000 -- A small protection against hackers.
-- Perhaps no more than 200.
( Threads_running - 1 ) = 215 - 1 = 214 -- Active threads (concurrency when data collected)
-- Optimize queries and/or schema
( Threads_created / Connections ) = 6,390 / 361954 = 1.8% -- Rapidity of process creation
-- Increase thread_cache_size (non-Windows)
( thread_cache_size / max_connections ) = 8 / 910 = 0.88%
-- (0 for Windows)
( Threads_running / thread_cache_size ) = 215 / 8 = 26.9 -- Threads: current / cached (Not relevant when using thread pooling)
-- Optimize queries
36 issues flagged, out of 162 computed Variables/Status/Expressions
Abnormally large:
Bytes_received = 820009 /sec
Com_commit = 4763 /sec
Com_delete = 13 /sec
Com_delete_multi = 0.033 /sec
Com_drop_table = 60 /HR
Com_purge_before_date = 0.042 /HR
Com_set_option = 9528 /sec
Com_show_engine_status = 21 /HR
Created_tmp_files = 0.21 /sec
Handler_commit = 1207 /sec
Handler_read_first = 105 /sec
Handler_read_key = 72824 /sec
Handler_write = 25131 /sec
Innodb_buffer_pool_pages_misc = 100,245
Key_write_requests = 324 /sec
Select_range = 73 /sec
Sort_range = 221 /sec
Tc_log_page_waits = 1
Threads_running = 215
Abnormal strings:
innodb_fast_shutdown = 1
innodb_use_native_aio = OFF
relay_log_info_file = /PK/mysql/mysql-relay-log-info
time_zone = SYSTPK
tx_isolation = READ-COMMITTED