Cloud Architecture Patterns: Stateless VM

Intent

Ensure a virtual machine does not carry a permanent state so that it can be easily provisioned, migrated, and managed in the cloud.

Also Known As

Disposable VM

Category

Behavioral

Motivation

Virtualization is the cornerstone for cloud computing, especially at the infrastructure level. With many virtual machines created, managing them becomes a big challenge.

Among these challenges are system provisioning, backup, archiving, and patching different virtual machines. These administrative tasks take lots of CAPEX and OPEX.

We need a better way to architect applications for the cloud.

Solution

Making a VM stateless solves a lot of problems. For one thing, you force applications to save data outside of the virtual machine. No longer do you need to back up the virtual machine – only the data. It also makes the system provisioning easier without differentiating the different instances. When the stateless VMs crash for whatever reasons, you don’t lose much. Just add a new virtual machine and voila!

A stateless VM is not a VM that has its own local data. More often than not, it does require some local data or a local cache for better performance. But these data don’t need to be persisted. In some cases, a stateless VM can have additional software installed or data pulled in from a known repository. This process should be fully automated with self-starter scripts, or managed by an external installer.

Once a stateless VM goes live, it should discover all the related services to persistent data. The stateless VM has to rely on the environment to work effectively. It includes directory services, data services, and so on.

With stateless VMs, you can improve mobility inside an enterprise and external transfer to the public cloud. For one thing, you just need to transfer a VM image once and only once. The second time, you just pass around a pre-agreed VM catalog ID that can be no more than several digits. Pretty easy.

When your application runs into problems, instead of diagnosing the problem you just remove the problematic VMs and add new virtual machines. With this capability, you can also easily scale out your applications by adding new VM instances as you need them.

Last but not least, the software upgrade and patch. It has been a big pain to upgrade and patch software in large deployments. You have to do it with each individual machine despite virtual or not. With stateless VM, you only need to patch the template and new virtual machines will pick it up seamlessly.

Applicability

Use stateless VM to

  • Standardize virtual machines to the minimum variations;
  • Scale out the applications with uniform VMs;
  • Reduce storage consumption and archiving efforts;
  • Ease the software upgrading and patching process;
  • Simplify virtual machine provisioning and lifecycle management;
  • Improve VM mobility within and across clouds. You no longer need to transfer VM images, just a VM catalog ID;
  • Reduce the chances of being infected by a virus.

Consequence

Stateless VM is great but not universally applicable. The consequences of using stateless VMs include:

  • You are forced to separate data from code which may mean more work than otherwise;
  • Application data has to be persisted in different locations in different ways. You may need additional logic for better data availability;
  • Customization has to be injected at runtime, preferably pulled by the individual virtual machines, rather than pushed by a central server;
  • It may complicate simple/small applications by separating different concerns;
  • A delay or breakdown of the network might result in loss of data.

Known Uses

Amazon EC2 is a good example of stateless VM. After a virtual machine is provisioned, you can install anything there. But you cannot persist any of them after the virtual machine is powered off. To save data, you have to use either S3 or EBS. This forces you to architect your applications differently.

Related Patterns

VM pool: stateless VM may or may not be recycled, depending on the new additions after being created whether they can be reset or cleared.

VM Factory: making VMs stateless eases the job of a VM factory because it does not need to track differences among VMs. When you need a virtual machine, you can just pick any one.

This entry was posted in Cloud Computing and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • NEED HELP?


    My consulting helps clients with virtualization and cloud computing, including VMware infrastructure automation and orchestration, vSphere management APIs, and deep product integration with hypervisors. Current training offerings include vSphere APIs training, vCenter Orchestrator training, and etc. Should you, or someone you know, need these consulting services or training, please feel free to contact me: steve __AT__ doublecloud.org.

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.