none
How can I bill users of my Azure service?

    שאלה

  • I have a website and some web services I want to host on Azure. The website and the web services would be used by users signed up for my service. The users will be authenticated with Azure Access Control Service. But how can I detect resource usage so I can bill them.

    Can anyone point me to any articles that tell me how to detect CPU, data transfer and data storage stats so I can bill my users?

    How do other people bill their users under Azure?

    Thanks, Dave

    • נערך על-ידי CodeSlinger יום רביעי 25 ינואר 2012 05:52
    יום רביעי 25 ינואר 2012 05:33

תשובות

  • Hi,

    Windows Azure currently doesn’t have an API that helps you to bill your customers. It is easy to detect the overall resource usage (use performance counter), but it is very difficult to detect the resource usage for each request. You can find a sample on how to detect instant CPU usage for a process on http://msdn.microsoft.com/en-us/library/system.diagnostics.process.totalprocessortime.aspx. So you may want to create a new process for each request, and continuously monitor the process’s CPU usage. But of course this will impact on performance.

    You may want to change the way you bill your customer. For example, Windows Azure doesn’t monitor how much CPU resource your VM instance uses. You get a maximum virtual CPU (depending on the VM size), and charge as the same amount no matter if you use 100% of the virtual CPU, or simply leave it idle. You can take the same approach in your solution. This applies to other resources as well.

     

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    • הוצע כתשובה על-ידי Vitor Tomaz יום רביעי 25 ינואר 2012 09:57
    • סומן כתשובה על-ידי CodeSlinger יום חמישי 26 ינואר 2012 04:38
    יום רביעי 25 ינואר 2012 07:45

כל התגובות

  • Hi,

    Windows Azure currently doesn’t have an API that helps you to bill your customers. It is easy to detect the overall resource usage (use performance counter), but it is very difficult to detect the resource usage for each request. You can find a sample on how to detect instant CPU usage for a process on http://msdn.microsoft.com/en-us/library/system.diagnostics.process.totalprocessortime.aspx. So you may want to create a new process for each request, and continuously monitor the process’s CPU usage. But of course this will impact on performance.

    You may want to change the way you bill your customer. For example, Windows Azure doesn’t monitor how much CPU resource your VM instance uses. You get a maximum virtual CPU (depending on the VM size), and charge as the same amount no matter if you use 100% of the virtual CPU, or simply leave it idle. You can take the same approach in your solution. This applies to other resources as well.

     

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    • הוצע כתשובה על-ידי Vitor Tomaz יום רביעי 25 ינואר 2012 09:57
    • סומן כתשובה על-ידי CodeSlinger יום חמישי 26 ינואר 2012 04:38
    יום רביעי 25 ינואר 2012 07:45
  • Pretty much what I expected I guess but it would be nice to have some API help for costs and billing. I am actually quite familiar with WMI and Perf Counters. Are there perf counters specific to Azure? Such counters would be a useful addition and if already there, an article on them would be nice. Thanks, Dave
    יום חמישי 26 ינואר 2012 04:38
  • Hi,

    Windows Azure doesn’t provide any specific performance counters. But you can use existing ones such as ASP.NET/WCF performance counters. However even with performance counters, it is very difficult to find which user uses how much resource.

     

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    יום חמישי 26 ינואר 2012 05:55
  • In my experience, it's extremely rare for metrics like CPU usage to be useful in billing for SaaS. Of course, you could have one of those rare scenarios, but allow me to push back a little.

    1. There's a practical problem: if there are 100 concurrent users on your website, how much CPU usage can be attributed to each of them? In fact, your usage may not simply be the sum of all their activity... it could be that 100 simultaneous requests takes more (or less) CPU usage than 100 requests one at a time.
    2. Customers hate this. CPU usage isn't a metric your customer understands, and it's not something he feels like he can control. He knows that he's stored ten documents in your system or sent a hundred messages, or whatever it is your service does.

    I'm picking on CPU usage, because I think it's the most difficult to use in billing. Data transfer is actually more reasonable, particularly if the amount of data transfer maps to something the user understands (e.g., how big the file was and how many users he sent it to).

    My advice is generally to start with what your customers understand. (What are the activities and metrics in your app that they have control and understanding of?) Then map that back to your costs, and invent a pricing model that ensures you make money. But your cost model is rarely a good pricing model by itself.

    יום ראשון 04 מרץ 2012 21:52