Share via


6 – Evaluating Cloud Hosting Costs

patterns & practices Developer Center

On this page: Download:
The Premise | Goals and Requirements | Detailed Costing Estimates | Bandwidth Cost Estimate for aExpense | Compute Estimate for aExpense | Receipt Image Storage Estimate for aExpense | Azure SQL Database Storage Requirements Estimate | Total Cost Approximation | Variations | Costing the IaaS Hosting Approach - Combined IaaS and PaaS Approach | Costing for Peak and Reduced Demand | Costing for Azure Table Storage | More Information Download code samples
Download PDF

This chapter presents a basic cost model for running the aExpense application in the cloud. It makes some assumptions about the usage of the application and uses the current pricing information for Microsoft Azure services to estimate annual operational costs.

The Premise

The aExpense application is a typical business application. Adatum selected this as a pilot cloud migration project because the application has features that are common to many of Adatum's other business applications, and Adatum hopes that any lessons learned from the project can be applied elsewhere.

The original on-premises version of the aExpense application is deployed in Adatum’s data center, with components installed across several different servers. The web application is hosted on a Windows Server computer that it shares with another application. aExpense also shares a SQL Server database installation with several other applications, but has its own dedicated drive array for storing scanned expense receipts.

The current cloud-based deployment of aExpense, using Cloud Services web and worker roles, is sized for average use, not peak use, so the application can be slow and unresponsive during the busy two days at month-end when the majority of users submit their business expense claims.

Goals and Requirements

It is difficult for Adatum to determine accurately how much it costs to run the original on-premises version of aExpense. The application uses several different servers, shares an installation of SQL Server with several other business applications, and is backed up as part of the overall backup strategy in the data center.

It is very difficult to estimate the operational costs of an existing on-premises application.

Although Adatum cannot determine the existing running costs of the application, Adatum wants to estimate how much it will cost to run in the cloud now that the developers have completed the migration steps described in the previous chapters of this guide. One of the specific goals of the pilot project is to discover how accurately it can predict running costs for cloud based applications.

A second goal is to estimate what cost savings might be possible by configuring the application in different ways, or by taking advantage of other Azure services. Adatum will then be able to assign a cost to a particular configuration and level of service, which will make it much easier to perform a cost-benefit analysis on the application. A specific example of this in the aExpense application is to estimate how much it will cost to deploy additional instances to meet peak demand during the busy month-end period.

Ff803372.note(en-us,PandP.10).gifBharath Says:
Bharath
                You can manage the cost of a cloud-based application by modifying its behavior through configuration changes.</td>

Overall, Adatum would like to see greater transparency in managing the costs of its suite of business applications.

Detailed Costing Estimates

The first step Adatum took was to analyze what it will be billed every month for the cloud-based version of aExpense. Figure 1 shows the services that Microsoft will bill Adatum for each month for the aExpense application.

Figure 1 - Billable services

Figure 1

Billable services

Ff803372.note(en-us,PandP.10).gifBharath Says:
Bharath
                The simple cost model in this chapter does not include any cost estimates for testing environments. Adatum should review its cost estimates when the aExpense application design is complete and when Adatum completes stress-testing the application. It also ignores the cost of connectivity to on-premises Active Directory or a database through Azure Connect or Virtual Networks as this is only applicable to some of the original IaaS scenarios. </td>

The following table summarizes the current rates in U.S. dollars for these services. The prices listed here are accurate for the U.S. market as of July 2012. However, for up-to-date pricing information see the Azure Pricing Details. You can find the pricing for other regions at the same address.

Service

Description

Cost

1. In/Out Bandwidth

This is the web traffic between the user's browser and the aExpense site.

Inbound: Free

Outbound (North America and Europe): $0.12 per GB


2. Compute

Virtual machines, for the time each one is running.

Small size virtual machine: $0.115 per hour

Medium size virtual machine: $0.23 per hour

Cloud Services roles, for the time each role is running.

Small size role: $0.12 per hour

Medium size role: $0.24 per hour

3. Azure Storage

In aExpense this will be used to store scanned receipt images. Later, it will also store profile data when Adatum removes the requirement for a relational database.

Up to 1 TB with geo-replication: $0.125 per GB

Up to 1 TB without geo-replication: $0.09 per GB

4. Transactions

Each interaction with the storage system is billed.

$0.01 per 100,000 transactions

5. Database

SQL Server hosted in a VM

Small or medium size VM: $0.55 per hour

Azure SQL Database, cost per month.

Up to 100 MB: $4.995

Up to 1 GB: $9.99

Up to 10 GB: First GB $9.99, each additional GB $3.996

Up to 50 GB: First 10 GB $45.954, each additional GB $1.998

Up to 150 GB: First 50 GB $125.874, each additional GB $0.999

6. Connectivity

Virtual Networks and Connect

$0.05 per hour per connection

Ff803372.note(en-us,PandP.10).gifBharath Says:
Bharath
                After you have estimated your usage of the billable services by your application, you can use the Azure <a href="https://www.windowsazure.com/en-us/pricing/calculator/">pricing calculator</a><a href="https://www.windowsazure.com/en-us/pricing/calculator/" />to quickly estimate your monthly costs.</td>

Bandwidth Cost Estimate for aExpense

The aExpense application is not bandwidth intensive. Assuming that all scanned receipt images will be transferred back and forth to the application twice, and taking into account the web traffic for the application, Adatum estimated that 9.5 GB of data would move each way every month.

Data transfer

GB/month

$/GB/month

Total/month

Inbound

9.5 GB

Currently free

$0.00

Outbound

9.5 GB

$0.12

$1.14



Total/year

$13.68

The Hands-on Labs that are available for this guide include an exercise that demonstrates how Adatum estimated the bandwidth usage and other runtime parameters for the aExpense application.

Compute Estimate for aExpense

Adatum's assumption here is that the application will run 24 hours a day, 365 days a year. The current version of the application uses a single instance of the Cloud Services web role and worker role.

Hours (one year)

$/hour

Number of role instances

Total/year

8760

$0.12

2

$2,102.40

Receipt Image Storage Estimate for aExpense

The aExpense application stores uploaded receipt images in Azure blob storage. Based on an analysis of existing usage, on average 65 percent of 15,000 Adatum employees submit ten business expense items per month. Each scanned receipt averages 15 KB in size, and to meet regulatory requirements, the application must store seven years of history. This gives an estimated storage requirement for the application of 120 GB.

Storage and transactions

Amount

Cost per month

Total/month

Total GB stored

120 GB

$0.125/ GB

$15.14

Storage transactions per month

700,000

$0.01/100 K

$0.07



Total/year

$182.52

Azure SQL Database Storage Requirements Estimate

The aExpense application stores expense data (other than the receipt images) in a Azure SQL Database. Adatum estimates that each business expense record in the database will require 2 KB of storage. So based on the analysis of existing usage (on average 65 percent of 15,000 Adatum employees submit ten business expense items per month) and the requirement to store data for seven years, this gives an estimated storage requirement of 16 GB. However, the actual measured database usage is likely to be greater than this due to the nature of the way that a database stores the data until it is compacted, and so Adatum will base the estimate on a 20 GB database.

SQL storage size

$/month

Total/year

20 GB

$65.93

$791.16

Total Cost Approximation

This means that the costs as an approximate proportion of the total cost of running the application (a total of $3,089.76 per year) will be as follows:

  • Compute (web and worker roles): $2,102.40 (~ 68 %)
  • Azure SQL Database: $791.16 (~ 26 %)
  • Azure storage: $182.52 (~ 6 %)
  • Bandwidth: $13.68 (~ 0.4 %)

Variations

Having established the approximate costs of running the aExpense application in its current form, Adatum wants to confirm that its choice of a PaaS approach was justified, and also consider some variations to discover the cost for better meeting peak demand and to see if additional cost savings were possible.

Costing the IaaS Hosting Approach

In the first step of the migration, Adatum hosted both the application and the SQL Server database in Azure Virtual Machines. To accommodate the requirements of SQL Server, with a view to using it with other applications in the future, Adatum chose to use a medium sized virtual machine for the database, and a small sized virtual machine for the application.

Adatum also chose to use the Standard edition of SQL Server rather than the Web edition in order to accommodate future requirements. The virtual machine that hosts SQL Server also needs a data disk to store the SQL Server database. The estimated costs of this configuration are shown in the following table.

Service

$/month

Total/year

Small virtual machine

$83.90

$1,006.80

Medium virtual machine

$167.81

$2,013.72

Data Disk (20 GB)

$2.50

$30.00

SQL Server

$401.28

$4,815.36

Bandwidth usage

$13.68

$164.16

Virtual network

$36.48

$437.76

Total


$8,467.80

From this it’s clear that the PaaS approach using Cloud Services and Azure SQL Database is considerably less expensive than the original migration step that used the IaaS approach with virtual machines. However, Adatum must consider that the IaaS approach required only very minimal changes to the application code, and that the use of a hosted SQL Server is not directly equivalent to using Azure SQL Database. For example, if Adatum deploys additional applications in the future they can share the hosted SQL Server without incurring additional cost, whereas additional costs will be incurred when other applications that use Azure SQL Database are deployed.

Ff803372.note(en-us,PandP.10).gifBharath Says:
Bharath
                Adatum chose to use the preinstalled SQL Server Standard edition that is available in the Azure Management Portal with a view to sharing the database with other applications in the future. However, if it chose to use the Web edition, the monthly cost for SQL Server falls from $401.28 to $32.83, and the annual cost falls to $393.98. The total annual cost of this IaaS approach now becomes $4,046.42.</td>

It’s also possible for Adatum to install SQL Server on the virtual machine using a licensed copy they own instead of paying to rent SQL Server, which could considerably reduce the overall costs; but Adatum must also consider the cost of maintaining and upgrading the operating systems and database software for the IaaS approach.

However, overall, the saving of almost $5,000.00 per year justifies the decision Adatum made to move from IaaS to PaaS for the aExpense application, even when considering the development effort required to refactor the application and adapt it to run in Cloud Services web and worker roles. Adatum will review the situation when it decides to move other applications to the cloud.

Combined IaaS and PaaS Approach

If Adatum actually requires a virtual machine because the application demands some special operating system configuration, access to non-standard installed services, or cannot be refactored into web and worker roles, the data could be still be stored in Azure SQL Database to remove the requirement for a hosted SQL Server. In this case the running costs per instance would be similar to that for the PaaS approach using Cloud Services.

Service

$/month

Total/year

Small virtual machine

$83.90

$1,006.80

Azure SQL Database

$65.93

$791.16

Bandwidth usage

$13.68

$164.16


Total/year

$1,962.12

This configuration is based on a single virtual machine, which would run the background tasks asynchronously within the application instead of using a separate worker role. Adatum could implement a virtual network in the cloud and load balance two virtual machine instances to provide additional capacity, in which case the overall cost would be almost the same as using a Cloud Services web and worker role.

Adatum could also use a virtual machine with a separate Cloud Services worker role to perform the background processing tasks, and communicate with the worker role from the virtual machine using Azure storage queues. This configuration will also cost almost the same as when using Cloud Services web and worker roles.

Ff803372.note(en-us,PandP.10).gifBharath Says:
Bharath
                The hourly compute costs for virtual machines, Cloud Services roles, and Azure Web Sites Reserved instances (when all are generally available at the end of the discounted trial period) are almost the same, and so the decision on which to choose should be based on application requirements rather than focusing on just the compute cost.   </td>

Costing for Peak and Reduced Demand

One of the issues raised by users of the existing aExpense application is poor performance of the application during the two days at the end of the month when the application is most heavily used. To address this issue, Adatum then looked at the cost of doubling the compute capacity of the application for two days a month by adding an extra two web roles to handle the UI load.

Ff803372.note(en-us,PandP.10).gifPoe Says:
Poe
                A common complaint about the existing version of aExpense is its poor performance at the time when most people want to use it.</td>

Additional hours/month

Additional hours/year

$/hour

Role instances

$/year

48

576

$0.12

2

$138.24

This indicates that the additional cost to better meet peak demand is low, and yet it will provide a huge benefit for users. Adatum can use scripts executed by on-premises administrators to change the number of running instances, perhaps through a scheduled task, or implement an auto scaling solution such as the Enterprise Library Autoscaling Application Block.

Note

The Autoscaling Application Block is part of Enterprise Library, developed by the p&p team at Microsoft. For more information see “The Autoscaling Application Block” and Chapter 6, “Maximizing Scalability, Availability, and Performance in the Orders Application,” in the p&p guide “Building Hybrid Applications in the Cloud on Microsoft Azure.

Adatum also examined the cost implications of running the application for only twelve hours each day for only six days each week, except at the month end when the majority of users access it. The following table shows the compute costs for the web and worker roles.

Compute

Number of role instances

Hours/day

Days/year

$/hour

$/year

Standard

2

12

313

$0.12

$901.44

Month End

2

12

24

$0.12

$69.12





Total/year

$970.56

This is less than half of the compute cost of running the application 24 hours a day for 365 days per year, giving a saving of around $1,100 per year. Adatum could use the same auto scaling approach described earlier to achieve this pattern of availability.

Ff803372.note(en-us,PandP.10).gifMarkus Says:
Markus
                It's easy to redirect users to an "Application is not currently available" page by using DNS.</td>

Costing for Azure Table Storage

Adatum is also interested in comparing the cost of storing the business expense data in Azure table storage instead of in Azure SQL Database. The previous calculations in this chapter show that the storage requirement for seven years of data (excluding receipt images, which are stored in Azure blob storage) is around 16 GB. The following table also assumes that each new business expense item is accessed five times during the month.

Storage and transactions

Amount

Cost

Total/Month

GB stored

16 GB

$0.125/ GB

$2.00

Storage transactions per month

220,000

$0.01/10 K

$0.02



Total/year

$24.30

As you can see, this is a fraction of the cost of using Azure SQL Database ($791.16 per year). The estimated total running cost for the year would be $2,322.90 using table storage, offering the possibility of reducing the overall running costs by almost a quarter.

Adapting the application to use Azure table storage instead of a relational database will require development and testing effort. However, as long as table storage can provide the performance and scalability required, the saving makes this worthwhile for Adatum’s scenario. In the following chapter you will see how Adatum explored adapting the aExpense application to use table storage, and then implemented the change.

More Information

Use the Azure Pricing calculator to estimate runtime costs.

You can find information that will help you to understand your Azure bill at
Pricing Details.

For information about auto scaling Azure application roles, see “The Autoscaling Application Block” and Chapter 6, “Maximizing Scalability, Availability, and Performance in the Orders Application,” in the p&p guide “Building Hybrid Applications in the Cloud on Microsoft Azure.”

Next Topic | Previous Topic | Home | Community