[abacus] Refactor Aggregated Usage and Aggregated Rated Usage data model


Saravanakumar A. Srinivasan
 

Started to look into two user stories([1] and [2]) titled  "Organize the usage report data model for better querying and DB utilization"

Current state of Abacus processing pipeline starting from Usage Accumulator:

    a) Usage Accumulator processes metered usage for a resource instance, accumulates the usage at resource instance scope and then forwards accumulated usage for a resource instance to Usage Aggregator.
    b) Usage Aggregator processes accumulated usage for a resource instance, aggregates the usage at following scopes: 
        organization.resources, 
        organization.resources.plans, 
        organization.spaces.resources, 
        organization.spaces.resources.plans, 
        organization.spaces.consumers.resources and 
        organization.spaces.consumers.resources.plans, and then forwards aggregated usage for an organization to Usage Rating Service.
    c) Usage Rating Service processes aggregated usage for an organization, rates the aggregated usage at following scopes: 
        organization.resources.plans, 
        organization.spaces.resources.plans, and 
        organization.spaces.consumers.resources.plans.
    d) Usage Reporting Service processes rated usage for an organization and summarizes usage and charge at all aggregation scopes. See [3] for a sample Abacus usage report.


Initial thought on changes needed to optimize steps b, c, and d are

    b) Usage Aggregator processes accumulated usage for a resource instance and aggregates and rates the usage at a consumer scope - equivalent to the scopes of organization.spaces.consumers.resources and organization.spaces.consumers.resources.plans and then maintains a normalized aggregated usage for an organization that contains references to all consumer scoped documents that belong to the organization.
    c) Eliminate Usage Rating Service and split the current rating step across Usage Aggregator and Usage Reporting Service.
    d) Usage Reporting Service processes a normalized aggregated usage for an organization, uses references to get all consumer scoped documents that belong to the organization, aggregates and rates consumer scoped usage at all other scopes, and then summarizes usage and charge at all aggregation scopes.

Any comments?


[1] https://www.pivotaltracker.com/story/show/107598654
[2] https://www.pivotaltracker.com/story/show/107598652
[3] https://gist.github.com/sasrin/697437b33d38bdddf825#file-report-json

Thanks,
Saravanakumar Srinivasan (Assk),

Bay Area Lab, 1001, E Hillsdale Blvd, Ste 400, Foster City, CA - 94404.
E-mail: sasrin(a)us.ibm.com
Phone: 650 645 8251 (T/L 367-8251)

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.