Microsoft Azure: Enterprise Application Development
上QQ阅读APP看书,第一时间看更新

How are Azure costs calculated?

Microsoft Azure has two methods for calculating the monthly service charges – consumption pricing or commitment (subscription) pricing. Because Windows Azure, SQL Azure, and AppFabric are three independent services, each is priced separately and with its own rates. The charges may seem like nickel-and-diming as they are broken out by the different features of each service, but having the charges broken out allows us to utilize and pay for only what we use.

In addition to production-scale pricing plans, Microsoft also offers limited-use plans suitable for development and conference room pilot efforts. For the most current rates and offers, visit http://www.microsoft.com/windowsazure/pricing/. We're not going to list the base rates here, as they are likely to change over time. Instead, we'll look at how the charges are applied to each service in the next section.

Cloud services such as Amazon EC2 bill in a manner close to what Microsoft does, yet offer a little more flexibility with types of VMs (they offer both UNIX/Linux pricing and Windows pricing, which varies based on the type of hosting needed). They also offer commitment plans, but theirs is called "Reserve Instances". This is where a flat fee is paid up front, based on a time commitment, but a reduced usage fee is charged on a monthly basis.

Calculating Windows Azure pricing

Windows Azure charges are calculated based on utilization of four resources – compute time, storage, storage transactions, and data transfers.

Compute time is billed as service hours or the amount of time an application is deployed. When calculating compute time charges, keep in mind each instance of an application runs in its own VM. If we have two instances of an application running simultaneously for an hour, that is calculated as two service hours of compute time.

Storage is billed as the daily average gigabytes consumed in the storage service (tables and blobs). To minimize costs, we want to minimize the size of resources we store for a long duration. If we have a 30 GB blob in storage for a month, our average daily consumption would be 30 GB. If we were to upload a 30 GB blob for a single day, our average consumption would be 1 GB.

Storage transactions are the CRUD operations we perform against tables and blobs. Every create, read, update, and delete operation we perform against our data is a transaction.

Data transfers are billed as the total number of gigabytes uploaded or downloaded via the Internet during a month. Any communication within sub-region (same data center) is not charged. This is helpful for HTTP calls between different services, and also emphasizes the correct usage of Affinity Groups (discussed in Chapter 15, Deploying to Windows Azure) to keep dependent services together.

The other transactions are application requests, and pass through the Queue Storage. At the time of writing, there was no specific charge for application requests.

Calculating SQL Azure pricing

SQL Azure is sold in two editions – Web and Business – plus data transfers. SQL Azure databases are billed monthly but calculated per diem, and we are only charged for the days we have the database.

Both editions are self managed and support Visual Studio, SQL Server Management Studio, and SQL Server Integration Services. The Web Edition has a capacity of up to 5 GB, while the Business Edition has a capacity of up to 50 GB and supports advanced features such as auto-partition and upcoming plans for common language runtime (CLR) integration.

As with Windows Azure, data transfers are calculated as the total number of gigabytes uploaded or downloaded via the Internet during a billing month.

Calculating AppFabric pricing

AppFabric charges are billed by Access Control transactions, Service Bus connections, and data transfer.

Each claim of identity made to the Access Control service is a transaction. Charges are calculated based on the actual number of transactions during a billing month.

Service Bus connections are sold as individual pay-as-you-go connections, or can be purchased in flat-rate packs. Individual connections are charged based on the maximum number of connections utilized during a day. Connection packs are calculated daily, based on the pro-rata number of connections. If we buy a 30-pack of connections at the beginning of a month and then buy another 30-pack one week in, we are charged for 7 connection days for the first week, and then 14 connection days thereafter.

As with Windows Azure, data transfers are calculated as the total number of gigabytes uploaded or downloaded via the Internet during a billing month.