Economics of Cloud Development

While learning to build applications with Azure, developers and architects please learn economic of developing and deploying applications on windows Azure and SQL Azure. I see that developers and architects need to be connected to cost. Your manager would be interested in the following costs, but there is more you can help him.
• Number of hours you’ve reserved a virtual machine (VM)
• Number of CPUs in a VM
• Bandwidth, measured per GB in / out
• Amount of GB storage used
• Number of transactions on storage
• Database size on SQL Azure
• Number of connections on Windows Azure platform AppFabric

Effectively if the resources are used well, we save cost. If the resources are not used optimally, then we lose money. How can one take responsibility during application development to optimize Azure costs for deployment?
Azure Compute:
1. Extra Small Windows Azure instance is for the purpose of development and testing.
2. Windows Azure compute hours are charged only for when your application is deployed, Partial compute hours are billed as full hours.
3. Large allocation of shared resource helps in higher I/O performance.
4. License for the Windows Server 2008 R2 is covered through the Windows Azure VM Role licensing
5. You can’t change VM Size once you’re running your application
6. Hoe many number of hours of the application translates business?. When one deploys application, performs some operation and forgets to turn them off after use, one is charged for the unused compute power. Please un-deploy the application as soon as possible to stop paying for any inactive applications
7.How to decide the number of web roles and Worker Roles?. One can use one web role and one worker role. When we scale, we need to identify whether we need to decide whether we need to scale as two web role and two worker roles or two web roles and one worker role.

Windows Storage:

If the web role and storage are located in the same region (Both in “North America” for example), there would be no bandwidth bill for communication between Web role and storage.
o Keep Azure services coupled within the same Azure region.
o One can make use of CDN for cost-reduction measure, as it gets cached locally
o Keep in mind that cache expiration time can create challenges

People store session data in Azure blobs and table storage and the storage and transaction of writing and reading impacts the cost of deployment. Hence please separate the structures and data that needs to be placed in the session . Please also look at the article Understanding Windows Azure Storage Billing – Bandwidth, Transactions, and Capacity , Windows Azure Storage Abstractions and their Scalability Targets, How to get most out of Windows Azure Tables

Transactions :Every operation on a storage account is a transaction. Be smart of the operations that count as transaction.When performing an operation such as blob storage, for example, you would first check if the blob container exists. If not, you would have to create it and then store a blob. That’s at least two, possibly three, transactions. The same counts for hosting static content on blob storage. If you have n images to display on page, you can run up to 2n transactions or more. One can reduce to n +1 transaction just by removing the check whether the blob container exists or not to once at startup.

Diagnostics

  • Writing diagnostics every minute increases storage transaction and extra costs and setting a long time interval to write can make the diagnostics data always old by the time interval.
  • You need to own the clearing of the old diagnostics data, else you would billed for the storage that does not provide much value.
  • SQL Azure

  • Please be aware that it can be more cost-effective to distribute your data across different SQL Azure databases, rather than having one large database
  • Please check whether Indexes and tables can consume a lot of database storage capacity. Some indexes may consume 0.5 percent of a database and make sure whether they provide needed performance gain to justify the cost of index. Please check this article The real Cost of Indexes
  • Do you make use of object relational mappers instead of stored procedures to perform a data oriented operations in application logic? If yes, performing data calculations in application might require extra Web Role or Worker Role instance. By performing the same in SQL Azure, you can save some processing of role instances and SQL Azure is not metered on CPU usage and you get free CPU cycles in your database.