Build an affordable virtual classroom with KVM

You could use Amazon cloud services to offer a virtual classroom, but a simple KVM deployment can give you better performance for a small price.

The days of classroom training are largely over. As subjects of technical courses tend to get more complex, in many cases it doesn't make sense to organize courses at physical locations with hopes that attendees will fly in to listen to a technical instructor in front of the classroom. More and more technical classes are being delivered online through virtual classrooms. For companies hoping to eliminate the hassle of offering a physical training location, KVM virtualization can help provide an online learning environment.

While providing an online course, it is useful if course participants can participate in at least some hands-on training. You could use Amazon cloud instances to deliver such an environment, but the performance of cloud instances isn't always predictable. That is why it makes sense to create your own KVM-based online training lab. This two-part article describes how to create a virtual classroom to deliver performance at a reasonable price.

Given the current development of hardware, it's not necessary to pay excessive amounts for hardware that performs well. Several affordable hardware platforms are available at a reasonable price. I like Intel NUC for creating online course environments. The hardware is silent, has low power consumption and, with a small size, it is very portable. Apart from that, Intel NUC is available with Intel i5 processors (four-core systems at 1.30 GHz), which perform perfectly for virtualization and can host a maximum of 16 GB of RAM. If you're hosting an efficient operating system, such as Linux, this allows you to run many instances of Linux virtual machines.

Bandwidth needs

Even more important than the hardware is the Internet connection. A virtual classroom will require reasonable bandwidth. There is no need for 100-plus Mbps connections, but an average of 40 Mbps is required if you want to be able to accommodate a reasonable amount of course participants. I've run Linux courses (using Red Hat Enterprise Linux 7) for 30 course participants, each of them working on their own virtual machine. Given that the participants were mainly working from a shell environment, this worked very well. Of course, if participants are operating from high-demand graphical environments, bandwidth requirements will be higher. Before purchasing expensive, high-bandwidth Internet connections though, you should realize that it's just the screen images that are sent to and from the virtual machines and not much more than that.

When many course participants are actively working on their virtual machines, fast solid-state storage is mandatory. Don't even try to create an online course environment on traditional disks, because the I/O channel will be saturated very fast, leading to a meltdown of the online environment. Investing in high-end solid-state storage is important and helps serve user requests immediately.

Memory requirements

When it comes to a virtual classroom, you may not require as much RAM as you think for each VM. KVM uses Kernel Samepage Merging (KSM), which is a deduplication feature that merges anonymous private memory pages. This ensures that if the same memory page has to be loaded multiple times, the Linux kernel on the host operating system loads it once only and treats it as shared memory.  A classroom environment can typically benefit from KSM, because course participants will often be working on the same tasks using different virtual machines.

However, even with the memory savings KSM provides, you still need to ensure you have adequate RAM and swap space available. Imagine a situation in which you're running 30 VMs, each with 512 MB of RAM. The real memory requirement in that case would be set to 15 GB of RAM. You may find that under ideal circumstances using KSM, 8 GB of RAM will be sufficient on the host computer. But, if for some reason the VMs suddenly start working on dissimilar tasks, you'll need to make sure that the total RAM and swap space available will at least allow you accommodate for the total amount of memory required by the VMs. Some additional tuning is available through the /etc/ksmtuned.conf configuration file as well.

In this article, you've read about the hardware and memory requirements for setting up a KVM-based course environment to facilitate online courses. In the second part of this article, you'll read how to manage the VM installations by using Linux logical volumes.

Dig Deeper on Open source virtualization