Memory Files and RAM Disks

For Minecraft, the general approach when starting a server application is to run it in RAMDisk, as it uses hundreds of tiny files for the world generation, and I / O speed is the main bottleneck.

In a recent attempt, I tried using Dokan / ImDisk to create a RAMDisk programmatically for a Server application. Dokan was significantly slower than the average hard drive, and I was not able to get ImDisk to function normally. Since these are the only 2 file system drivers that I know about the .NET API, I now look at alternatives.

Earlier I was told about trying to use memory files. My approach at this time is to create a RAMDisk, create a symbolic link between the data folder for the Game Server and RAMDisk, and then start the Game Server process.

  • Can memory-related files work the same way, IE creating a virtual disk with which I can create a symbolic link? For example, G: \ Data_Files \?

  • Are there any other Dokan / ImDisk alternatives with the .NET / Bindings API floating around?

+4
source share
2 answers

There are several approaches that depend on the specifics of your task.

If you need to work with the file system (that is, through the functions and classes of the file system APIs), and you want to quickly, then (as I suggested in response to your previous question) you need to create a RAMDisk driver. The Windows driver package includes an example driver that (coincidence?) Is named "RamDisk". Driver development, however, is complicated, and if something goes wrong with the sample or you need to expand it, you will need to delve deeper into kernel mode development (or hire someone to do the job). Why kernel mode? The reason, as you could see with Dokan, switching to user mode for storing data leads to a serious slowdown.

If you just need to conveniently manage a bunch of files in memory using the Stream class (with the possibility of flushing it to disk), you can use one of the virtual file systems. Our SolFS (Application Edition) is one of those products that you can use (I can also recall the CodeBase file system, but they don't seem to provide an evaluation version). SolFS seems to fit your task, so if you think so, you can contact me privately (see My profile) for help.

To answer your questions:

  • No, memory mapped files (MMFs) are literally files on disk (including a virtual disk, if any) that can be accessed not through the file system API, but directly using memory operations. MMF is generally faster for most file operations, so it is often mentioned.

  • Our reverse file systems or CallbackDisk products (see virtual memory ) are an alternative, however, as I mentioned in the first, they will not be able to solve your problem due to switching the user mode context.

Update: I see no obstacle for the driver to have a copy in memory and write to the disk asynchronously when necessary. But for this you will need to modify the RAMDisk driver example (and this is due to a rather large amount of programming in kernel mode).

Using SolFS or another virtual file system, you can also have a copy of the storage on disk. In the case of a virtual file system, it might seem that working with the container file on disk will give you satisfactory results (since the virtual file system usually has a memory cache), and you won’t need to save a copy in memory at all.

+2
source

After looking at a bunch of solutions and doing some tests, we could not refuse RAMDisk from DataRam . We ran into a bunch of Windows drivers and some other freebie solutions, and ultimately couldn't justify the costs compared to the tiny price of a commercial solution.

+3
source

All Articles