Hey friends,
This blog-post is about my recent project – Microservices Architecture Design and Implementation for High Volume Retail e-Commerce. I recently finished this for an e-Commerce Startup in India and hence I thought of blogging about it. I hope you will like this and actively comment.
Microservices Architecture – Quick Introduction
A ‘Microservices Architecture’ or ‘Microservices’ is a software architecture design practice. It is not a software, code or framework by itself – rather it is a style of designing complex software that leverages smaller, yet independent software components called ‘Microservices’.
Microservices pattern has found huge relevance in software industry because the latter is going through a transition from an ‘on-premise, fixed capacity’ paradigm to ‘cloud-based, on-demand capacity’ paradigm. A cloud environment allows fine-grained control on computing resources and associated costs. Another reason of Microservices to have gained popularity is attributable to ever increasing agility in business and associated software development teams. Teams are working on multiple software components at the same time. Each component represents a set of business problems which are called concerns in Microservices context. These components have different levels of efficiency, reliability and delivery times. Therefore there is a need for a loosely coupled software architecture that is inclusive yet fault tolerant for round-the-clock business continuity. That’s where Microservices Architecture fits in.
On a very high-level, Microservices architecture is about building Monolith of Monoliths rather than building one Monolith. Simply said – build smaller software components (Monoliths) that are aligned to specific business concerns; deploy, run and scale such Monoliths independent of each other; and expose a standards based communication protocol (usually RESTful APIs) which can become a universal communication language between multiple Monoliths. And, if need be, integrate multiple such Monoliths with an Integration Monolith (Integration Fabric) that a) orchestrates the communication between multiple Monoliths; and b) becomes a common user interface with a seamless user experience. All small Monoliths are henceforth referred to as ‘Microservices’.
A detailed explanation on Microservices is available on the web – Click Here. I suggest that you refer to this resource in case you wish to deep-dive into theory of Microservices.
e-Commerce (Retail) and Traditional Monolith Approach
e-Commerce software (aka Shopping Cart Software) whether you bought one off-the shelf (such as Magento, Hybris, ATG, InterShop) or developed in-house is a Monolith. It is one huge software package that lets you build and run landing pages, catalog, shopping cart, checkout, payment and back-office operations. My client is no different – they were also about to invest in a Monolith until I came into picture.
Here are some key problems in the Monolith approach:
- Indiscriminate & Inefficient Linear Scaling – You deploy the software on one or more than one server(s) (server instances or application containers in context of cloud or virtualized environment) depending upon the anticipated load (traffic). When load goes up, you deploy additional instances of the same software to increase capacity. By replicating instances of a Monolith you increase capacity in each business concern of the software application whether or not you need the same capacity at each stage.
Think about this in context of an Online Conversion Funnel. The amount of capacity required on top of the funnel (landing pages) is much larger than the capacity required towards the bottom of the funnel (checkout). A simple math – for every 100 customers on the top of the funnel, there is just 1 customer at the bottom (@ 1% conversion rate). Therefore indiscriminate replication of Monolith instances leads to a discriminated utilization of resources as one traverses down the funnel. Towards the end of checkout, you use only 1% of the provisioned capacity wasting 99% capacity which could contribute on top. - Inefficient Software Testing and Slow Release Process – In a Monolith approach, even if the developers make a change in one area (say shopping cart), one has to test the entire application end-to-end to ensure that a change in one area has not impacted any other area. Since the software code is intertwined set of classes, one cannot take a risk of deploying modified software by merely testing the area touched by developers. It is highly possible that a change in one area has an impact on a critical area such as checkout or payment. Therefore each release means a time-consuming regression of entire test suite before a release is certified as production ready. This is an inefficient testing and release process.
- Inability To Be 100% Agile – These days multiple development teams work on separate areas of a Monolith in parallel. Despite proactive project management and impediment management, it is very frequently seen that multiple teams are not able to release their code for production at the same time. Therefore all teams cannot follow a common release cycle. Hence, in case of a Monolith application development, if any team misses a release date, they have to duck out their code from the release candidate, let others go ahead and wait for the next release cycle for inclusion. What if the team whose code was not ready on release date is ready for release the next day? Would the QA team allow an exception and permit another release or hot-fix on basis of a partial testing? Probably never if people are accountable! This is a clear loss of opportunity for business here.
- One Fault Breaks The Entire Cart – In a Monolith application, the chances of a fault to break the entire funnel are very high because the code within a Monolith is either tightly coupled with other pieces of code or has an indirect impact on working of other classes by breaking away from the contracts. An exception in shopping cart or shipping option can break the entire funnel much easily.
- Blame Games – If the application bombs in production, it usually triggers a nasty blame game in the DevOps which is settled by a comprehensive root-cause-analysis by a leader. I and my client didn’t want to encourage this culture. A Monolith approach was not suitable to us for this reason as well.
My Funnelwise Microservices Architecture For e-Commerce Retail
As part of the engagement, I served several options to my client. The illustration below represents a very high-level Microservices architecture that finally won the election in first round of the pitch. Subsequent designs are much detailed and complex which obviously are out of scope of this post. The design below is missing some other key components like Search Microservice which were added in subsequent versions.
The diagram will tend to intimidate you a bit initially but don’t be. I have described thought process in short so that you may appreciate the beauty of this masterpiece.

Since a Monolith application architecture was not suitable for our client, I delivered the above illustrated Microservices Architecture on basis of these design principals.
- Identification of Concerns (Functional Boundaries) – To effectively build Microservices, one needs to divide Monoliths by business concerns. In this case I rotated the Conversion Funnel by 90 degrees CCW and each stage of the funnel became a clear cut business concern which I could serve by an independent Monolith. Concern 1 to Concern 7 in illustration above were the top seven concerns for my client for an effective implementation of an e-Commerce Retail system in the web. We had to excel in all seven areas to be a successful online retailer.
- Concern 1 – Our biggest concern was to be able to handle millions of concurrent visitors on the landing pages (Home Page, Special Promotional Pages, Micro-Sites). Therefore we built a CMS Microservice on top of a NoSQL Document Data Store (Artifact H). This Microservice is exposed to the consumer by an independent web-app (just the presentation MVC) which has as in-built web-caching and talks to CMS Microservice through a RESTful HTTP interface. This Microservice scales up/down the most during the day and it’s scaling is completely independent of how other Microservices scale.
- Concern 2 – Our second biggest concern was to be able to show product catalog in an efficient manner. The maximum allowed response time (not first byte response) at the server was 2 seconds during peak load. Therefore we built a Catalog Microservice (Artifact I) in pretty much the similar way as CMS Microservice but with a different data domain model. Rest details are same as Concern 1. The Catalog Microservice also leverages Personalization Microservice (Artifact P) and other common Microservices for Session persistence (Art. N), Analytics (Art. S) etc.
- Concern 3 – 7 – As is evident from the illustration above, we kept adding a Microservice corresponding to each business concern in funnel till the end. However each Microservice from Concern 1-7 are unique in the way they are implemented on technology front at core. Some use NoSQL databases and others use SQL databases. Some Microservices have BigData implementations such as Hadoop and others use Machine Learning libraries. The Analytics Microservices has Apache Kafka Pipeline to ingest thick streams of application logs and event data generated with customer interactions.
- Key Pointers
- I enforced use of RESTful APIs in almost all the Microservices for a unified messaging protocol. Use of RESTful APIs made development easier and contracts were relatively flexible as compared to SOAP or alternate mechanisms.
- Each Microservice is deployed on specifically optimized containers for optimal performance and durability. Therefore the run-time parameters of each Microservice were different according to nature of corresponding concern or transaction.
- Each Microservice scales independent of others. They focus on their own performance rather than worrying about others.
- Each Web Facade (Web App) hands over customer to next Facade in a seamless manner. The preferred data interchange approach between Facades is traditional HTTP(S) POST.
Key Positive Impacts Of Microservices Architecture
My client calls themselves an e-Commerce Technology Company rather than a pure-play e-Commerce Retailer. Here is a list of key impacts which were noticed by my client.
- Highly Efficient Scaling and Cost Optimization – With each Microservice scaling to demand according to the area of concern in funnel that they belong to, the number of instance replication at each layer (concern) is different at any time. On top of the funnel (landing pages) we operate at about 16 containers during peak hours. On bottom of funnel we operate at about 3 containers at all times (we need just 1 but we keep 2 extra instances on for High Availability reasons). All-together we run about 42 containers during peak hours on which we can get up-to a transaction rate (test conditions) of about 3,400 transactions per minute (Not yet felt a need to test beyond this). If we were on a single Monolith, we would have been running close to 200 instances for the same amount of capacity.
- Independent QA and Rollout Of Each Microservice – My client has split its team into groups of 6 each. Each group owns two Microservices. (The team size and number of Microservices owned will vary on each client’s circumstances). Each time is capable of developing, testing and rolling out their respective Microservice. Therefore if there is a change in Shopping Cart, only one Microservice is tested and rolled out independent of others. The time take for regression testing in each Microservice is very less. The number of releases has increased substantially. Each team releases at their own schedule.
- From Partial To 100% Agility – The development process is 100% Agile now. Each team is responsible for their own set of Microservices. There are fewer inter-dependencies because web-service contracts rarely change. No team is a showstopper for other teams. They can roll out independently and faster. They work on separate code repositories and unique technology stacks. They are working in same premises right now but they may develop & release from distributed locations if need be.
- One Fault Is Less Susceptible To Break Entire Funnel – Each Microservice is an independently developed and tested product. They adhere to strict standards and communication contracts. They do not overlap or depend on code outside their realm. Therefore a fault in one Microservice never induces a fault in other Microservice. The aggregation layer on top aka Funnel (or Monolith of Monoliths) call each Microservice in a loosely coupled manner. The chances of funnel breakdown are considerably less because several Microservices are non-essential for end-to-end funnel performance. In an event of breakdown of non-essential Microservices, the funnel continues to work.
- No Blame Games – The teams are small and self capable. They are responsible for ensuring that their Microservices work as per set norms. There are fewer cases of blame games due to a clear demarcation of application boundaries.
So, you can hopefully appreciate by now as to how Microservices Architecture can change the entire ball-game of a routine e-Commerce (Retail) play. Yes, it makes technology complex and wide-spread but then there is always a trade-off. One loose some to gain some 🙂
About Myself
I am an entrepreneurial-spirited technologist who has managed multitude of business complexities by strategical implementation of technology in a career spanning over 20 years. I have worked in reputed online, software consulting, and startups in leadership positions. A major portion of my career has been spent in e-Commerce industry. I have worked in almost all departments of an e-Commerce enterprise. I am also curator of a ‘best practice based’ high-performance hybrid marketplace technology which I give out to e-Commerce startups as a ready launchpad.
You can check my profile on LinkedIn : https://in.linkedin.com/in/akhildelhi
I hope you linked this blog post and the topic. Please feel free to comment, ask questions and connect with me.

This blog post is a story of a successful IoT implementation I recently concluded for one of my prestigious clients. I hope you will find it worth reading. As always, please feel free to ask questions, comments or give feedback.

Hey friends, this post is about my experiences with Magento – the world’s most popular open-source e-Commerce platform since OsCommerce (a very popular Open Source e-Commerce platform of 1990s and early 2000s)
Amdani Addhanni, Kharcha Rupaiya – remember this Indian saying? Almost every household in India is familiar with this – your salary is half a rupee and your expenses are whole rupee! Infact – just found that there was a Bollywood film on this theme featuring our great comedy star Govinda. The movie goes like this – “Jhoomri and her husband, Bhimsha, move into a new neighbourhood. Their immediate neighbours are three squabbling couples, namely Vijay and Anjali who are newly married; Appu Khote and Vimla, who are married and have 4 children; and Ravi and Meena, who are also married and have one child. With their wages unable to keep up with inflation and high cost of living, unable to pay even rent to the landlord, B.K. Kakkad, the wives decide to seek employment to augment their income, with hilarious results from their spouses, who will go to any extent to keep their wives at home, even if means to bring a dancing girl home to cook and look after the children!!” (Source: IMDB)
Unhealthy Competition – Indian businessmen are unique characters in this world. They loose their own opportunity to knock down competition. And competition behaves the same way back with them :-). These people won’t earn themselves and won’t let the competition earn too. The Indian Online Retail space is such. With price the single most effective USP for everyone, it has become the most effective tool for businessmen to knock competition out. Net effect – no matter which product or category you curate, it fizzes out rapidly with traction. I have tracked my categories for over 6 years in India. I am yet to see a category which has survived more than a couple of months as ‘exclusive’. The moment someone creates demand, others jump into it and kill it by hefty discounts. The online marketplaces are the biggest culprits here – they only know how to kill a category.
Costs of Acquiring Customers (CPAs) Are Unrealistic – Every shop needs customers and a new shop owners must spend money to acquire them, this is no-brainer. The tough-call though is who you are buying these customers from? Answer – Google, Facebook, Twitter or anyone else like them who has first-hand access to potential customers (affiliates, news sites, porn sites etc..). These baddies know their worth and hence they make you bid for acquiring customers based on a theme or context (keyword). This is where things are ugly in India – every online shop is in customer acquisition mode (with more opening up on daily basis) and they are all competing with each other on the similar themes or contexts. Due to this, everyone ends up bidding higher & higher to outbid unknown competitors leading to an unrealistic average cost of acquisition. My studies show that an average cost of customer acquisition for online retailer could be anywhere between INR 650 (USD 10) to INR 50,000 (USD 730) (I am in my senses!) depending on how well thought your acquisition strategy is, how efficient corresponding marketing campaigns are, how fierce the competition is in the given context of yours and how well funded your competitors are. Let’s assume a ballpark CPA figure of INR 1,500 for our subsequent analysis.
Indian Customer’s Lifetime Value (CLV or CLTV) Is Either Going South Or Is Indeterminable – Congratulations! you just spent INR 1,500 (CPA) to acquire a customer from your first order. Did you earn it back (think EBITDA) in first transaction itself? If you did, you don’t need to read this post further. Most likely you haven’t – you are one of thousands who are relying on recovery of this investment from Customer’s Lifetime Value (CLV). A typical Indian Online Customer Lifetime Value ranges between INR 400 (USD 6) to INR 3,000 (USD 43) (used to be higher back in 2010) and this is continuously going down because of continuous market fragmentation and increasing competition. The CLV numbers I am quoting are industry averages – there is no science behind the figures and hence you cannot clearly determine a target CLV for your business. In most likelihood, if you are relying on recovering your INR 1,500 CPA from CLV, it’s going to happen in about 30% of the cases only – could be higher if you can deliver the best online shopping experience end-to-end. But since there are no well defined benchmarks of service levels or customer expectations in Indian e-Tail industry yet, you will have a hard time working and optimizing this index.

Customer Recall (I am recalling Govinda’s song – “Tum To Dhokebaaj Ho, Vada Karke Bhool Jate Ho” – You are a cheater, you forget me after promising..) – You need money (in millions & billions) to create a niche for yourself in a huge market like India. Diverse cultures, languages and consumer behaviour makes life of a marketeer even more difficult in this country. Therefore you require millions in your pocket to get into customer’s mind and stay there. That’s where you see Flipkart, Snapdeal and Amazon trying to spend major portion of the investor’s money. They are not letting anyone else slip into customers’ minds – no matter what it may cost. I meet lot of investors and business management graduates – I am yet to get a clarity of a scientific way of calculating right ATL budget.
Poor Logistics Infrastructure (Either Own It Or Perish) – Every time there is a shopping season, Airport Authority of India (AAI) puts an embargo on air shipments because the existing flight infrastructure can’t simply cope with the ad-hoc peaks in demand. Therefore all leading marketplaces have either setup or acquired or pre-bought logistics infrastructure to be able to deliver in reasonable time. Still they are unable to deliver within 2-3 days. I remember Flipkart Big Billion Day Sale in October 2015. The average delivery time being quoted was 15 days even though they have their own logistics company E-Kart. In such a scenario smaller retailers are no-where in wishlist of 3rd party logistics provider like Bluedart, DTDC, etc. They want a minimum commitment of business per month of around INR 10,00,000 (USD 15,000) to operate end-2-end logistics of a new e-Commerce company. That’s a fixed cost or an entry barrier for new players in this market. Smaller players (think relatively only) can agree on smaller commitment of business but they cannot ensure timely delivery because they either piggy back on established incumbent logistics provider I just quoted in last sentence or use alternative road transport mechanisms which are very slow. So there is a chicken & egg story here. Either you commit to a fixed target upfront (minimum billing), or pay premium on logistics fee to survive. Flipkart, Snapdeal etc. have invested huge money in their logistics wings which is not possible for everyone.
One of my LinkedIn network friend (Yash Jaiswal) recently drew my attention towards this graphic posted by YourStory.com talking about thousands of crores of losses posted by Flipkart, Snapdeal and PayTM in India. I could not resist commenting on it and I am happy that my thoughts were resonated in the community. So I am putting my assessment here.