SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
Dough:
OpenStack
Billing Project

Folsom Design Summit
2012-04-16


Luo, Zhongyue
lzyeval@gmail.com
TODO
 Intro
 Design concepts
 Architecture
 Example
 RPCs
 RDBMS model
 Billing logic
 Discussions
                   2
Intro
  What to expect from Dough
        Keep track of billing info to charge tenants
        Flexible customization of payment policies
              How much/often to charge for resource unit
              Handles prepaid or pay-as-you-go
  What Dough does not do
        Keep track of tenant’s resource usage
              Needs a monitoring/metering system
        Deduct money from account
              DIY using database as a queue
                                                           3
Design concepts
 Highly configurable
      Billing frequency, unit of measure
 Asynchronous
      All events are asynchronous
 Independent
      Pluggable clients to access other projects
 Scalability
      Handle billing of many users
 Nova conventions
      Message protocol                             4
RPC
Architecture                               Database
                                            Client

 Compute

 Network                RDBMS             Dashboard

 Storage




           Monitoring
                                Billing
           (Metering)




            NoSQL                                     5
RPC
Architecture                                         Database
                                                      Client

 Compute

  Network                   RDBMS                   Dashboard

  Storage




                Collector


 Monitoring
                                     Farmer         API daemon
 (Metering)

                                    Dispatch jobs   Subscribe or
                Collector                           unsubscribe
                                                     products /
                                                     Query info
               Check status /
              Retrieve usage /
              Create purchases                                     6
Example: creating an instance
  Compute

  Network                          RDBMS                 Dashboard

  Storage
                                                  2
                            Create subscription
                                  record


                            Collector
{'method': 'subscribe_item',
                                                               1
  'args': {
   Monitoring '62a8a396d9f44ef4a655ec1d7bd3801b',
    'user_id':                                  Farmer   API daemon
   (Metering) '864bbc5d23ea47799ae2a702927920e9',
    'tenant_id':
    'region': 'deafult',
    'item': 'instance',
    'item_type': 'm1.tiny', Collector
    'payment_type': 'hourly',
    'resource_uuid': 'uuidofinstance',
    'resource_name': 'nameofinstance',
}}
                                                                      7
Example: creating an instance
 Compute

  Network                   RDBMS                      Dashboard

  Storage

                                    Retrieve expired
                                     subscriptions
                             2
                Collector
                                         1
                    Request for
 Monitoring           charge           Farmer          API daemon
 (Metering)

                                     Dispatch jobs
                Collector


               Check status /
              Retrieve usage /
              Create purchases                                      8
Example: creating an instance
 Compute

  Network                             RDBMS                Dashboard
              Check instance
  Storage         status
                                  5
                     3          Create purchase record /
                                  Update subscription
                      Collector    status and expiring
                4                       datetime
              Retrieve instance
 Monitoring    usage quantity                  Farmer      API daemon
 (Metering)


                      Collector




                                                                        9
Example: creating an instance
 Compute

  Network                 RDBMS        2           Dashboard

  Storage
                                     RDBMS model


                                                            1
              Collector
                                                          RPCs

 Monitoring
                                  Farmer           API daemon
 (Metering)


              Collector

                              3
                                  Billing logic
                                                                10
RPCs
 subscribe_item
       Creates a subscription of a product
       Subscription status: ”creating”
 unsubscribe_item
       Updates the status of a subscription
       Subscription status: ”deleting”
 query_payment_types
 query_product_price
 query_usage_report
                                              11
RDBMS model
                                                 Created by...
 Regions          → region name
 Items            → resource name
 ItemTypes        → resource type name
                                                      Admin
 PaymentTypes → name, interval_unit,
                     interval_size, is_prepaid
 Products
     region, item, item_type, payment_type
     order_unit, order_size, price, currency
 Subscriptions → product, tenant, status              User
                     expires_at, resource_uuid
 Purchases        → subscription, quantity,           Collector
                     line_total                            12
Billing logic: Subscription states
                 Creation
                successful                            Unsubscribe
 creating                       verified

                         Item error


     Creation error
                                 error                     deleting
                                           Deletion
                                            error

                 Manually by admin


                                           Deletion successful
                             terminated
                                                                      13
Billing logic: Purchase creation
  For each non-deleted expired subscription:
      Status == ”creating”:
            Check if item finished creation(client)
            If product is prepaid:
                  Create purchase*
            Extend expires_at**
            Verify subscription
      Status == ”deleting”:
            Check if item finished deletion(client)
            If product is not prepaid:
                  Create purchase*
            Terminate subscription                    14
Billing logic: Purchase creation
  For each non-deleted expired subscription:
        Status == ”verified”:
                Check if item is valid(client)
                Create purchase*
                Extend expires_at**

  (*)Create purchase
        Insert purchase where
          line_total=quantity(from monitoring )*price/unit_size
  (**)Extend expires_at
        += dateutil.relativedelta(interval_unit=interval_size)
                                                                  15
Discussions
 Is this worth looking at?
 Any design problems?
 More requirements?




  https://github.com/lzyeval/talk-OSDS-2012
                                              16

Weitere ähnliche Inhalte

Ähnlich wie Dough: OpenStack Billing Project

Crash course in Kubernetes monitoring
Crash course in Kubernetes monitoringCrash course in Kubernetes monitoring
Crash course in Kubernetes monitoringRobert Munteanu
 
Meetup 12-12-2017 - Application Isolation on Kubernetes
Meetup 12-12-2017 - Application Isolation on KubernetesMeetup 12-12-2017 - Application Isolation on Kubernetes
Meetup 12-12-2017 - Application Isolation on Kubernetesdtoledo67
 
Google Cloud Platform monitoring with Zabbix
Google Cloud Platform monitoring with ZabbixGoogle Cloud Platform monitoring with Zabbix
Google Cloud Platform monitoring with ZabbixMax Kuzkin
 
Monitoring Your AWS Cloud Infrastructure
Monitoring Your AWS Cloud InfrastructureMonitoring Your AWS Cloud Infrastructure
Monitoring Your AWS Cloud InfrastructureNewvewm
 
Vmug it's all about the app
Vmug it's all about the appVmug it's all about the app
Vmug it's all about the appsubtitle
 
01 power center 8.6 basics
01 power center 8.6 basics01 power center 8.6 basics
01 power center 8.6 basicsuthayan87
 
Hadoop summit 2010, HONU
Hadoop summit 2010, HONUHadoop summit 2010, HONU
Hadoop summit 2010, HONUJerome Boulon
 
Help, My Kafka is Broken! (Emma Humber & Gantigmaa Selenge, IBM) Kafka Summit...
Help, My Kafka is Broken! (Emma Humber & Gantigmaa Selenge, IBM) Kafka Summit...Help, My Kafka is Broken! (Emma Humber & Gantigmaa Selenge, IBM) Kafka Summit...
Help, My Kafka is Broken! (Emma Humber & Gantigmaa Selenge, IBM) Kafka Summit...HostedbyConfluent
 
Venus-c: Using open source clouds in eScience
Venus-c: Using open source clouds in eScienceVenus-c: Using open source clouds in eScience
Venus-c: Using open source clouds in eScienceOW2
 
Porting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsPorting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsMarcelo Pinheiro
 
Ottimizzare le performance dell'API Server K8s come utilizzare cache e eventi...
Ottimizzare le performance dell'API Server K8s come utilizzare cache e eventi...Ottimizzare le performance dell'API Server K8s come utilizzare cache e eventi...
Ottimizzare le performance dell'API Server K8s come utilizzare cache e eventi...Luigi Fugaro
 
PlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин Владев
PlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин ВладевPlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин Владев
PlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин ВладевPlovDev Conference
 
Part2 DC Man Vision and Roadmap Finalcustext
Part2 DC Man Vision and Roadmap FinalcustextPart2 DC Man Vision and Roadmap Finalcustext
Part2 DC Man Vision and Roadmap FinalcustextMicrosoft Norge AS
 
Windows Azure for Developers - Service Management
Windows Azure for Developers - Service ManagementWindows Azure for Developers - Service Management
Windows Azure for Developers - Service ManagementMichael Collier
 
Cluster management with Kubernetes
Cluster management with KubernetesCluster management with Kubernetes
Cluster management with KubernetesSatnam Singh
 
Kubernetes intro public - kubernetes meetup 4-21-2015
Kubernetes intro   public - kubernetes meetup 4-21-2015Kubernetes intro   public - kubernetes meetup 4-21-2015
Kubernetes intro public - kubernetes meetup 4-21-2015Rohit Jnagal
 
Kubernetes intro public - kubernetes user group 4-21-2015
Kubernetes intro   public - kubernetes user group 4-21-2015Kubernetes intro   public - kubernetes user group 4-21-2015
Kubernetes intro public - kubernetes user group 4-21-2015reallavalamp
 
Choose Right Stream Storage: Amazon Kinesis Data Streams vs MSK
Choose Right Stream Storage: Amazon Kinesis Data Streams vs MSKChoose Right Stream Storage: Amazon Kinesis Data Streams vs MSK
Choose Right Stream Storage: Amazon Kinesis Data Streams vs MSKSungmin Kim
 

Ähnlich wie Dough: OpenStack Billing Project (20)

Crash course in Kubernetes monitoring
Crash course in Kubernetes monitoringCrash course in Kubernetes monitoring
Crash course in Kubernetes monitoring
 
Meetup 12-12-2017 - Application Isolation on Kubernetes
Meetup 12-12-2017 - Application Isolation on KubernetesMeetup 12-12-2017 - Application Isolation on Kubernetes
Meetup 12-12-2017 - Application Isolation on Kubernetes
 
Presentation
PresentationPresentation
Presentation
 
Google Cloud Platform monitoring with Zabbix
Google Cloud Platform monitoring with ZabbixGoogle Cloud Platform monitoring with Zabbix
Google Cloud Platform monitoring with Zabbix
 
Monitoring Your AWS Cloud Infrastructure
Monitoring Your AWS Cloud InfrastructureMonitoring Your AWS Cloud Infrastructure
Monitoring Your AWS Cloud Infrastructure
 
Vmug it's all about the app
Vmug it's all about the appVmug it's all about the app
Vmug it's all about the app
 
01 power center 8.6 basics
01 power center 8.6 basics01 power center 8.6 basics
01 power center 8.6 basics
 
Hadoop summit 2010, HONU
Hadoop summit 2010, HONUHadoop summit 2010, HONU
Hadoop summit 2010, HONU
 
Help, My Kafka is Broken! (Emma Humber & Gantigmaa Selenge, IBM) Kafka Summit...
Help, My Kafka is Broken! (Emma Humber & Gantigmaa Selenge, IBM) Kafka Summit...Help, My Kafka is Broken! (Emma Humber & Gantigmaa Selenge, IBM) Kafka Summit...
Help, My Kafka is Broken! (Emma Humber & Gantigmaa Selenge, IBM) Kafka Summit...
 
Monitoring and Log Management for
Monitoring and Log Management forMonitoring and Log Management for
Monitoring and Log Management for
 
Venus-c: Using open source clouds in eScience
Venus-c: Using open source clouds in eScienceVenus-c: Using open source clouds in eScience
Venus-c: Using open source clouds in eScience
 
Porting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsPorting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability Systems
 
Ottimizzare le performance dell'API Server K8s come utilizzare cache e eventi...
Ottimizzare le performance dell'API Server K8s come utilizzare cache e eventi...Ottimizzare le performance dell'API Server K8s come utilizzare cache e eventi...
Ottimizzare le performance dell'API Server K8s come utilizzare cache e eventi...
 
PlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин Владев
PlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин ВладевPlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин Владев
PlovDev 2016: Оркестрация на контейнери с Kubernetes - Мартин Владев
 
Part2 DC Man Vision and Roadmap Finalcustext
Part2 DC Man Vision and Roadmap FinalcustextPart2 DC Man Vision and Roadmap Finalcustext
Part2 DC Man Vision and Roadmap Finalcustext
 
Windows Azure for Developers - Service Management
Windows Azure for Developers - Service ManagementWindows Azure for Developers - Service Management
Windows Azure for Developers - Service Management
 
Cluster management with Kubernetes
Cluster management with KubernetesCluster management with Kubernetes
Cluster management with Kubernetes
 
Kubernetes intro public - kubernetes meetup 4-21-2015
Kubernetes intro   public - kubernetes meetup 4-21-2015Kubernetes intro   public - kubernetes meetup 4-21-2015
Kubernetes intro public - kubernetes meetup 4-21-2015
 
Kubernetes intro public - kubernetes user group 4-21-2015
Kubernetes intro   public - kubernetes user group 4-21-2015Kubernetes intro   public - kubernetes user group 4-21-2015
Kubernetes intro public - kubernetes user group 4-21-2015
 
Choose Right Stream Storage: Amazon Kinesis Data Streams vs MSK
Choose Right Stream Storage: Amazon Kinesis Data Streams vs MSKChoose Right Stream Storage: Amazon Kinesis Data Streams vs MSK
Choose Right Stream Storage: Amazon Kinesis Data Streams vs MSK
 

Kürzlich hochgeladen

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 

Kürzlich hochgeladen (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 

Dough: OpenStack Billing Project

  • 1. Dough: OpenStack Billing Project Folsom Design Summit 2012-04-16 Luo, Zhongyue lzyeval@gmail.com
  • 2. TODO Intro Design concepts Architecture Example RPCs RDBMS model Billing logic Discussions 2
  • 3. Intro What to expect from Dough Keep track of billing info to charge tenants Flexible customization of payment policies How much/often to charge for resource unit Handles prepaid or pay-as-you-go What Dough does not do Keep track of tenant’s resource usage Needs a monitoring/metering system Deduct money from account DIY using database as a queue 3
  • 4. Design concepts Highly configurable Billing frequency, unit of measure Asynchronous All events are asynchronous Independent Pluggable clients to access other projects Scalability Handle billing of many users Nova conventions Message protocol 4
  • 5. RPC Architecture Database Client Compute Network RDBMS Dashboard Storage Monitoring Billing (Metering) NoSQL 5
  • 6. RPC Architecture Database Client Compute Network RDBMS Dashboard Storage Collector Monitoring Farmer API daemon (Metering) Dispatch jobs Subscribe or Collector unsubscribe products / Query info Check status / Retrieve usage / Create purchases 6
  • 7. Example: creating an instance Compute Network RDBMS Dashboard Storage 2 Create subscription record Collector {'method': 'subscribe_item', 1 'args': { Monitoring '62a8a396d9f44ef4a655ec1d7bd3801b', 'user_id': Farmer API daemon (Metering) '864bbc5d23ea47799ae2a702927920e9', 'tenant_id': 'region': 'deafult', 'item': 'instance', 'item_type': 'm1.tiny', Collector 'payment_type': 'hourly', 'resource_uuid': 'uuidofinstance', 'resource_name': 'nameofinstance', }} 7
  • 8. Example: creating an instance Compute Network RDBMS Dashboard Storage Retrieve expired subscriptions 2 Collector 1 Request for Monitoring charge Farmer API daemon (Metering) Dispatch jobs Collector Check status / Retrieve usage / Create purchases 8
  • 9. Example: creating an instance Compute Network RDBMS Dashboard Check instance Storage status 5 3 Create purchase record / Update subscription Collector status and expiring 4 datetime Retrieve instance Monitoring usage quantity Farmer API daemon (Metering) Collector 9
  • 10. Example: creating an instance Compute Network RDBMS 2 Dashboard Storage RDBMS model 1 Collector RPCs Monitoring Farmer API daemon (Metering) Collector 3 Billing logic 10
  • 11. RPCs subscribe_item Creates a subscription of a product Subscription status: ”creating” unsubscribe_item Updates the status of a subscription Subscription status: ”deleting” query_payment_types query_product_price query_usage_report 11
  • 12. RDBMS model Created by... Regions → region name Items → resource name ItemTypes → resource type name Admin PaymentTypes → name, interval_unit, interval_size, is_prepaid Products region, item, item_type, payment_type order_unit, order_size, price, currency Subscriptions → product, tenant, status User expires_at, resource_uuid Purchases → subscription, quantity, Collector line_total 12
  • 13. Billing logic: Subscription states Creation successful Unsubscribe creating verified Item error Creation error error deleting Deletion error Manually by admin Deletion successful terminated 13
  • 14. Billing logic: Purchase creation For each non-deleted expired subscription: Status == ”creating”: Check if item finished creation(client) If product is prepaid: Create purchase* Extend expires_at** Verify subscription Status == ”deleting”: Check if item finished deletion(client) If product is not prepaid: Create purchase* Terminate subscription 14
  • 15. Billing logic: Purchase creation For each non-deleted expired subscription: Status == ”verified”: Check if item is valid(client) Create purchase* Extend expires_at** (*)Create purchase Insert purchase where line_total=quantity(from monitoring )*price/unit_size (**)Extend expires_at += dateutil.relativedelta(interval_unit=interval_size) 15
  • 16. Discussions Is this worth looking at? Any design problems? More requirements? https://github.com/lzyeval/talk-OSDS-2012 16