Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a windows server 2008 R2 file server, that has some large files that on rare occasions is very important to get copied to another system as quickly as possible.

Is there a way to force these files to always be cached to RAM?

share|improve this question

4 Answers 4

up vote 5 down vote accepted

Most of the time the bottleneck isn't so much getting the file from disk to RAM but rather from RAM to network. Unless the system is very bogged down in activity or low on RAM, Windows should handle file caching fairly intelligently.

You might want to do some testing and see if there really is a bottleneck with your system that would see marked improvement by keeping certain files in memory versus swapped to disk when Windows thinks it should be saved to disk. I'm betting you'll save very little time as the bottleneck would most likely be the network, and by the time the file is queued up to go to the network the drive is already filling buffers in memory as it pulls the file off the drive.

That said, the only really reliable way to have data files held in memory that I know of is to create a RAM disk and copy the files there, assuming they are static. Otherwise you have a power outage and they're gone.

Otherwise you might want to invest in lots of RAM and high speed disk drives. Maybe even a mirrored RAID configuration, as that has a high read (slower write) performance. I'd let Windows and the memory manager do it's thing, and focus on minimizing access time with better subsystems (fast disk, RAID, lots of memory, high speed and high quality NIC) rather than tweaking it to the point that debugging or troubleshooting could become more of a pain down the road.

share|improve this answer
1  
The RAM disk significantly increased the transfer speed. Thanks! –  Josh Oct 27 '10 at 14:27

Yes, there is a way to trick the OS Memory Manager and load the entire file/folder into the OS System cache. Take a look the the post here: http://www.arcgis.com/home/item.html?id=08a5a05ff82446bb8a8befad03b1bb86

share|improve this answer
3  
Welcome to Server Fault! We really do prefer that answers contain content not pointers to content. Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Iain Feb 25 '13 at 18:42

You can try supercache or other alternate cache solutions, or you may want to consider using a SSD with high speed read access - That will saturate almost any network connection pretty easily.

The only other option I don't think matches your needs but I'll mention it:

If you are WRITING the file in your application you can try creating with:

FILE_ATTRIBUTE_TEMPORARY and FILE_FLAG_DELETE_ON_CLOSE

This tells Windows to try to keep files in RAM instead of on disk - I don't think this will match your needs though but you can read more at http://msdn.microsoft.com/en-us/library/aa363858%28VS.85%29.aspx#caching_behavior

Steve Radich - http://www.BitShop.com/blogs.aspx

share|improve this answer

There is no standard way to do this. Windows lacks such hooks. If this is really important to you, you can attempt to game the Windows file-caching algorithms by frequently accessing the file from the network. That should keep the file cached, but there are no guarantees. IIRC, you don't need to read the entire file to get the entire file cached, so reading a subset of the file should be sufficient.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.