Enhancing Apache CloudStack with a Native Rating System for Market Readiness

Apache CloudStack, an open-source cloud infrastructure management platform, has long been a cornerstone for deploying and managing scalable cloud environments. However, to fully meet the demands of modern cloud service providers, integrating a native rating system is critical. This article explores how Apache CloudStack can be enhanced with a native rating solution to streamline billing processes, support flexible pricing models, and align with market requirements.

Core Components of the Rating System

Rating System Architecture

The rating system in Apache CloudStack is designed to calculate the monetary value of cloud resource usage, distinct from the billing system, which is handled by external tools. It relies on platform events—such as virtual machine creation, volume allocation, or network configuration—to generate usage data. Each event is linked to an account or project, providing a granular view of resource consumption. The data flow involves:

  • Event Generation: CloudStack records events in a database when users request resource creation.
  • Event Processing: Auxiliary tables aggregate event data to produce rating data (usage data), which serves as the foundation for billing.

Accounting System Integration

The accounting system tracks detailed resource consumption, supporting both per-entry and monthly billing models. Its workflow includes:

  1. Event generation
  2. Storage in auxiliary tables
  3. Generation of rating data
  4. Creation of final billing entries

For example, a virtual machine’s startup event triggers initial data recording, while ongoing usage updates the data periodically.

Quota 1.0 vs. Quota 2.0: Evolution of Pricing Models

Limitations of Quota 1.0

Quota 1.0 imposed rigid constraints, allowing only a single tariff per resource type. This lack of flexibility hindered cloud providers from implementing differentiated pricing strategies, such as tiered hosting or storage-specific charges.

Advancements in Quota 2.0

Quota 2.0 introduces context-based rating rules written in JavaScript, enabling dynamic pricing based on resource attributes like account tags, host labels, or storage types. Key improvements include:

  • Flexible Pricing Rules: JavaScript allows rules like:
    if (hostTag === "Platinum") return 50; 
    else if (hostTag === "Gold") return 40; 
    else return 30;
    
  • Billing Modes: Support for prepaid (credit-based usage) and post-paid (usage-based billing).
  • Discount Strategies: Multi-stage rules for tiered discounts, such as 10% for long-term clients or 5% for high usage.

Real-World Use Cases

Host Cluster Differentiation

Cloud providers can assign varying unit prices based on host tags (e.g., Platinum/Gold/Standard). This ensures premium clusters command higher rates while standard clusters remain cost-effective.

Windows Licensing Charges

By identifying operating systems via virtual machine metadata, providers can apply licensing fees. For instance, Windows instances incur additional costs based on runtime and resource scale.

Storage Type-Based Billing

Storage type (SSD vs. non-SSD) determines whether charges apply. A JavaScript rule might look like:

if (storageType === "SSD") return 10; 
else return 0;

Current Limitations and Future Roadmap

Technical Constraints

  • Limited support for ECMAScript 1.0, requiring upgrades to newer versions.
  • Incomplete documentation and pending upstream contributions for certain improvements.

Planned Enhancements

  • Adoption of updated JavaScript engines.
  • Comprehensive documentation updates.
  • Upstream contributions to the Apache Foundation project.

Production Environment Examples

Billing Data Views

Users can analyze resource consumption statistics, historical records, and incremental charts. Filters by account or project allow granular insights, such as:

  • Tracking a project’s resource usage.
  • Monitoring an account’s virtual machine runtime and associated costs.

Billing Cycles and Settlement

Daily billing processes generate entries for resource usage, such as:

  • Calculating daily costs for virtual machine runtime and vCPU usage.
  • Aggregating monthly totals and resource distribution for multi-VM scenarios.

Prepaid/Post-paid Models

  • Prepaid: Resource usage halts when account credit is exhausted.
  • Post-paid: Costs are billed post-usage, with real-time account balance tracking.

Conclusion

The integration of a native rating system into Apache CloudStack addresses critical gaps in pricing flexibility and billing automation. By leveraging JavaScript-based rules, cloud providers can implement dynamic, context-aware pricing models tailored to their market needs. While technical constraints remain, the roadmap for upstream contributions and documentation improvements ensures sustained evolution. For organizations seeking to deploy scalable, market-ready cloud solutions, this enhancement represents a pivotal step toward operational efficiency and competitive advantage.