MySQL Forums
Forum List  »  Performance

Re: Slow insert rate in mysql innodb
Posted by: Rick James
Date: February 12, 2014 07:30PM

Analysis of INSERTs:
Given:
* 4000/sec desired
* 100 disk hits/sec (assuming ordinary drive)
* PRIMARY KEY starts with AUTO_INCREMENT
* INDEX(timestamp)
* INDEX(host, ...)
* ~1000 distinct hosts
* buffer_pool: 24G
* Assuming errorname and message average 100 bytes.

The data (and PK) will have a new block after every ~25ms.
INDEX(timestamp) will need a new block after every ~100ms.
INDEX(host, ...) will have ~1000 "hot spots". Some hot spot will need to store a new block every ~100ms.
I/O: So, no problem with overloading disk I/O.
Cache: 1+1+1000 blocks need to be cached. That's ~16MB. So, no thrashing.

What's the _average_ size of errorname and message? If the average is, say, 1000 bytes, then the above computations are in trouble. In particular, a block can hold only about 14 records if errname+message is 1KB. This would lead to writing a new block every 3ms. The disk won't keep up. If the text is long (like that), then here are some options:

* RAID striping
* Compress the text fields
* Normalize the text fields -- but only if there is a lot of repetition.

Options: ReplyQuote


Subject
Views
Written By
Posted
2791
January 28, 2014 06:46PM
1788
January 30, 2014 08:31PM
2259
January 31, 2014 08:31PM
1514
February 07, 2014 11:00AM
Re: Slow insert rate in mysql innodb
1713
February 12, 2014 07:30PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.