We reboot again the Linux server. This way we garantee filesystem cache is void. The folder "/var/lib/mysql/full_text_investigations/" holds the database. We are going to force the system to keep in RAM the data and index files this way:
# free
total used free shared buffers cached
Mem: 255504 50340 205164 0 6104 27048
-/+ buffers/cache: 17188 238316
Swap: 0 0 0
# cat /var/lib/mysql/full_text_investigations/* > /dev/null
# free
total used free shared buffers cached
Mem: 255504 237900 17604 0 6352 208316
-/+ buffers/cache: 23232 232272
Swap: 0 0 0
Filesystem cache has increased from 27 Mb to 208 Mb. The database files are 178 Mb in size. So, we can be sure database is cached in RAM.
We measure timings for the 10 predefined queries. Remember we have just reboot the system and force a cache reading:
65 rows in set (0.04 sec)
165 rows in set (0.02 sec)
256 rows in set (0.01 sec)
27 rows in set (0.00 sec)
5 rows in set (0.00 sec)
Empty set (0.00 sec)
28 rows in set (0.00 sec)
236 rows in set (0.02 sec)
30 rows in set (0.00 sec)
75 rows in set (0.01 sec)
Instant responses here prove that cache filling is crucial to fast database replies.
But I wonder, is data file more crucial to be cached than index file? Next experiment will show us this essential knowledge.
Wednesday, October 24, 2007
Forcing whole database to be cached
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment