OpenStack Billing Service Cloudkitty analysis (i) __openstack

Source: Internet
Author: User

We all know that cloud computing is a pay-as-you-go service model, the component of the billing service in OpenStack is Cloudkitty, and I am delighted to be able to communicate with you this evening to discuss OpenStack billing service--cloudkitty.

When it comes to billing, we have to say that OpenStack's metering services, although the early in the measurement services have gone some "detour", but now ceilometer, gnocchi, Aodh, Panko project steady progress is a turn. The Ceilometer is responsible for collecting the measurement data and processing pretreatment; Gnocchi is mainly used to store time series metering data and provide resource index, Panko mainly provides event storage service, Aodh mainly provides early warning and measurement notification Service. Ceilometer is divided into four, their respective responsibilities, so the data source of the billing service has a guarantee (note: Cloudkitty is not only for OpenStack billing, depending on the specific implementation of collector).

A core feature of gnocchi is the resource indexer, which quickly knows the basic information about the resource and the metric it has (for example, instance resources have Cpu_util, memory.usage, etc. metric). Another function is to store metering data--Measures (< time, value >) information for all metric. and metric measures information in the use of the above will involve a large number of query filtering and aggregation operations, the early Ceilometer will measures data in the SQL database in a table, the resulting delay in the actual use is intolerable, However, it is resolved in gnocchi and does not produce new performance bottlenecks as resources and time increase in the cloud environment.

Gnocchi's data archiving strategy explains why: The archive policy determines the number of points, and each point has a storage space of 9 bytes, so the storage space for each metric file is predictable; gnocchi when a new measures is received, is dynamically aggregated according to a predefined aggregation method and maintains the points information stored in the file, and when using the API to obtain a metric measurement information, the measurement information is read directly from the metric corresponding file points, so the time complexity is O (1) There is no performance bottleneck.

Thus, similar to the ceilometer metering data storage problems can be used gnocchi, then billing services generated by the cost of data storage is similar.

Cloudkitty official includes Cloudkitty, Cloudkitty-dashboard, python-cloudkittyclient three parts, Cloudkitty is a core functional component, contains tenant Fetcher,collector,rating and storage four core modules; Cloudkitty-dashboard provides the administrator with a concise operation settings interface and provides an intuitive view interface for the user. ; Python-cloudkittyclient provides a command-line interface for administrators.

Of course, the core of our focus is cloudkitty, which can be described in 24 lines of code above. On the whole, the Cloudkitty billing engine performs billing tasks in the form of timed (CONF.collect.period) tasks; At the beginning of each billing task, you need to know which tenants to charge get_tenants (), and then charge each tenant each service in turn First, the billing data is obtained from the metering data source through the collector module, then the data is handed over to the billing model to complete the cost calculation according to the pricing rules, and finally the cost data is persisted by using the storage module.

The four core modules of Cloudkitty are described in detail in the following sequence. Each module uses the stevedore, namely plug-in form of a variety of implementations, all have good configurable, scalability and flexibility.

The Tenant Fetcher module is to tell Cloudkitty who should charge the billing task for this round. You can know from CVS files (fakefetcher) and Keystone (Keystonefetcher) Who's resources/services need to be billed. Keystone is widely used to support V2 and V3 versions. So for those tenants who want to charge, they need to execute the command ' Keystone User-role-add--user cloudkitty--role Rating xxx ', will cloudkitty user to join XXX tenant and give rating role.

The collector and transformer modules are the collection and formatting of billing source data. From the realization of collector, cloudkitty not only can openstack billing, but also for other billing needs of the platform, only to implement and configure the corresponding collector module. The common collector modules are ceilometercollector and gnocchicollector, which use the Ceilometer and gnocchi APIs to get the metric data, In the OpenStack environment, Gnocchicollector will become the core collector.

By collector's Retrieve method, the metering data required for billing is obtained, such as item format, which is then formatted into the data format by transformer and eventually delivered to the billing module for processing.

This article is reproduced from:

Http://www.zerotc.com/newsdetail/161.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.