Keeping a file in RAM
Greetings,
I have a large MySQL table, over 8GB. The server it is on has 24 GB of RAM, however. I was hoping to keep the table in RAM, for a huge speed win. RAM disks won't work. Copying the files into RAM at each boot would take too long. And then one would have to figure out how to sync the copy in RAM with the copy on the disk. So I have a script that runs from rc.local at boot : su --command="batch -f /home/dw/prive/user-daemon/pre-load" mysql/home/dw/prive/user-daemon/pre-load is #!/bin/shThis works... for about a day. Cache usage goes up to ~10GB. However, by next morning I notice that cache goes back down to ~5GB. I suspect that the backup cron job at 2 AM is convincing the kernel to free some cache. Short of running pre-load each day, is it possible to convince the kernel to keep a set of files in cache? Some mmap magic? Any pointers appreciated. Thank you. |
Hi.
Try setting the swappiness value to 0: echo 0 > /proc/sys/vm/swappiness Might help. I don't know of a way of telling the kernel to keep specific files in RAM, though. Dave |
All times are GMT -5. The time now is 10:58 AM. |