

Furthermore, we are going to create a few scripts to make sure our RAM disk is created at every boot so that MySQL can consistently take advantage of it.īeing both a Windows System Admin and a Linux guy, I am often astounded at how simple some things are in one operating system vs. In this article, I am going to talk about building a RAM disk on the fly, and telling MySQL to use it. Furthermore, having this kind of data written to and pulled from a RAM disk, could really improve application performance depending on your use case. Ultimately, if your system gets rebooted, you really don’t care if you lose this kind of data. rather than taking the CPU through the task of building as special table from existing tables again and again, it caches the special table so it can serve it the next time it is requested. Often they are used for “cache” as well, i.e. These files are built on the fly to store some temporary data (perhaps a specific view of the database as requested by a website page). Think of them like a scratch-pad you would use when doing a long equation in Algebra class. These are usually pretty small files that are built on the fly for normal operations. Some applications, like MySQL for example, write “temporary” files to disk. Oi’ that’s bad… when exactly would I want to use a RAM disk then? So if you do a system reboot, or lose power, everything stored on your RAM disk, even the RAM disk itself, is completely lost. Second, and perhaps more critical, RAM is erased whenever power is lost. So your system probably has a fairly limited amount to work with. Two primary reasons… First… RAM is expensive and therefore quite scarce compared with conventional hard drive space. That’s amazing… why don’t I just load everything into a RAM disk all the time? So if you have an application that would benefit from being able to access data very quickly, a RAM disk makes a lot of sense. But you probably have some more questions… What is a Ram Disk you ask? Simply put, you carve out a piece of your system’s RAM and use it as a normal file system.
