With the sudden proliferation of cloud-based services it no longer seems like much of a novelty to have an elastic infrastructure capable of on-demand scaling provisioning of virtual resources. Instead it has become something almost taken for granted, and it may even be expected that this can be easily provided given enough on-premise machines. New terms, however misleading, have even been coined to describe such an internal elastic architecture, and software custom tailored to the challenge has already been developed many times over, with even more offerings still in development.

However, working in technology education layers an additional set of requirements on this common expectation. Customers themselves must be able to trigger the provisioning of virtual resources, and access them directly from out in the wild wild web. What I am describing, albeit rather cryptically, are Virtual Labs.

The concept of a Virtual Lab is that a student can access a web page, and after a short period of boot-up time, be connected directly into a virtual machine that is set up and ready to provide a hands-on learning experience. These activities are typically limited in duration and do not provide persistence of a student’s work between sessions. This is less than ideal for typical classroom learning where a student will be using a single machine all week, but makes perfect sense for self-paced learning offerings wherein the student may spend many weeks working through the same material and computing resources cannot be tied up for the entire duration.

Right now QuickLearn is working to deliver some of its core .NET, SharePoint 2010 and BizTalk Server 2010 training offerings in a self-paced format. As part of this effort, it was decided that the lab activities for these new courses should be provided as Virtual Labs available from anywhere and on any device or platform containing a capable RDP client. An additional requirement was that we must be able to use existing VHD files for the classes, without having to rebuild anything or re-install software.

After existing solutions were evaluated (including Microsoft’s Virtual Machine Manager Self-Service Portal), it was decided that the solution should be built internally. Development was completed at the beginning of this week, and the resulting experience was even better than I had initially imagined.

(click for a larger view)

The solution ended up ultimately consisting of four separate components. The first was QuickLearn’s online player application. This provides the interface through which a student can initiate a Virtual Lab. Once the student decides to begin a virtual lab, a request is sent to a Virtual Lab Service. The Virtual Lab Service is a WCF service that is responsible for managing a pool of Hyper-V servers, and routing control messages to start / stop virtual machines. It is also responsible for providing the client with updates about the status of their request. Once the Virtual Lab Service receives the request, WMI is used to spin-up the requested instance (from a known save state). Within each instance, an application is running that will call back to the Virtual Lab Service when it realizes that the machine is back online. Once the Virtual Lab Service knows that the machine is online, it provides the client with connection details for accessing the Virtual Machine. Throughout all of this there is a processing loop that ensures VMs are properly destroyed whenever the time allocated for a given lab has expired.

Since RDP is being used for connectivity, the student can be offered an embedded connection within their browser (given that they are using Internet Explorer). If their browser will not support an embedded connection, they are provided connection details and instructions to connect directly to the image. One really interesting implication of this is that students running Windows 7 will be able to access newer Virtual Labs with true multi-monitor support.

The implications of using Hyper-V on the back-end is that we are able to share machines with up to three students and still provide a killer experience with multiple cores and up to 4GB of RAM per instance.

Overall, the development was more or less straight-forward, only requiring ~30 human-hours of time, and the reward for students will be incredible.