Cost Optimization Tips for Azure Cloud-Part III
Share This Page
In continuation to my previous blog am going to jot down more on how to optimize cost while moving into Azure public cloud
1. UPGRADE INSTANCES TO THE LATEST GENERATION-
With Microsoft Introducing next generation of Azure deployment via Azure Resource Manager (ARM) we can avail significant performance improvement just by upgrading the VM’s to latest versions (From Azure V1 to Azure V2). In all case the price would either be same or near to same.
For example- if you are upgrading a DV1-series VM to DV2- Series it gives you 35-40% faster processing for the same price point .
2. TERMINATE ZOMBIE ASSETS –
It is not enough to shut down VMs from within the instance to avoid being billed because Azure continues to reserve the compute resources for the VM including a reserved public IP. Unless you need VMs to be up and running all the time, shut down and deallocate them to save on cost. This can be achieved from Azure Management portal or Windows Powershell.
3. DELETING A VM-
If you delete a VM, the VHDs are not deleted. That means you can safely delete the VM without losing data. However, you will still be charged for storage. To delete the VHD, delete the file from Blob storage.
- When an end-user’s PC makes a DNS query, it doesn’t contact the Traffic Manager Name servers directly. Instead, these queries are sent via “recursive” DNS servers run by enterprises and ISPs. These servers cache the DNS responses, so that other users’ queries can be processed more quickly. Since these cached responses don’t reach the Traffic Manager Name servers, they don’t incur a charge.
The caching duration is determined by the “TTL” parameter in the original DNS response. This parameter is configurable in Traffic Manager—the default is 300 seconds, and the minimum is 30 seconds.
By using a larger TTL, you can increase the amount of caching done by recursive DNS servers and thereby reduce your DNS query charges. However, increased caching will also impact how quickly changes in endpoint status are picked up by end users, i.e. your end-user failover times in the event of an endpoint failure will become longer. For this reason, we don’t recommend using very large TTL values.
Likewise, a shorter TTL gives more rapid failover times, but since caching is reduced the query counts against the Traffic Manage name servers will be higher.
By allowing you to configure the TTL value, Traffic Manager enables you to make the best choice of TTL based on your application’s business needs.
- If you provide write access to a blob, a user may choose to upload a 200GB blob. If you’ve given them read access as well, they may choose do download it 10 times, incurring 2TB in egress costs for you. Again, provide limited permissions, to help mitigate the potential of malicious users. Use short-lived Shared Access Signature (SAS) to reduce this threat (but be mindful of clock skew on the end time).
- Azure App Service charges are applied to apps in stopped state. Please delete apps that are not in use or update tier to Free to avoid charges.
- In Azure Search, The stop button is meant to stop traffic to your service instance. As a result, your service is still running and will continue to be charged the hourly rate.
- Use Blob storage to store Images, Videos and Text files instead of storing in SQL Database. The cost of the Blob storage is much less than SQL database. A 100GB SQL Database costs $175 per month, but the Blob storage costs only $7 per month. To reduce the cost and increase the performance, put the large items in the blob storage and store the Blob Record key in SQL database.
- Cycle out old records and tables in your database. This saves money, and knowing what you can or cannot delete is important if you hit your database Max Size and you need to quickly delete records to make space for new data.
- If you intend to use substantial amount of Azure resources for your application, you can choose to use volume purchase plan. These plans allow you to save 20 to 30 % of your Data Centre cost for your larger applications.
- Use a strategy for removing old backups such that you maintain history but reduce storage needs. If you maintain backups for last hour, day, week, month and year, you have good backup coverage while not incurring more than 25% of your database costs for backup. If you have 1GB database, your cost would be $9.99 per month for the database and only $0.10 per month for the backup space.
- Azure Document DB with the stored procedure is that they enable applications to perform complex batches and sequence of operations directly inside the database engine, closer to the data. So, the network traffic latency cost for batching and sequencing operations can be completely avoided. Another advantage to using stored procedure is that they get implicitly pre-complied to the byte code format upon registration, avoiding script compilation costs at the time of each invocation.
- The default of a cloud service size is ‘small’. You can change it to extra small in your cloud service – properties – settings. This will reduce your costs from $90 to $30 a month at the time of writing. The difference between ‘extra small’ and ‘small’ is that the virtual machine memory is 780 MB instead of 1780 MB.
- Windows Azure Diagnostic may burst your bill on Storage Transaction. If you do not control it properly.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:
- You a few application that require high processing power of 100 instances
- You apply 5 performance counter logs (Processor% Processor Time, Memory Available Bytes, Physical Disk% Disk Time, Network Interface Connection: Bytes Total/sec, Processor Interrupts/sec)
- Performing a schedule transfer for every 5 seconds
- The instance will run 24 hours per day, 30 days per month
- 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
- To bring it down, 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
- An application will organize the blobs in different container per each user. 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.
Assuming the following figures for illustration:
- I have 1,000 users.
- I have 10,000 of files in average for each container.
- Admin call this function 5 times a day in average.
- How much it costs for Storage Transaction per month?
Remember: a single Get Blob 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 so to bring it down.
Do not expose this functionality as real time query to admin. Considering to automatically run this function once in a day, save the size in somewhere. Just let admin to view the daily result (day by day).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
Author Credits: This article was written by Utkarsh Pandey, Azure Solution Architect at 8KMiles Software Services and originally published here