Amazon Web Services turnout a multi course lunch...
To explain what AWS offered us, the closest analogy that I can draw is we went with an expectation of a simple lunch and got multi course lunch for far less price.
First two courses - High Availability And Security certification & accreditation
Initially we moved our production environment to a large Amazon EC2 instance for two simple reasons.
1. High Availability
2. AWS Security & Compliance (ISO 27001, SAS-70 Type II etc)
Interestingly none in our team had any idea about AWS and still the team was able to get the entire application up and running in 1 day where day started with creating AWS account for first time.
Third Course - Scale
Scaling on AWS was so easy hence will treat ease of scale as meal’s third course. Every time a new customer signs up we use to take half day to provision everything for new customer including buying a new instance.
Honey it was always about Money ($)
Here came major hiccup in middle of sumptuous meal. Cost of meal bloats up every time a new customer signs up because we reserve two large instances for solution to provide redundancy for web server as well as database server. Why large instance because Our application had a large RAM requirements to run advance routing algorithms. Since the hosting cost started pinching us we started looking for cheaper options and Amazon EC2 Micro Instance came for the rescue.
Cost reduction ideas & Amazon EC2 Micro Instance
At this juncture I came across an article by Janakiram about “Getting the Best Out of Amazon EC2 Micro Instances”. My initial reaction “Nice article Janakiram but not me”, 612 MB RAM machine running apache + tomcat + our application one must be kidding. However the role of serendipity in science and technology innovation is well known. I asked my team to setup a demo account on a Amazon EC2 small instance and after setup the solution was working fine apart from occasional running out of memory. To my amusement out of memory problem incidence occur randomly even while not executing memory intensive code. Root cause was team by mistake hosted the entire application (tomcat + postgres) on Micro Instance. I was pleasantly surprised. This was a aha or Nirvana moment for the team. The final formulation not only reduced the cost but also made the solution more stable + scalable.
Here is the high level solution outline.
1. Deploy two web servers on two micro instances for load balancing and redundancy.
2. Deploy database servers on two small instances in a master slave model
The memory intensive operations such as routing algorithm moved to single medium size EC2 instance shared by all deployments. The data caching was moved to memcache [ElastiCache] to reduce web server’s memory requirement and to support more than one web server for load balancing and redundancy . In the process fixed also many architectural issues in code to improve scale while to make architecture robust for hardware and software failure. Micro Instance turnout to be our fourth course and Elastic Cache as fifth. I felt like having the cake and eat it too.
Actual cost reduction
Initial Cost
Two OpenSUSE based large instances for year= 2 X ( $972 + $0.078 * 24 * 365) = $3310
New Cost
Two OpenSUSE based Micro Instance for year = 2 X ($86 + $0.011 * 24 * 365) = $364
Two OpenSUSE based Small Instance for year = 2 X ($291 + $0.029 * 24 * 365) = $1090
One OpenSUSE based Medium Instance shared across 10 deployments = ($582 + 0.46*24*365)/10 = $985/10 = $99
Total = $1553
Net reduction of 53% of hosting cost
Meal’s next planned courses
In order to be leader in the market we have to ensure that our costs are rock bottom while providing excellent value to the customers. One place would be have very low product support cost by having a small and agile product support team. This approach requires us to move as much as hardeare maintenance to cloud as possible. Hence following steps are planned:-
1. Moving to A-Z RDS (Explore the option of managing everything with one small A-Z RDS instance instead of two)
2. Use single database instance across multiple instances
3. Move to Amazon Linux (will save 38%)
We will keep you posted on our experience with new architecture and the taste of other planned courses.
About the author:
Akash Maheshwari is a co-founder MoveInSync and heads the engineering arm. MoveInSync is started by ISB/IT - BHU alums after years of product development experience at Microsoft and Motorola and it is hiring folks interested in creating great platform and solutions on platform using cutting edge technology [drop a line to [email protected]]. MoveInSync’s Employee Transport Management solution’s customer list includes India operations of one of the largest MNC in world & India’s largest airline company.