RAM Disk and Windows System Cache

Started by Phalanthos

RAM Disk and Windows System Cache   17 August 2023, 00:11

Hi,

Microsoft states the following regarding System Cache in Windows:
Quote

https://learn.microsoft.com/en-us/windows-server/administration/performance-tuning/subsystem/cache-memory-management/

By default, Windows caches file data that is read from disks and written to disks. This implies that read operations read file data from an area in system memory, known as the system file cache, rather than from the physical disk. Correspondingly, write operations write file data to the system file cache rather than to the disk, and this type of cache is referred to as a write-back cache. Caching is managed per file object. Caching occurs under the direction of the Cache Manager, which operates continuously while Windows is running.


The data that is stored in a RAM Disk when is read or written goes back and forth to system cache needlessly because it is already in the RAM rather than an SSD or HDD. Is that correct?

Is there any way to avoid this data flow between RAM Disk and System Cache? (via Registry or some other way) Can you implement some feature in SoftPerfect RAM Disk that prevents this?

Thanks in advance
SoftPerfect Support forum - Andrew avatar image

Re: RAM Disk and Windows System Cache   18 August 2023, 11:06

You are correct in your understanding. When data is stored in a RAM Disk, it is already in the system's RAM. Despite this, when data is read or written from/to the RAM Disk, Windows' disk cache mechanism will still be involved, potentially causing the data to be cached again in the system file cache. This may indeed seem redundant given that the data is already in RAM.

While we continuously strive to enhance the performance and capabilities of SoftPerfect RAM Disk, we do not have a feature that disables this specific data flow between the RAM Disk and the System Cache.

However, it's worth noting that software applications with intensive I/O operations, such as database servers, often use mechanisms like unbuffered I/O and disk write-through. By leveraging these mechanisms, they can bypass the Windows file system cache, resulting in the highest possible performance when operating on a RAM Disk.
Andre

Re: RAM Disk and Windows System Cache   28 October 2025, 12:44

I've found this post via Google search. Before I say anything, I would really like to express my gratitude to SoftPerfect for creating a truly perfect software. No bloat, no unnecessary things, it just works. I wish all software was like yours. Thank you so much.

To this topic, I've found that in the Windows Disk Management application, if I right click my RAM Disk and select Properties, I can view a caching option under Policies:

SoftPerfect support forum

However, Windows won't let me disable that option:

SoftPerfect support forum

Is this blocked by your software? Should I really keep these options as-is?

Yes, I do use my RAM Disk as emulating a true HDD for maximum compatibility.
SoftPerfect Support forum - Andrew avatar image

Re: RAM Disk and Windows System Cache   28 October 2025, 14:36

Thank you for your kind words and asking a good question why the write-caching option cannot be changed on partitioned RAM disks. We'd like to explain why this is actually intentional behavior that protects performance.

Why Write-Cache Toggle is Disabled

On traditional hard drives and SSDs, disabling write caching is a data integrity feature. It forces data to be physically written to the disk before the system reports the write as complete, preventing data loss if power fails while data sits in the drive's volatile cache.

However, this concept doesn't apply to RAM disks for a fundamental reason: the entire disk already exists in volatile RAM. If power fails, all data on the RAM disk is (as it should be) lost regardless of the cache setting. There is no persistent storage medium to "safely flush" data to.

Performance Impact

If write caching were disabled on a RAM disk, here's what would happen:
  1. Increased flush requests: Windows would send frequent flush/sync commands to ensure data is "safely written".
  2. Added CPU overhead: Each flush request creates additional I/O Request Packets (IRPs) that the driver must
    process, acquire locks for, and complete.
  3. Reduced throughput: Applications and file systems would wait for these unnecessary flush operations, even
    though they accomplish nothing on a RAM disk.
  4. Performance degradation: Particularly noticeable with random small writes and database workloads (5-15% slower depending on the workload pattern).

All of this overhead provides zero benefit since:
  • For pure RAM disks, power loss erases everything instantly anyway.
  • For image-backed disks, the driver handles flushing internally regardless of this setting.

Resolution

In the next driver update, we will modify the setting so the write-caching checkbox is grayed out (disabled) rather than generating an error when you attempt to change it. This will clearly indicate that:
  • The setting is not user-configurable by design.
  • Write caching is permanently enabled for optimal performance.
  • This is the correct and recommended configuration for RAM disk operation.

If you have a specific use case that requires write-through behavior, please let us know and we can discuss alternative approaches. However, we strongly recommend keeping write caching enabled for all normal RAM disk usage.
Andre

Re: RAM Disk and Windows System Cache   30 October 2025, 08:00

Thank you so much for the super detailed explanation! And in addition to your software, your support is pretty amazing as well.

That is crystal clear. I don't have any particular reason to disable caching. I do see Windows issuing alarms for my RAM Disk regarding it, though:
Quote

The driver detected that the device \Device\Harddisk2\DR2 has its write cache enabled. Data corruption may occur.


But I think, as with most things on Windows, I can safely ignore this message.

Reply to this topic

Sometimes you can find a solution faster if you try the forum search, have a look at the knowledge base, or check the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • Write in English. If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

 **     **  **      **   ******   ********  ******** 
 ***   ***  **  **  **  **    **  **           **    
 **** ****  **  **  **  **        **           **    
 ** *** **  **  **  **  **        ******       **    
 **     **  **  **  **  **        **           **    
 **     **  **  **  **  **    **  **           **    
 **     **   ***  ***    ******   ********     **    

Message: