Real World Example
Netflix: The Famous Migration
In 2008 a database corruption stopped Netflix DVD shipping for three days. Netflix then moved from one big Java monolith in its own data centre to hundreds of microservices on AWS (the migration took about seven years). Today separate services handle sign-up, the catalogue, recommendations, playback, billing and more. Netflix built and open-sourced many of the tools that later became part of Spring Cloud (Eureka, Hystrix, Zuul, Ribbon).
Amazon, Uber and Swiggy
| Company | Started as | Split into services such as |
|---|---|---|
| Amazon | One big C++/Perl app ("Obidos") | catalogue, cart, checkout, recommendations, reviews; every team exposes an API ("two-pizza teams") |
| Uber | A Python monolith for one city | rider, driver, trips, pricing (surge), maps/ETA, payments, notifications |
| Swiggy | A monolith for food delivery | restaurant listing, menu, cart, order, delivery partner assignment, payments, Instamart |
| Flipkart | A monolith | catalogue, search, cart, checkout, payments, logistics (Ekart) |
Note: All of them started with a monolith and split it when the team and traffic grew. None started with 500 services on day one.
How a Swiggy Order Crosses Services
App --> API Gateway --> order-service
|-- GET restaurant-service/restaurants/42/open -> true
|-- POST pricing-service/quote -> Rs 348 incl. fees
|-- POST payment-service/charges -> PAID
|-- publish event "OrderPlaced"
|--> restaurant-service (show order to kitchen)
|--> delivery-service (assign a delivery partner)
|--> notification-service(push "Order confirmed")ShopEase in Code: One Endpoint, Two Services
The same "place order" feature, seen from the client. The client calls only order-service; order-service calls product-service behind the scenes (we build this in the Building Your First Microservices module):
Example
Request and response:
curl -X POST localhost:8082/api/orders \
-H "Content-Type: application/json" \
-d '{"userId": 7, "items": [{"productId": 1, "quantity": 2}]}'Example output
HTTP/1.1 201 Created
Location: /api/orders/1001
Content-Type: application/json
{"id":1001,"userId":7,"status":"CREATED","total":2998.00,
"items":[{"productId":1,"productName":"boAt Rockerz 450","unitPrice":1499.00,"quantity":2}]}