Is a Windows Azure worker role instance a whole VM?
Asked Answered
B

2

8

When I run a worker role instance on Azure, is it a complete VM running in a shared host (like EC2)? Or is it running in a shared system (like Heroku)?

For example, what happens if my application starts requesting 100 GB of memory? Will it get killed off automatically for violation of limits (á la Google App Engine), or will it just exhaust the VM, so that the Azure fabric restarts it?

Do two roles ever run in the same system?

Bilyeu answered 7/6, 2012 at 3:17 Comment(0)
I
10

It's a whole VM, and the resources allocated are based directly on the size of VM you choose, from 1.75GB (Small) to 14GB (XL), with 1-8 cores. There's also an Extra Small instance with 768MB RAM and shared core. Full VM size details are here.

With Windows Azure, your VM is allocated on a physical server, and it's the fabric's responsibility of finding such servers to properly allocate all of your web or worker role instances. If you have multiple instances, this means allocating these VMs across fault domains.

With your VM, you don't have to worry about being killed off if you try allocating too much in the resource dep't: it's just like having a machine, and you can't go beyond what's there.

As far as two roles running on the same system: Each role has instances, and with multiple instances, as I mentioned above, your instances are divided into fault domains. If, say, you had 4 instances and 2 fault domains, it's possible that you may have two instances on the same rack (or maybe same server).

Indult answered 7/6, 2012 at 3:31 Comment(6)
Re: last paragraph. But the two instances would still be in separate VMs, right?Bilyeu
Re: "with your VM..." Does Azure start swapping to disk if I ask for too much memory up to a treshold, or will I get an out-of-memory error immediately?Bilyeu
Instances are never combined into the same VMs. And regarding disk-swapping and out-of-memory conditions: Everything is virtualized. While I can't give an absolute definitive answer, you can imagine each physical box having enough resources to support a full 8-core, 14GB (XL) VM. This also means there's enough physical capacity to support multiple smaller VMs.Indult
I understand that the instance is virtualized, but what does this have to do with what happens inside the VM regarding disk-swapping and out-of-memory conditions?Bilyeu
I mean these aren't the things you typically worry about in Windows Azure. These are Windows 2008 Server VMs with some role-scaffolding code to kickstart your code. Expect the same out-of-memory conditions here as in an on-premises VM or machine.Indult
I see. Perhaps a more to the point question is: do Windows Azure instances have Linux-style swap-to-disk enabled by default? Or is the virtual memory the same as the physical (virtualized) memory?Bilyeu
E
3

I ran a quick test to check this. I'm using a "small" instance that has something like 1,75 gigabytes of memory. My code uses an ArrayList to store references to large arrays so that those arrays are not garbage collected. Each array is one billion bytes and once it is allocated I run a loop that sets each element to zero and then another loop to check that each element is zero to ensure that memory is indeed allocated from the operating system (not sure if it matters in C#, but it indeed mattered in C++). Once the array is created, written to and read from, it is added to the ArrayList.

So my code successfully allocated five such arrays and the attempt to allocate the sixth one resulted in System.OutOfMemoryException. Since 5 billion bytes plus overhead is definitely more that 1,75 gigabytes of physical memory allocated to the machine I believe this proves that page file is enabled on the VM and the behavior is the same as on usual Windows Server 2008 with the limitations induced by the machine where it is running.

Edmondo answered 8/6, 2012 at 10:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.