Welcome to WebmasterWorld Guest from 54.161.228.30

Forum Moderators: open

Message Too Old, No Replies

Using RAMdisk to speed up MySQL? Can I?

   
11:26 pm on Jan 13, 2009 (gmt 0)

10+ Year Member



Can I use Ram Disk to load entire db file into memory to speed up database?

Thanks

11:31 pm on Jan 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A quick Google search on mysql +"ram disk" shows it's indeed possible and that lots of folks are doing it.
11:45 pm on Jan 15, 2009 (gmt 0)

10+ Year Member



Hmmm... what happens after server reboot?

MySQL allows in-memory tables, that should be a better option.

IMHO one should speed-up database by good database design and preventing program from using it whenewer possible (i.e. use disk-level cache for rarely-changing pages).

12:14 am on Jan 16, 2009 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Morgenhund is bringing up good discussion ... why exactly are you looking at RAMdisk to speed up your database? What are the issues, exactly?
2:02 pm on Jan 17, 2009 (gmt 0)

5+ Year Member



I doubt you see any performance benefit from using a RAM-disk if your table-engine is InnoDB. If you're using MyISAM for the relevant table, you may see some benefits, but its still very likely that your hottest tables indexes are in the key cache and the data in the system's disk cache.

Apart from that, you may find that MySQL's memory-table also doesn't provide any noticable performance benefit, or even some degredation if you're going to store dynamic rows in it.

If you can cache the (processed) data, I'd look at that. Especially a system like memcached or similar environments are quite easy to use and can be very fast. Also keep in mind that a cache can already be beneficial if you have to reproduce your data every second... Which is, normally, quite rare, you can normally get away with at least one minute.

3:02 pm on Jan 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Definitely not worth doing for continuously writable databases - read only databases will only see a benefit.

But wait. Mysql and your O/S should be caching the files in ram anyway so there is no need for a ramdrive here. All you need to do is ensure you have plenty of ram and tune with something like

MySQLTuner by Major Hayden

Ramdrives should be used for storing legacy databases, processing of temporary files and indexes, session files, files you want to permanently cache which may not be cachable via the o/s or apache.

A few more inexpensive ways of increasing performance (assuming linux / apache / mysql)

Have two disks but don't mirror them. One disk is used for the o/s and the other just for the database files.

Set log files to absolute minimum. Don't log image files, .js etc.

Remove all unecessary services from starting up.

Turn off noatime on the volumes.

Set disk acoustic level to fast / loud.

8:37 pm on Jan 17, 2009 (gmt 0)

10+ Year Member



Many thanks for all of you.

Yes, it is basically a read only database. WRITE occurs only if administrators (3 persons) do that.

If I do not see big benefits by loading database file into memory, I will then load all static files used by the application to memory, hopefully that makes some difference.

Thank you!

6:46 pm on Jan 28, 2009 (gmt 0)

5+ Year Member



You may want to check into memcached. This was designed for this purpose. It has many APIs and runs well on several clusters I work on.

[danga.com...]