I am glad to share that “a cloudy place” blog is finally up here: http://acloudyplace.com
A centralized blog focused on cloud technology exclusively for developers. If you’ve heard about SQL Server Central, it’s somewhat similar but focus on cloud computing. You can find topics such as general cloud info, Amazon Web Services, Windows Azure, and so many more.
“a cloudy place” is owned and managed by Red Gate, a software company specializing in SQL, DBA, .NET, and Oracle development tools based in Cambridge, UK.
Aha! I am invited to become a contributor on “a cloudy place”. In a first few post, you will see me write about some generic cloud concept. Of course, I’ll discuss more about Windows Azure later on.
You can find my articles here.
Happy “cloudy” reading on “a cloudy place”!
There’re several announcements that are made by Windows Azure team yesterday. Here’re the summary:
The site is more simplified now, the look-and-feel looks clean and comfortable.
http://www.windowsazure.com/en-us/home/tour/database/
*Price will be capped to $ 499.95 per DB per month.
http://social.technet.microsoft.com/wiki/contents/articles/2281.aspx
For more detail, please refer to the following links:
I was quite surprise when seeing the Storage Transaction bills 2000% more than Storage Capacity, and it’s about 40% of my total bill. Wow… How can that be?
Isn’t that the storage transaction just costs $ 0.01 per 10,000 transactions, but why it’s become so expensive? In fact, this is the component that many people ignore when doing the running cost estimation for Windows Azure project.
This leads me to explore and understand Window Azure Storage Transaction more deeply. This article will unveil this unforeseen cost, explain thoroughly how the Storage Transaction costs charge, followed by scenarios that potentially cause the high cost of Storage Transaction. Eventually, I’ll provide some tips to avoid the costly charge of Storage Transaction.
Before getting into the detail, let’s refresh our mind to understanding how Windows Azure Storage costs in overview.
Brad Calder from Windows Azure Storage Team did a great post on explaining how the billing looks like for Windows Azure Storage including the Capacity, Bandwidth, and Transaction.
In summary, here’re how it costs (as per Nov 2011). Keep in mind that the cost may change (although not very frequent, but who knows)
1. Storage Capacity = $0.14 per GB stored per month, based on the daily average
2. Storage Transactions = $0.01 per 10,000 transactions
3. Data Transfer (Bandwidth)
Please always refer to the following for latest pricing:
Many people argue that Windows Azure Storage is much more cost-effective than SQL Azure.
Well, that’s true in “most of the time”, but not “all the time”.
Now, let’s forget the Storage Capacity and Bandwidth first, let’s talk about Storage Transaction now. It’s considered 1 transaction whenever you “touch” any component of Windows Azure Storage.
Here’re some examples of transactions that extracted from “Understanding Windows Azure Storage Billings” post.
- A single GetBlob request to the blob service = 1 transaction
- PutBlob with 1 request to the blob service = 1 transaction
- Large blob upload that results in 100 requests via PutBlock, and then 1 PutBlockList for commit = 101 transactions
- Listing through a lot of blobs using 5 requests total (due to 4 continuation markers) = 5 transactions
- Table single entity AddObject request = 1 transaction
- Table Save Changes (without SaveChangesOptions.Batch) with 100 entities = 100 transactions
- Table Save Changes (with SaveChangesOptions.Batch) with 100 entities = 1 transaction
- Table Query specifying an exact PartitionKey and RowKey match (getting a single entity) = 1 transaction
- Table query doing a single storage request to return 500 entities (with no continuation tokens encountered) = 1 transaction
- Table query resulting in 5 requests to table storage (due to 4 continuation tokens) = 5 transactions
- Queue put message = 1 transaction
- Queue get single message = 1 transaction
- Queue get message on empty queue = 1 transaction
- Queue batch get of 32 messages = 1 transaction
- Queue delete message = 1 transaction
Having done understanding how the storage transaction charge, considering the following scenarios:
An application will organize the blobs in different container per each users. It also allows the users to check size of each container. For that, a function is created to loop through entire files inside the container and return the size in decimal. Now, this functionality is exposed at UI screen. An admin can typically call this function a few times a day.
*Update: Actually, we can use ListBlobs method to get the length / size of files inside the container. But anyway, just forget it at the moment. (Thanks to Jai Haridas for this comment)
Assuming the following figures are used for illustration:
How much it costs for Storage Transaction per month?
Remember: a single GetBlob request is considered 1 transaction!
1,000 users X 10,000 files X 5 times query X 30 days = 1,500,000,000 transaction
$ 0.01 per 10,000 transactions X 1,500,000,000 transactions = $ 1,500 per month
Well, that’s not cheap at all.
With limiting the admin to just only view once a day, what will be the monthly cost looks like:
1,000 users X 10,000 files X 1 times query X 30 days = 300,000,000 transaction
$ 0.01 per 10,000 transactions X 300,000,000 transactions = $ 300 per month
Well, I think that’s fair enough!
An application enables user to upload some document for processing. The uploaded document will be processed asynchronously at the backend. When processing is done, the user will get notified by email.
Technically, it uses Queue to store and centralize all tasks. Two instances of web roles to take the input and store task as message inside the Queue. On the other hand, 5 instances of Worker Role are provisioned, they will constantly pinging Queue Storage to check if there’s new message to be processed.
The following diagrams illustrates how the architecture may look like.
*icons by http://azuredesignpatterns.com/, David Pallman
Assuming the following figures:
public override void Run() { while (true) { CloudQueueMessage msg = queue.GetMessage(); if (msg != null) { // process the message } } }
How much it costs for Storage Transaction per month?
Remember: a GetMessage on Queue function (regardless empty or filled) is considered 1 transaction
200 req X 60 sec X 60 min X 24 hours X 30 days X 5 instances = 2,592,000,000 transactions
$ 0.01 per 10,000 transactions X 2,592,000,000 transactions = $ 2,592 per month
Unless there’s requirement to meet certain number of target, otherwise consider to put some Sleep to especially when you’ve got empty message result for several times.
Assuming we put Thread.Sleep(100) = 0.1 second, which means for every second there will be 10 time polling to the queue to check if there’s message.
public override void Run() { while (true) { CloudQueueMessage msg = queue.GetMessage(); if (msg != null) { // process the message } else Thread.Sleep(100); } }
With that, how much do you think it will cost for a month?
10 req X 60 sec X 60 min X 24 hours X 30 days X 5 instances = 129,600,000 transactions$ 0.01 per 10,000 transactions X 129,600,000 transactions = $ 129.6 per month
Well, that’s fair enough.
When your 5 instances of Worker Role have fetched so many times of empty message, then you should start asking yourself if you really need those 5 instances of Worker Roles?
Scaling them in will not only can bring down the Storage Transaction costs, but also will save you some money on Windows Azure Compute Instances.
*Thanks to Brad Calder for this thought.
Another hidden scenario that may burst your bill on Storage Transaction is turning on Windows Azure Diagnostic if you do not control it properly.
Windows Azure Diagnostic collects diagnostic data from your instances and copies it to a Window Azure Storage account (either on blob and table storage). Those diagnostic data (such as log) can indeed help developer for the purpose of monitoring performance and tracing source of failure if exception occurs.
We’ll need to define what kind of log (IIS Logs, Crash Dumps, FREB Logs, Arbitrary log files, Performance Counters, Event Logs, etc.) to be collected and send to Windows Azure Storage either on-schedule-basis or on-demand.
However, if you are not carefully define what you are really need for the diagnostic info, you might end up paying the unexpected bill.
Assuming the following figures:
How much it costs for Storage Transaction per month?
5 counters X 12 times X 60 min X 24 hours X 30 days X 100 instances = 259,200,000 transactions
$ 0.01 per 10,000 transactions X 129,600,000 transactions = $ 259.2 per month
Ask yourself again if you really need to monitor all 5 performance counters on every 5 seconds? What if you reduce them to 3 counters and monitor it every 20 seconds?
3 counters X 3 times X 60 min X 24 hours X 30 days X 100 instances = 3,8880,000 transactions
$ 0.01 per 10,000 transactions X 129,600,000 transactions = $ 38.8 per month
You can see how much you save for this numbers. Windows Azure Diagnostic is really needed but use it improperly may cause you paying unnecessary money. It’s double-edge sword, be careful.
To conclude, this article gives you a view of how Transaction Cost of Windows Azure Transaction may lead to costly charge if it’s not properly used. Different component in Windows Azure Platform charges differently, cloud architect should have deep understanding in order to design scalable, reliable, yet cost-effective solution to customer.
In some case where constantly request is requirement, you may also would like to evaluate using SQL Azure instead of Windows Azure Storage because there will no any storage transaction cost in SQL Azure.
Do not worry of using any component if you really need. As long as you architect and design the solution properly, the cost should be reasonable enough.
Hopefully by reading this article, you’ll save some money for storage transaction
.

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Back
Void
Life
Earth
Wind « Default
Water
Fire
Light 