MySQL Forums
Forum List  »  Falcon

Warming up issue of record cache?
Posted by: Yuan WANG
Date: April 09, 2008 07:59AM

I found this problem when I tested Falcon against InnoDB using sysbench several days ago. The simple test works as follows:
1. Populate a table with 5,000,000 rows with ID from 1 to 5,000,000.
2. Start several threads all of which executes queries like 'SELECT * FROM thetable WHERE ID = ?' to fetch a row at a time, where the value of the parameter is a random number between 1 and 5,000,000.

The size of the table is more than 1G for InnoDB and about 500M for Falcon. For InnoDB, I set the buffer to 500M and for Falcon I set the record cache to 400M and page cache to 100M, so both of them have the same amount of cache memory.

Both of the two tests started after a code restart. So at first the IO workload are quite high. However, I found that the IO workload of InnoDB drops much faster than Falcon. After fetched hundreds of thousands of records, IO wait of InnoDB dropped from 60-70% to 30-40%, however that of Falcon was still 50-60% (Number of records fetched per seconds of Falcon was less than InnoDB too).

I think this problem occurs because record cache warms up much more slowly than page cache, for record cache ignores the locality of data and access. When the database server has been run for a long time, the record cache is much efficient than page cache for it can cache frequently accessed rows with much less memory. However, just after the database's starting up, record cache warms up more slowly for a record won't be cached if it hasn't been accessed before, but with page cache a record can be cached if some other records of the same page has been accessed before.

Nowadays we have two parameters to set the sizes of record cache and page cache respectively. I think a better schema is to have a parameter to set the max size of record cache plus page cache, and another parameter to set the target size of page cache. Then during system's starting up, the page cache can become bigger than its target size so long as current size of record cache + page cache hasn't reached the max size. After the cache is full(record cache + page cache = max size), record cache will grow and force page cache to be reduced. When the page cache is decreased to its target size, the system reaches a steady point and the lru replacement policy of record cache starts.

Any comments? Sorry for my poor English^_^

Options: ReplyQuote

Written By
Warming up issue of record cache?
April 09, 2008 07:59AM

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.