LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-12-2007, 01:53 PM   #1
Leolo
LQ Newbie
 
Registered: Oct 2007
Posts: 2

Rep: Reputation: 0
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/sh

DB=dw
DEST=/dev/null
LOG=/home/dw/prive/log/pre-load.log

date >>$LOG
/usr/bin/time -p -a -o $LOG bash -c \
"for n in ~mysql/$DB/*.M* ; do echo \$n >>$LOG ; cat \$n >$DEST 2>>$LOG ;done"
This 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.
 
Old 10-12-2007, 02:59 PM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Backup partition keeping file owners the same Sledge Linux - Newbie 1 05-14-2005 09:14 PM
Keeping password/config file hidden techrolla Linux - General 3 11-06-2004 05:22 PM
keeping source file for uninstalling demmylls Linux - General 4 03-13-2004 03:44 AM
Running a file from ram Bd22 Linux - Software 3 02-01-2004 01:05 AM
.ram file help ll3x4 Linux - Software 2 09-20-2003 08:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration