Note: This was a guest post written by Ranvijay Jamwal of Haptik
Who is Haptik?
Haptik is one of the world’s largest chatbot platforms, building applications for consumers, publishers, and enterprises. The company is at the forefront of the paradigm shift from apps to bots, building bots for an array of use cases- from e-commerce to customer service and utility to lead generation.
Haptik was born out of a personal need. The founders realized they were using text communication more than any other application on their phones. What’s now obvious to the rest of us became obvious to them – chat is doing to mobile what search has done to the internet.
The challenge: Reducing cloud compute Costs
At first, Haptik mostly ran using AWS On-Demand Instances, alongside a small set of Reserved Instances. Their cloud costs quickly rose and reducing costs became a major focus as a way to reduce cost-of-goods-sold (COGS).
When first contemplating the need to reduce cloud computing costs, Reserved Instances were considered but deemed too inflexible to be rolled out on a large scale. This led Haptik to start experimenting with the AWS Spot market. This bore initial fruit, as AWS Spot instances were available at a cost of 70-80% lower than On-demand instances.
Unfortunately, managing Spot Instances was very complex, requiring lots of internal focus and maintenance. They built automation scripts to help handle the process, but the risks of running production environment on it were still high. In search of an automatic and reliable solution for managing Spot, Ranvijay Jamwal, Lead DevOps Engineer at Haptik, found Spotinst. Today, Spotinst is a major element of their cost-reduction strategy.
“We are currently saving at least 85% costs on EC2 instances using Spotinst Elastigroup,” says Jamwal. “There are many features available now when using Spotinst platform which we easily use to improve our performance while keeping the costs down, one example is that we are checking for Idle resources and releasing them to save costs.”
So Why Spotinst?
Spotinst is an online cloud management platform that allows companies to run their mission-critical applications on the excess capacity of cloud providers, saving up to 85% on costs. Spotinst supports AWS, Azure, Google Cloud & Packet.
The main Spotinst product utilized by Haptik is Elastigroup – a software layer on top of the Cloud Infrastructure that functions as a cost-oriented Auto-Scaling Group. Elastigroup first uses predictive algorithms to predict Spot behavior, capacity trends, pricing, and interruption rate. Whenever there’s a risk of interruption, Elastigroup acts accordingly to balance capacity, ensuring 100% availability and no risk of downtime. This means that your application will always run on the most cost-efficient collection of instances – the best-priced Spot Instances when available and falling back to on-demand when not, in addition to prioritizing any reserved instances you may already own.
As Haptik found, the main drawback of using Spot Instances themselves (and not using Spotinst Elastigroup) is the massive time suck and focus spent bidding on Spot Instance and managing the server count 24*7 for your critical operations.
Top 5 features that Haptik loves about Elastigroup
- Cluster Orientation – Elastigroup’s sophisticated algorithm takes care of purchasing the right instances. You can just set the algorithm to be sensitive for one of the following:
- Cost Optimization – The Elastigroup will look for and utilize the cheapest instances available.
- Availability Based – The Elastigroup will look for and utilize the Spot Instances with the highest availability
- Balanced Based – A comfortable mix of the previous two options.
- Fallback to On-Demand – Whenever Spot Instances that fit your needs aren’t available, Spotinst falls back to On-Demand, ensuring no risk of downtime. Plus, Spotinst will then revert back to Spot when available.
- Scheduling – Another way to save money, you can set various triggers (eg capacity change) to spin up or down instances based on specific time frames.
- Running Stateful apps on Spot – Spotinst lets you run any application without a single point of failure on Spot, and Stateful apps are no exception. Elastigroup takes continuous snapshots of your instances with the relevant data attached. Once it predicts an interruption, it will launch a new instance with the same data attached from the latest snapshot. You can also “Maintain Private IP” of the server for application who relies on the Private IP of the Instance. For More details click here.
- Scaling Policies – Just like an Auto-scaling Group, you can automatically scale up or down your Instances as needed. You can determine your scaling strategy based on anything from AWS ClowdWatch metrics to Spotinst Spectrum metrics.
Ranvijay Jamwal, Lead DevOps Engineer At Haptik “Working with Spotinst is helping us to reduce 80% of our cloud computing costs on a monthly basis with no risk of downtime, which is crucial to our business. We’ve improved our performance with no additional IT resources and now we can invest more time and effort in our clients.”