Multi Tenant Metering in Windows Azure

by on April 30, 2012

Our global ISV team just announced the public availability of the Cloud Ninja Multi-Tenant Metering Block (CNMB). The CNMB code sample enables SaaS ISVs to meter tenant-level consumption of various Windows Azure resources such as bandwidth, storage, SQL Azure, and compute. 

The first Cloud Ninja sample included some metering capabilities along with many other SaaS concepts such as monitoring, scaling, provisioning, etc. Given the demand for multi-tenant metering, there was a need for a stand-alone metering sub-system isolated from a main SaaS application that was easy to deploy, based on standards, and extensible. The outcome of that effort is the CNMB. Here are some screen shots:


clip_image001      clip_image002



It provides tenant-level meters, application level aggregates, a rich query model based on OData, an extensibility to implement custom meters. All the data can be queried using the OData API, which enables interesting mash-ups in PowerPivot and integration with external systems like billing.

The CNMB includes an HTML5 portal to visualize tenant and app level usage. You can try the live demo here and download full source code from CodePlex. The live demo is currently metering our Cloud Ninja application. When you try the demo, check out links on home page to app-level, tenant-level usage, PowerPivot dashboard, and OData feed.

It comes with out-of-box meter providers for bandwidth, storage, SQL Azure, and compute. In the future we will add providers for Tomcat and CDN. It is easy to write custom providers if you want to meter application specific resources. 

Key features of the CNMB

  1. Easy to Use: The CNMB works with existing multi-tenant SaaS application in a non-intrusive manner.  It needs simple configuration to point to SaaS application’s storage account and SQL Azure database and simple regular expressions to associate tenants with resource consumption. 
  2. Economical:  The CNMB can be deployed in a single web role, which hosts UI, Web Services, and metering workers.  Data schema is optimized so that 1GB SQL Azure database can hold an entire year’s worth data for thousands of tenants.
  3. Standards Based: All data in and out is via authenticated OData API.  OData allows rich query model on top of meter data.  We support both JSON and Atom payloads.  This enables 3rd party apps like PowerPivot and external systems like billing to consume meter data through industry standard API.
  4. Extensible: The CNMB has multiple levels of extension points from writing your own tenant resolver, defining customer meters, and developing customer meter providers.

If you are building a multi-tenant SaaS application, please check out the code sample and to provide feedback or feature requests using CodePlex’s discussion feature. 

For MSDN subscribers, Microsoft Partners or BizSpark members this is also a great opportunity to take advantage of the free Windows Azure Benefits and try this out on Azure servers of your very own.