|
|||||||||||
|
Re: Question related to MySQL and Threads and "Context_voluntary"
From: Mariella Petrini <mariellapetrini(at)yahoo.com>
Date: Thu Jul 19 2007 - 12:22:39 EDT
> On 7/19/07, Mariella Petrini > What is the disk configuration?
Do you mean
devfs 97 97 0 100% /dev fdesc 1 1 0 100% /dev100% /automount/static or what type of RAID level is used ? > +----+-------------+---------------------------+------+-------------------+---------------+---------+-------+-------+-------------+> > > +----+-------------+---------------------------+------+-------------------+---------------+---------+-------+-------+-------------+> | > > > +----+-------------+---------------------------+------+-------------------+---------------+---------+-------+-------+-------------+> > show index from t1; > > > +---------------------------+------------+---------------+--------------+-----------------+-----------+-------------+----------+--------+------+------------+---------+> Sub_part | > > Packed | Null | Index_type | Comment | > > > +---------------------------+------------+---------------+--------------+-----------------+-----------+-------------+----------+--------+------+------------+---------+> > > +---------------------------+------------+---------------+--------------+-----------------+-----------+-------------+----------+--------+------+------------+---------+> > > > If there is only one query running the response > time > > is x, if there two queries running at the same > time > > the response time of each select is approximately > 2x, > > if there 3 queries running the response time is > > approximately 4x and if there are 4 queries > running > > concurrently the response time of each query is > > approximately 8x > > I would guess there is a network bottleneck, but the > query returns 1 > row so that can't be it. My next guess is that all > of the queries are > competing for the same disk and the query is IO > bound.
If there are no pageins/pageout all the data should be
in memory,
> I have run both scenarios and same behavior. The only values that increase are the voluntary context switches and messages sent and received. The original testwas run on queries that involved hundreds of tables and same behavior.
Before running show profiles I have been digging with
show innodb status (all the settings appear to be
optimum).
12:19:53 INNODB MONITOR OUTPUT Per second averages calculated from the last 29 seconds SEMAPHORES OS WAIT ARRAY INFO: reservation count 11015110, signal count 10903092 Mutex spin waits 0, rounds 2384740514, OS waits 768529 RW-shared spins 60927, OS waits 4778; RW-excl spins 90035, OS waits 5610 TRANSACTIONS Trx id counter 0 58788 Purge done for trx's n:o < 0 17405 undo n:o < 0 0 History list length 2 Total number of lock structs in row lock hash table 0 LIST OF TRANSACTIONS FOR EACH SESSION: ---TRANSACTION 0 56323, not started, OS thread id 25524736 MySQL thread id 1, query id 49381 localhost root show innodb status ---TRANSACTION 0 58787, ACTIVE 0 sec, OS thread id 25562112 fetching rows, thread declared inside InnoDB 393 mysql tables in use 1, locked 0 MySQL thread id 33, query id 49380 localhost root Sending data select SQL_NO_CACHE count(DISTINCT search_user_unique_innodb.user_id) as res_count FROM search_user_unique_innodb WHERE (account_type_id > 0 AND category=34 AND age between 18 and 38) AND sexuality='SF' Trx read view will not see trx with id >= 0 58788, sees < 0 58784 ---TRANSACTION 0 58786, ACTIVE 0 sec, OS thread id 25602048 fetching rows, thread declared inside InnoDB 289 mysql tables in use 1, locked 0 MySQL thread id 32, query id 49376 localhost root Sending data select SQL_NO_CACHE count(DISTINCT search_user_unique_innodb.user_id) as res_count FROM search_user_unique_innodb WHERE (account_type_id > 0 AND category=34 AND age between 18 and 38) AND sexuality='SF' Trx read view will not see trx with id >= 0 58787, sees < 0 58783 ---TRANSACTION 0 58785, ACTIVE 0 sec, OS thread id 25594368 fetching rows, thread declared inside InnoDB 285 mysql tables in use 1, locked 0 MySQL thread id 34, query id 49372 localhost root Sending data select SQL_NO_CACHE count(DISTINCT search_user_unique_innodb.user_id) as res_count FROM search_user_unique_innodb WHERE (account_type_id > 0 AND category=34 AND age between 18 and 38) AND sexuality='SF' Trx read view will not see trx with id >= 0 58786, sees < 0 58782 ---TRANSACTION 0 58784, ACTIVE 0 sec, OS thread id 25640960 fetching rows, thread declared inside InnoDB 371 mysql tables in use 1, locked 0 MySQL thread id 31, query id 49371 localhost root Sending data select SQL_NO_CACHE count(DISTINCT search_user_unique_innodb.user_id) as res_count FROM search_user_unique_innodb WHERE (account_type_id > 0 AND category=34 AND age between 18 and 38) AND sexuality='SF' Trx read view will not see trx with id >= 0 58785, sees < 0 58782 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 (write thread) Pending normal aio reads: 0, aio writes: 0, ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0 Pending flushes (fsync) log: 0; buffer pool: 0 257 OS file reads, 279 OS file writes, 279 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 inserts, 0 merged recs, 0 merges Hash table size 4425293, used cells 174319, node heap has 176 buffer(s) 154126.00 hash searches/s, 1068.31 non-hash searches/s --- LOG --- Log sequence number 0 3672793738 Log flushed up to 0 3672793738 Last checkpoint at 0 3672793738 0 pending log writes, 0 pending chkp writes 146 log i/o's done, 0.00 log i/o's/second ---------------------- BUFFER POOL AND MEMORY ---------------------- Total memory allocated 1243063488; in additional pool allocated 5369856 Buffer pool size 65536 Free buffers 64418 Database pages 942 Modified db pages 0 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages read 942, created 0, written 69 0.00 reads/s, 0.00 creates/s, 0.00 writes/s Buffer pool hit rate 1000 / 1000 -------------- ROW OPERATIONS -------------- 4 queries inside InnoDB, 0 queries in queue 5 read views open inside InnoDB Main thread id 25334784, state: sleeping Number of rows inserted 0, updated 0, deleted 0, read 1041580444 0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 155084.76 reads/s ---------------------------- END OF INNODB MONITOR OUTPUT ============================ ==================================== 12:20:43 INNODB MONITOR OUTPUT ===================================== Per second averages calculated from the last 50 seconds ---------- SEMAPHORES ---------- OS WAIT ARRAY INFO: reservation count 11060403, signal count 10942334 Mutex spin waits 0, rounds 2396569038, OS waits 790709 RW-shared spins 62683, OS waits 4961; RW-excl spins 90969, OS waits 5788 ------------ TRANSACTIONS ------------ Trx id counter 0 58917 Purge done for trx's n:o < 0 17405 undo n:o < 0 0 History list length 2 Total number of lock structs in row lock hash table 0 LIST OF TRANSACTIONS FOR EACH SESSION: ---TRANSACTION 0 56323, not started, OS thread id 25524736 MySQL thread id 1, query id 49898 localhost root show innodb status ---TRANSACTION 0 58916, ACTIVE 0 sec, OS thread id 25594368, thread declared inside InnoDB 499 mysql tables in use 1, locked 0 MySQL thread id 34, query id 49897 localhost root Sending data select SQL_NO_CACHE count(DISTINCT search_user_unique_innodb.user_id) as res_count FROM search_user_unique_innodb WHERE (account_type_id > 0 AND category=34 AND age between 18 and 38) AND sexuality='SF' Trx read view will not see trx with id >= 0 58917, sees < 0 58913 ---TRANSACTION 0 58915, ACTIVE 1 sec, OS thread id 25562112 fetching rows, thread declared inside InnoDB 452 mysql tables in use 1, locked 0 MySQL thread id 33, query id 49893 localhost root Sending data select SQL_NO_CACHE count(DISTINCT search_user_unique_innodb.user_id) as res_count FROM search_user_unique_innodb WHERE (account_type_id > 0 AND category=34 AND age between 18 and 38) AND sexuality='SF' Trx read view will not see trx with id >= 0 58916, sees < 0 58912 ---TRANSACTION 0 58914, ACTIVE 1 sec, OS thread id 25602048 fetching rows, thread declared inside InnoDB 234 mysql tables in use 1, locked 0 MySQL thread id 32, query id 49889 localhost root Sending data select SQL_NO_CACHE count(DISTINCT search_user_unique_innodb.user_id) as res_count FROM search_user_unique_innodb WHERE (account_type_id > 0 AND category=34 AND age between 18 and 38) AND sexuality='SF' Trx read view will not see trx with id >= 0 58915, sees < 0 58911 ---TRANSACTION 0 58913, ACTIVE 2 sec, OS thread id 25640960 fetching rows, thread declared inside InnoDB 285 mysql tables in use 1, locked 0 MySQL thread id 31, query id 49885 localhost root Sending data select SQL_NO_CACHE count(DISTINCT search_user_unique_innodb.user_id) as res_count FROM search_user_unique_innodb WHERE (account_type_id > 0 AND category=34 AND age between 18 and 38) AND sexuality='SF' Trx read view will not see trx with id >= 0 58914, sees < 0 58910 -------- 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 (write thread) Pending normal aio reads: 0, aio writes: 0, ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0 Pending flushes (fsync) log: 0; buffer pool: 0 257 OS file reads, 283 OS file writes, 283 OS fsyncs 0.00 reads/s, 0 avg bytes/read, 0.08 writes/s, 0.08 fsyncs/s ------------------------------------- INSERT BUFFER AND ADAPTIVE HASH INDEX ------------------------------------- Ibuf: size 1, free list len 0, seg size 2, 0 inserts, 0 merged recs, 0 merges Hash table size 4425293, used cells 174319, node heap has 176 buffer(s) 153078.46 hash searches/s, 1059.88 non-hash searches/s --- LOG --- Log sequence number 0 3672793748 Log flushed up to 0 3672793748 Last checkpoint at 0 3672793748 0 pending log writes, 0 pending chkp writes 148 log i/o's done, 0.04 log i/o's/second ---------------------- BUFFER POOL AND MEMORY ---------------------- Total memory allocated 1243063488; in additional pool allocated 5369856 Buffer pool size 65536 Free buffers 64418 Database pages 942 Modified db pages 0 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages read 942, created 0, written 70 0.00 reads/s, 0.00 creates/s, 0.02 writes/s Buffer pool hit rate 1000 / 1000 -------------- ROW OPERATIONS -------------- 4 queries inside InnoDB, 0 queries in queue 5 read views open inside InnoDB Main thread id 25334784, state: sleeping Number of rows inserted 0, updated 0, deleted 0, read 1049282885 0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 154045.74 reads/s ---------------------------- END OF INNODB MONITOR OUTPUT ============================ No pagein/pageout vmstat 1 Mach Virtual Memory Statistics: (page size of 4096 bytes, cache hits 61%) free active inac wire faults copy zerofill reactive pageins pageout 1668423 76092 228822 124188 3138376 51608 1788493 0 23632 0 1668424 75565 228821 124715 279 0 129 0 0 0 1668424 75565 228821 124715 220 0 128 0 0 0 1668420 76598 228825 123682 223 0 133 0 0 0 1668413 75565 228832 124715 186 0 94 0 0 0 1668442 75489 228801 124793 236 0 133 0 0 0 1668438 76599 228806 123682 221 0 132 0 0 0 1668431 75566 228813 124715 186 0 94 0 0 0 1668429 75566 228815 124715 222 0 131 0 0 0 1668427 76599 228817 123682 219 0 130 0 0 0 1668417 75566 228827 124715 189 0 97 0 0 0 1668423 76087 228820 124195 260 0 166 0 0 0 1668299 75567 228942 124717 916 0 802 0 0 0 1668296 75567 228945 124717 232 0 137 0 0 0 1668287 75567 228954 124717 198 0 101 0 0 0 1668272 75567 228969 124717 245 0 148 0 0 0 1668122 76599 229120 123684 378 0 283 0 0 0 1668113 76086 229129 124197 197 0 101 0 0 0 1668092 75567 229149 124717 312 0 198 0 0 0 1668092 75567 229149 124717 230 0 133 0 0 0 1668072 76087 229169 124197 146 0 69 0 0 0 iostat 1 disk1 disk0 cpu KB/t tps MB/s KB/t tps MB/s us sy id 16.83 6 0.09 10.38 0 0.00 0 1 98 0.00 0 0.00 0.00 0 0.00 1 28 72 0.00 0 0.00 0.00 0 0.00 1 27 73 0.00 0 0.00 0.00 0 0.00 0 27 72 0.00 0 0.00 0.00 0 0.00 0 25 75 0.00 0 0.00 0.00 0 0.00 1 25 74 0.00 0 0.00 0.00 0 0.00 1 26 73 0.00 0 0.00 0.00 0 0.00 1 27 73 0.00 0 0.00 0.00 0 0.00 0 26 74 0.00 0 0.00 0.00 0 0.00 0 27 73 0.00 0 0.00 0.00 0 0.00 1 26 74 0.00 0 0.00 0.00 0 0.00 0 27 73 0.00 0 0.00 0.00 0 0.00 0 26 74 0.00 0 0.00 0.00 0 0.00 0 27 73 0.00 0 0.00 0.00 0 0.00 1 27 73 0.00 0 0.00 0.00 0 0.00 0 27 72 0.00 0 0.00 0.00 0 0.00 1 25 74 0.00 0 0.00 0.00 0 0.00 0 26 73 0.00 0 0.00 0.00 0 0.00 0 26 74 21.67 20 0.42 0.00 0 0.00 1 27 72 disk1 disk0 cpu KB/t tps MB/s KB/t tps MB/s us sy id 0.00 0 0.00 0.00 0 0.00 0 24 76 0.00 0 0.00 0.00 0 0.00 0 26 74 0.00 0 0.00 0.00 0 0.00 0 27 72 0.00 0 0.00 0.00 0 0.00 0 26 74 0.00 0 0.00 0.00 0 0.00 0 29 70 0.00 0 0.00 0.00 0 0.00 0 28 72 0.00 0 0.00 0.00 0 0.00 1 26 74 0.00 0 0.00 0.00 0 0.00 0 25 75 0.00 0 0.00 0.00 0 0.00 0 26 74 0.00 0 0.00 0.00 0 0.00 0 25 75 0.00 0 0.00 0.00 0 0.00 0 30 70 0.00 0 0.00 0.00 0 0.00 0 25 75 0.00 0 0.00 0.00 0 0.00 0 25 74 0.00 0 0.00 0.00 0 0.00 1 27 73 0.00 0 0.00 0.00 0 0.00 0 27 73 0.00 0 0.00 0.00 0 0.00 0 25 74 0.00 0 0.00 0.00 0 0.00 0 26 73 0.00 0 0.00 0.00 0 0.00 0 29 70 0.00 0 0.00 0.00 0 0.00 0 28 71 0.00 0 0.00 0.00 0 0.00 0 27 72 Thanks in advance for your help, MariellaReceived on Thu Jul 19 12:23:04 2007 This archive was generated by hypermail 2.1.8 : Thu Aug 09 2007 - 19:30:42 EDT |
||||||||||
|
|||||||||||