1

How to enable /dev/shm RAM disk for MySQL? (temp dir in /dev/shm)

$ vi /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=512m 0 0

$ mount -o remount /dev/shm

Is this correct? Now what?

......

......

......

Server info:

VPS (Xen)
1.5GB RAM
3
  • Creating ramdisks will only starve the server of memory - every byte you allocate to a ramdisk is one byte less for cacheing/buffering and executing code. How about boosting mysql's cache/buffer sizes instead?
    – Marc B
    Jul 20, 2011 at 15:09
  • What do you want to do when your VPS is rebooted, and you've lost all your tables ? Maybe you can rather add suitable indexes to speed things up.
    – nos
    Jul 20, 2011 at 18:39
  • themattreid.com/wordpress/2011/04/04/… --- Question closed.
    – Randomprogrammer
    Jul 25, 2011 at 16:51

2 Answers 2

1

The first rule of optimisation is: Don't assume.

Don't assume that you will automatically get better performance by putting (any) files on a ramdisc. Also consider how you are hoping to persist data following the (inevitable) power failure.

In general, SQL is slow because you are using it wrong, so it is an application design fault. The fix is to (re-)design your application correctly.

1
  • I didn't wrote that app.
    – Randomprogrammer
    Jul 25, 2011 at 16:28
0

Just use MEMORY storage engine.

You must log in to answer this question.