Blackball Software

View Original

How we saved over $23,000 in Microsoft Azure subscription costs

Deploying software to the cloud has offered amazing benefits in regards to scalability, uptime and infrastructure management however it is easy to miscalculate the true costs of services which can snowball over time if not properly managed.

One of our clients asked if we could review their Azure subscription and infrastructure requirements as their subscription costs had been creeping up and were a now a sizable outgoing for their business. Here’s what we found.

Disclaimer - Blackball Software are not infrastructure experts but we’ve been doing this stuff for ages.

We had access to the client’s Azure environment for the purposes of managing their services, however we did not have access to their billing details. Further, their Azure billing was part of their Microsoft Enterprise Agreement and complicated the already convoluted Azure costing information. Our client was able to send through a detailed usage report which broke down the usage and cost of each service daily under their subscription.

Azure detailed usage report

From here we used a pivot table in Excel to total the Meter Category and ExtendedCost columns which quickly showed us which services were costing the most. By including the Product column into the to the pivot row then provided a detailed view of each service.

Note that there’s probably better ways to do this but this is what worked for us.

Here’s the pivot table showing the cost of each service for a single month. We were able to compare the previous month to confirm that there was little variation in the monthly billing so can assume their annual commitment was approximately $35,429.

Cost by service pivot table

Armed with the Azure pricing calculator we worked through each of the services and identified how we could reduce costs.

Cloud Services (servers)

Our client runs a monolith web application which was running on two instances of Azure Cloud Services which gave them a level of redundancy. They also utilised the staging environment for these services as part of their deployment and testing pipeline.

The kicker was that Azure charges them for an additional two staging instances at the same price bringing the total instances up to four! There wasn’t any way to dial back the performance of the staging slots and they would continue to be charged for them even when when not in use as they were still provisioned. They would need to delete the staging environment in order to stop being charged for them. So a $350 cloud server was costing them an additional $1000 a month.

Our client had always planned to migrate to a more modern Azure Web App however there was a cost involved to carry out the migration and potential impact to their customers using the platform if there was any downtime.

Our client agreed to the migration which involved running a second instance of their application on Azure Websites (Web App Service) before switching over their users.

One major blocker for not migrating previously was the use of wkpdftohtml for printing and exporting complex reports. This is an executable that ran on the server which we couldn’t run on the newer web app.

We explored the possibility of running wkpdftohtml as an Azure Function but discovered partial support for it on Azure Websites! The actual changes to their application were very minor and the migration went smoothly.

Because of the massive speed improvements of deploying to Azure websites and the ability to hotswap from free staging slots to production, they reduced their server instances from four to one.

Cost savings per month: $1025

Storage

Their storage costs were substantially higher than we expected. We assumed part of the problem was keeping all data in the ‘hot’ state and not utilising ‘cold’ storage as well as the higher cost for geo-redundant storage. Trying to figure out the file information from Azure’s online portal is not an easy task however the Microsoft Azure Storage Explorer desktop tool does a great job at helping you navigate all those blobs, tables and files.

Microsoft Azure Data Explorer

Safe to say, after 16 TB of old database backups and files were removed, their storage costs dropped dramatically. With the remaining data usage, we calculated that there would be a negligible cost saving in utilizing hot and cold storage swapping or newer storage plans that Azure offered so we didn’t make any further changes.

Note: It is unlikely that you are going to find such large cost savings with data storage like we did however this should serve as an example of how the true cost isn’t easily identified until you do a bit of investigating.

Cost savings per month: $850

Data Services (databases)

They run two databases - one for their production environment and one for staging/testing. While we thought we could save some performance here, we felt the savings would be negligible for the effort required and did not want to negatively impact the database performance. We did however scale back the staging database which we can manually dial up when required.

Cost savings $60 per month.

Cache

The cache service costs relates to the use of Redis. We haven’t changed anything here however improvements to the app and moving to the single Azure websites instance means we can look to remove/reduce the caching in the future.

Cost savings per month: $0

Potentially $57 depending on the scope of performance impact for users.

Virtual Machines

Our client uses virtual machines for specific GDPR and data custodian requirements. We dialed these back a bit on the understanding that they could be dialed up if performance became an issue. We also changed the plan to a more modern Virtual Machine plan which provided a better performance for the cost.

Cost savings per month: $11

Scheduler

The Azure scheduler was responsible for triggering a number of background and administrative tasks. The standard scheduler had a fixed monthly price with some maximum usage restrictions. We created Azure Jobs for different tasks and were able to stop using the Scheduler.

A simple Azure Job to trigger background tasks

Azure Jobs cost pennies to run and are easy to set up. The above task triggers an HTTP endpoint every minute in their application.

Cost savings per month: $18

It took a few months for the savings to be fully realised due to us running some services in parallel while we completed the server migration. However there were some immediate cost savings such as reducing the storage used.

The total annual savings was a massive $23,568 which was over 2/3rds of their annual Azure spend. Our client is happy to reduce their subscription costs and we are now deploying their system to more modern architecture which makes our jobs easier. Win win.