Brought to you by Ravello R&D, this post is about how we use DevOps best practices and innovate internally to optimize our own dev & test operations in the cloud. The Ravello Cloud Cleaner was born out of necessity to address our rapidly growing deployments and costly accounts on Amazon and other cloud providers.
With the ease of spinning off application VMs with Ravello, we began to see hundreds of deployments per day by the test and development teams. We realized that in order to lower our expenses we would need to run some kind of cleaner utility in the background and remove the residue from automated test runs and DevOps actions. Such residue can result from bugs in the application, automated testing cloud and network conditions, DevOps conditions, and more.
The purpose of the cleaner would be to identify and cut down on unneeded expenses and resources that we use on the cloud. Of course, we preferred a code that would be maintainable and, to the extent possible, cross-platform compatible.
After considering our options, we decided to write our own cleaning utility to clean up the leftovers from the automation process. Since we work with Java, I turned to a Java library – Apache jclouds.
How It Works
From the DevOps perspective, we typically run heavy weight automation in early morning hours, and we need to analyze and provide data within the company on a daily basis.
We decided on a six-hour window for cleaning, meaning that every machine that is live for more than six hours undergoes cleaning. This way the unused garbage is removed, reducing cloud costs.
The Ravello Cloud Cleaner is a job that runs once per hour and removes all instances that have been alive for more than six hours. This means that no machine can be live for more than 6 hours, unless it is intentionally tagged to prevent this using a different utility. The Cleaner also removes any orphaned volumes, meaning they have been alive for an hour or more and are not attached to any machines.
Clearly there are instances that should not be cleaned, that you need to let run for more than six hours; for example, if a developer needs to save and review the instance later in the day. To this end, specific instances can be tagged to “Keep” using a different operation utility, and the cleaner will skip them. To maintain control, we enforce time controls for the cleaning exemption; when a machine is tagged, the duration of the exemption must be defined (days, weeks, etc.). Only specific DevOps servers can be exempted from cleaning forever.Because the tool is based on a generic jclouds framework, we have been able to deploy the Cleaner on multiple clouds that are supported by jclouds and generic APIs with relative ease.
Implementation of the Ravello Cloud Cleaner has brought a significant decrease in our cloud computing costs. As a result, the company has adopted a policy that no one is allowed to disable the Cleaner job without explicit permission from the CTO.
Ravello Platform Autostop and Scheduling Features
In addition Ravello platform enables our customers to configure a resource in an auto stop mode, which enables an automatic stop of the compute resources. Ravello also supports a scheduling feature for an application or cluster deployment so that Ravello users can set a time frame for running the application based on the application blueprint. These features enable our customer to control their usage and avoid the typical cloud cost sprawling.
For more information or actual code snippets, I invite you to contact me at firstname.lastname@example.org
About Ravello Systems
Ravello is the industry’s leading nested virtualization and software-defined networking SaaS. It enables enterprises to create cloud-based development, test, UAT, integration and staging environments by automatically cloning their VMware-based applications in AWS. Ravello is built by the same team that developed the KVM hypervisor in Linux.