1

Setup:

Windows Server 2008 R2, Hosted on HyperV Virtual Machine allocated 3GB Memory.

I've setup a RAMDisk (capacity of 512MB more than sufficient for our requirements) using ImDisk on this virtual web server and allocated it 3GB of RAM (the hosted applications don't require any more than ~768MB under heavy load).

Originally the WebRoot directory was on a network share which performed sufficiently but have noticed under heavy load this has resulted in a noticeable increase in LAN traffic to the network sharing server (which I believe is accessing the network share to serve up the webpages to my users - should this be happening?).

As the VM is hosted in a Fail-Over Cluster the VM's C:\ drive is stored on an iSCSI SAN, so there was no performance benefit (tested this) in keeping the WebRoot folder on the C:\ drive.

So I have opted for putting the content onto a RAMDisk which of course showed a good improvement in terms of Access Time especially. The source content would still be stored on the Network Share, but would be synchronised to the RAM Disk every 24 hours.

Anyone have good reason to believe this would:

A) Not be worth it?

or more importantly,

B) Be an out-right bad idea!?

Critique appreciated, both positive and negative!

killercowuk
  • 233
  • 2
  • 6

2 Answers2

4

IIS will not cache content from a network share, which is why you were having bad performance. It should however cache the files when stored on the local disk. The fact that your server is virtual and the host's disk store is on an iSCSI disk should not affect IIS's ability to cache the files.

I can't imagine a ramdisk giving you a performance edge over IIS's native disk caching barring any extremes after the first request.

I would be opposed to using a ram disk unless you have an edge case where the type of content you need to cache doesn't fit in with IIS's cache. I like the KISS rule. ;-)

Bad Dos
  • 643
  • 3
  • 9
  • 1
    If I could upvote more than once, the last paragraph would get a vote of its own - unless you have an edge case, there's little difference between a ramdisk and letting the OS cache objects in RAM, except that you've added an additional layer of complexity. – Rob Moir May 11 '12 at 19:48
  • Thanks Bad Dos, I'm also an avid fan of the KISS rule and completely agree that this is certainly not keeping it as simple as possible! I'll be honest, it had not occured to me that IIS may choose to not cache content stored on a network share(!) and would certainly explain some performance issues! This fact would certainly explain why I kept seeing traffic hit the file-hosting server! – killercowuk May 11 '12 at 20:15
1

Using a RAM disk in a VM will do just about the same thing as using a RAM disk in a physical machine.

Windows (and for that matter almost any other OS) will use any extra available RAM for file caching. It will keep your recently-used files available for as long as it can, balancing demand for memory against file access time.

When you use a RAM disk, you're essentially saying that you know, a-priori, which files need to be available very quickly, and that they won't be the recently-used ones. If they are actually the recently-used files, then by using a RAM disk you're throwing away the opportunity to use the memory more flexibly, possibly improving performance in other areas.

The time necessary to read a file from actual storage (not the RAM disk) in a VM is probably somewhat longer than it would be in the same machine without the virtualization. So you need to ask yourself this question:

Am I using a big powerful VM host with a really good storage subsystem, or am I using the same machine I used to use for IIS but now I'm virtualizing the IIS server?

If it's the first, then file read latency might not matter as much. If it's the second, file read latency will be larger in the VM, and thus a RAM disk might make more sense.

Furthermore, you need to ask yourself another question:

Am I hosting only one VM on this server, or am I sharing this host with several workloads?

If you're sharing the host, then you need to consider whether the RAM that you're giving to the IIS VM for a RAM disk could be better used by some other VM. If you have Dynamic Memory turned on within your VMs then it will be shuffled into the VM that currently needs it. You might get much more work done in aggregate if allow that RAM to be used where it's actually needed at the moment, rather than deciding a-priori that it should be used to lower latency of file access for IIS.

Jake Oshins
  • 5,146
  • 18
  • 15
  • Thanks Jake, it was certainly the increased access times on the VM's C:\ drive that drove me down this path, as the underlying iSCSI is not always the quickest as it's typically under a fair amount of load throughout the day - and it's not cream of the crop harware either :( I think you've hit the nail on the head when you say I already know what I want cached in RAM, I do! So I'm going to tell the system to do that right away. This will cost some extra RAM that could be used in other VMs, but means any idle web applications will be able to spin up (virtually) immediately. – killercowuk May 11 '12 at 20:28