A Metered Cloud-Services Charging System

Share: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditEmail this to someonePrint this page

The Emerging Technology (ET) team works with a diverse range of software components, languages and systems, and with a very varied customer base. The work undertaken by the team ranges from blue-sky research where the main output is technical and scientific papers, to proof-of-concept and first-of-a-kind software, through to providing expertise to enhance existing customer systems and processes.

One example of the latter is an IBM-internal project, which introduces a metered cloud-services charging system that logs the use and resulting charges for a variety of infrastructural software services. Such services include those providing the provisioning and use of virtual machines (VMs), and a variety of collaboration tools. The solution and infrastructure is developed by a team staffed from both IBM’s Office of the CIO, and ET. To date, ET has been particularly involved with the IBM Cloud and Development Platforms (C&DP) team (who provide one of the metered services), as well as developing the Docker-based continuous delivery framework used by the overall solution.


The C&DP service provider.

C&DP are a multi-site organisation (UK, US and Canada), providing an Openstack-based VM service, which provides compute resource for use by a variety consumers, including IBM product development teams.

Openstack can be used to group related users under an Openstack ‘project’. The project can also be used to limit various resource quantities (for example the number of VMs, or number of IP-addresses assignable etc). Typically a development team will map to a project, and the team manager will be assigned administration rights over the project. C&DP’s platform offers standard ‘flavours’ of machine, based on the available RAM.

Although the platform is a new initiative, there are a number of early users which have already been using the service. These users were granted access under the existing charging model for IBM-internal VM services.


The charging system

The solution provides usage-based monitoring of services (‘showback’), and, optionally, billing (‘chargeback’). Users interact with it by creating an account, using a web-application that is part of the solution. This also provides subsequent account administration, and a view of service usage both for service providers (for example, C&DP), and service consumers (for example, development teams). Usage trends and forecasting, and a visualisation of service usage will also soon be included.

A service provider gains a view of how their services are being used (which are the active consumers, which services are popular, and exactly how the service usage and charges break down). Service consumers gain a view of their consumption and are able to generate an invoice for any time period, whenever they wish, to determine how they are being charged. A precisely metered model also encourages prudent use of resources, rather than keeping services active ‘just in case they are needed’ (for example, VMs provisioned for extensive periods of time, but seldom used).

When an account is created, an owner is registered, as well as a financial analyst. Having an analyst to scrutinise invoices is standard practice in existing corporate accounting systems, and this workflow is also supported by the option to export invoices to spreadsheet format.

A cloud-services invoice.

A cloud-services invoice.

The solution

The chosen charging model is (intentionally) currently very simple; consumers are charged for the time each VM is provisioned, with the rate scaling according to VM RAM capacity. As Openstack provides excellent monitoring and statistics, the model could include other metrics in the future (disk space, CPU time, number of allocated IP addresses etc). Although consumers can view usage and the equivalent charges at any time, consolidated billing for VM usage will occur quarterly.

The solution works as follows.

  • Openstack projects may have metadata added to them, and so each is tagged with the account ID that will be used to pay for the VM usage associated with the project.
  • A Python script is run once a day, and it queries the mongoDB instance that Openstack uses to store its monitoring statistics, as well as the Openstack project metadata. The statistics data for the previous day is written to a JSON file (including the account ID associated with each VM included in the data).
  • The script then uploads the JSON file to a central data collector server.
  • Billing data is calculated and stored by an application that runs a daily scheduled job to import the JSON data and process it. Each VM event recorded in the JSON is processed to determine the total provisioned time for the VM for the given day (the pertinent events are VM creation, deletion, and ‘still here’ notifications). Once processed, the results are stored in a database. Data from each C&DP site is partitioned, and each size of server is regarded as a separate service. This allows the final invoices and statistics to be itemised by server location and size.
  • The front-end part of the solution (written in Node.js, and running on an Express server) calls the billing part of the application (which runs as a JEE Web application) to gather the correct invoice and statistics data for the logged-in user, and for the filters the user has chosen (date range, and specific services or groups of services). As previously mentioned, the front-end also supports account management (hooking into the company’s internal organisational directory to identify users and their roles, e.g. financial analysts, managers etc.), invoice export to pdf or spreadsheet, and soon, usage visualisation.

The solution runs on infrastructure based on Docker containers and Openstack VMs. This enables a continuous integration development process which allows us to achieve a fast development velocity (as do the Agile practices we adopt), and in addition, provides excellent resilience to application load for the production system.

The team

IBM Emerging Technology UK : Amardeep Bhattal.
IBM Office of the CIO : David Jaramillo, Shannon Angdrea, Andrew Elek, Priyansh Jaiswal, Bharat Lakhiyani, Duy Nguyen.

Share: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditEmail this to someonePrint this page
Amardeep Bhattal

Amardeep Bhattal

Software Engineer at IBM UK
Amardeep Bhattal is a Software Engineer at IBM UK's Hursley Laboratory. He has worked in a variety of product development teams, contributing code to messaging products (including WebSphere MQ), application servers (WebSphere Application Server and Liberty) and a service registry product (WebSphere Service Registry and Repository). He has developed code using a variety of languages and technologies (including C, Java, Ruby, Javascript, Python, RDF&OWL, SQL and no-SQL databases). He currently works for the UK Emerging Technology team where he has contributed to the Controlled English controlled natural language and to client projects, most recently a cloud-services billing solution.
Amardeep Bhattal

Latest posts by Amardeep Bhattal (see all)

Amardeep Bhattal

Leave a Reply