July 29, 2022
At Zetta Systems, we work with all kinds of clients using cloud services, smaller (between $ 500 and $ 1,500 monthly cost) and larger, with cloud costs over 30-40K USD per month. That’s why we constantly try to help them by improving the quality of the services used and optimizing their costs. In this article We share how we managed to reduce the monthly cost of one of our clients by over 25%.
Our client’s business is part of the Entertainment industry, entirely online with more than 2 million users on their platform so you can imagine that their consumption of cloud services is very high.
In the last 2 years of our collaborative work, we have been constantly looking for different ways to optimize their cloud cost and we have managed to make a significant reduction of it already by 40%, but nevertheless, we continued to look for different ways to achieve bigger cost optimization.
Proper management of cloud spending is proving to be one of the most difficult aspects in the cloud. Cost optimization cannot be easily done when using public cloud providers, because of the tools offered by them.
Being partners of the biggest three public cloud providers (AWS, Google Cloud and Azure) we are aware of the methods for cost optimization, and we decided to dig deeper into the options of infrastructure cost optimizations.
Our client is using the so-called Amazon EC2 (Amazon Elastic Compute Cloud), which are basically virtual machines in AWS cloud with standard resources, like processors, memory, and disk.
Usually, EC2 instances are utilized between 25 and 50% of the time. That’s why our Amazon partners offered 3 options for optimizing this cost:
Option 1 : Reserved Instances. With this option AWS offers opportunities for additional discounts – between 25 and 35%.
Reserved Instances are available in 3 options – All up-front (AURI), partial up-front (PURI) or no upfront payments (NURI).
When you buy Reserved Instances, the larger the upfront payment, the greater the discount. To maximize your savings, you can pay all up-front and receive the largest discount. Partial up-front RI’s offer lower discounts but give you the option to spend less up-front. But if you “lock in” with Reserved Instances, the only option.
Option 2: Savings Plans is a flexible pricing model offering lower prices compared to On-Demand pricing, in exchange for a specific usage commitment (measured in $/hour) for a one or three-year period
AWS offers three types of Savings Plans
Compute Savings Plans apply to usage across Amazon EC2, AWS Lambda, and AWS Fargate. The EC2 Instance Savings Plans apply to EC2 usage, and Amazon SageMaker Savings Plans apply to Amazon SageMaker usage. You can easily sign up for a 1- or 3-year term Savings Plans in AWS Cost Explorer and manage your plans by taking advantage of recommendations, performance reporting, and budget alerts.
We will give an example to make it clearer. Assuming that our client is using 16 cores and there is over 90% usage almost all the time, and, depending on how the application code is written, you can scale “horizontally” (add more machines with the same parameters) or ” vertically” (by increasing the number of cores, memory, etc.). While if you choose the Saving Plan, the customer is charged a certain amount, which allows you to scale up, as well as changing the location and even the type of machines during the current lock-in period. Of course, with this option the discount is less (about 25%) on an annual basis.
Refactoring is the process of moving applications to cloud infrastructure, while re-architecting them to better suit the cloud environment. This strategy involves modifying your existing software, or a large chunk of the code base, to take advantage of cloud-based features and the flexibility, elasticity and cost optimization that comes with them.
While the refactoring approach is the most time-consuming and resource-intensive, it can provide the highest return on investment once you are running in the cloud.
With this particular client we focused on optimizing the services used and achieved further cost optimization. Moving forward with Aurora we decreased the cost of IOPS in their Aurora cluster. The new Aurora 3 for MySQL provided better logical replication with capabilities such as filtering. We also managed to evaluate DB index usage. Checking the usage of unused indexes incur higher and unnecessary WriteIOPS which were mitigated successfully.
The last optimization achieved was based on changing the CPU architecture. Knowing of the new AWS Graviton2-based Amazon EC2 instances we evaluated the performance improvements that can be obtained with latest generation Graviton2 ARM instance types (M6g, C6g, and R6g) for PHP 7.4. After refactoring of the application code, we managed to achieve 30% better price/performance over the current x86-based instances used before.
After the optimization and analysis of all machines used, we looked at the historical data. We found out that there were indeed machines with steady consumption, but there were also under-utilized machines. To make sure that the historical data is not distorted, we did a test by replacing the machines with another type for one month, and we reduced the number of the under-utilized machines. Our client’s plans were to expand to another location in Europe (at that time they operated entirely in the Data Centers located in the US), by the end of the year. Because of that reason, we discussed that Reserved Instances, which would give us about 34% reduction in EC2 costs, was not applicable for them, as we will not be able to use the Data Centers located in Europe. That’s why we selected the Savings Plans option, which gave us the flexibility to move the resources from one location to another much easier.
What we achieved finally was 26% additional cost savings for the EC2 resources, which is equal to 1/12 of the total cost of these cloud resources in Amazon Web Services or in billing terms equal to 1 free month for the current year spending cost.
Most of our clients are not familiar with these cloud cost optimization opportunities and we are happy to guide them step-by-step throughout the process.
While there are a variety of tools available for teams to use, the right choice ultimately comes down to the company’s needs. As companies advance their cloud management strategies and organizational cultures around responsibility for cloud costs, tools that make it easy to involve teams at any level of the organization become increasingly crucial.
Being partners of the biggest three public cloud providers (AWS, Google Cloud and Microsoft Azure) we are aware of the methods for cost optimization, and we decided to dig deeper into the options of infrastructure cost optimizations.