0

This isn't necessarily a programming question, but I've hit a performance bottleneck with disk IO and I'd like to try writing and reading from RAM instead of the hard drive. I want to create my file in RAM and then run my application against it.

There are lots of tools for creating RAM drives. None of them seem to work for windows 2008 R2. Does anyone know if this is possible and if so how. Does anyone know of a tool that works?

Nate
  • 28,586
  • 21
  • 107
  • 177
Mark
  • 4,641
  • 11
  • 46
  • 78

3 Answers3

2

Use Memory-Mapped Files to map the file into RAM (including memory backed to pagefile, if it's large. so be careful).

File mapping is the association of a file's contents with a portion of the virtual address space of a process. The system creates a file mapping object (also known as a section object) to maintain this association. A file view is the portion of virtual address space that a process uses to access the file's contents. File mapping allows the process to use both random input and output (I/O) and sequential I/O. It also allows the process to work efficiently with a large data file, such as a database, without having to map the whole file into memory.

Steve Townsend
  • 51,210
  • 8
  • 87
  • 134
  • I don't have much control over the reading/writing of the file. I'm using multiple SQL CE databases and how microsoft does the file mapping I don't know. If i could create a ram drive though, i'd just create the SQL CE databases in my RAM Drive and i'd be set. Anyway to createa a RAM drive in windows 2008 R2? – Mark Dec 02 '10 at 17:13
  • You could try this? http://www.hack7mc.com/2009/07/setting-up-a-ramdisk-scratch-drive-for-windows-7-media-center.html – Steve Townsend Dec 02 '10 at 17:18
1

whatever ram disk you choose to purchase or write, remember check if the ram disk driver responds the SetDispositionInformationFile call.

Sheng Jiang 蒋晟
  • 14,859
  • 2
  • 26
  • 44
1

I ended up finding and using Vsuit Ramdisk (Server Edition). It works great but its not free.

Mark
  • 4,641
  • 11
  • 46
  • 78