Microservices Killer: Modular Monolithic Architecture
Kuldeep Pal
Data Engineer - III at Walmart | Software Engineer | Spark | Big Data | Python | SQL | AWS | GCP | Scala | Kafka | Datawarehouse | Streaming | Airflow 1x | Java-Spring Boot | ML
You decide to make breakfast using the microservices approach. You have one machine for cracking eggs, another for whisking, a third for cooking, and yet another for plating. It's high-tech, it's scalable, but... is it really necessary for your morning omelet? This is the realization many tech companies are having about their software architecture. Sometimes, a good old-fashioned frying pan (or in our case, a modular monolith) does the job just fine.
A surprising trend is emerging: some of the biggest names in tech are moving away from microservices towards a more consolidated approach.
What is a Modular Monolith?
Before we jump into the examples, let's clarify what we mean by a modular monolith:
- It's a single deployable unit (like traditional monoliths)
- Internally, it's organized into well-defined modules (like microservices)
- Modules communicate through internal function calls, not over a network.
- It can scale horizontally by running multiple instances behind a load balancer.
Think of it like a Swiss Army knife - one tool with multiple, well-defined functions, rather than a toolbox full of individual tools.
Amazon Prime Video: From Microservices to Monolith
Not a Complete Monolith: Even though they refer to it as a "monolith," it's important to note that this doesn't mean a return to a traditional, large-scale monolithic application. It's more accurate to say they consolidated services for this specific use case. Prime Video as a whole still uses Lambda and microservices for other parts of their system.
Technical Details:
- Original Architecture: Distributed components orchestrated by AWS Step Functions
- New Architecture: Single-process application deployed on EC2 and ECS
- Result: 90% cost reduction for this service
Imagine you're running a pizza delivery service. Initially, you had different people for taking orders, making pizza, and delivering. Each step involved passing information and pizzas between people, which took time and sometimes led to mistakes. Now, you've trained each person to do all steps. It's faster, cheaper, and there's less chance of miscommunication.
Shopify: Embracing "Multi-Services"
Shopify, the e-commerce giant, moved from microservices to what they call "multi-services" - larger, more comprehensive services.
Technical Details:
- Consolidated related microservices into larger units
- Reduced inter-service communication
- Improved data consistency and transaction management
Think of a car manufacturing plant. Instead of having separate tiny factories for each car part, they've combined related parts manufacturing into medium-sized factories. This reduces the need to transport parts between factories, speeds up the process, and makes it easier to ensure all parts fit together perfectly.
领英推荐
Zendesk
Zendesk, a customer service platform, found that their microservices architecture was becoming too complex to manage efficiently.
Technical Details:
- Consolidated microservices into larger, more cohesive services
- Reduced operational overhead
- Improved handling of distributed transactions
Imagine a large library where each book was in a separate, tiny room. Finding and managing books was becoming a nightmare. Zendesk essentially combined related books into larger rooms, making it easier to find, manage, and connect information.
Why the Shift?
1. Reduced Complexity: Fewer services mean simpler deployments and easier debugging.
2. Improved Performance: Less network communication leads to faster response times.
3. Cost Efficiency: Consolidated services often require less infrastructure and operational overhead.
Is Modular Monolith Right for You?
While these examples are compelling, it's important to remember that there's no one-size-fits-all solution in software architecture. Microservices still have their place, especially for very large, complex systems with independent scaling needs.
Consider a modular monolith if:
- Your team is small to medium-sized.
- Your application doesn't require independent scaling of components.
- You're experiencing significant overhead from managing microservices.
- Data consistency across services is a major concern.
Remember, the goal is to choose an architecture that best serves your specific needs, team structure, and business goals. The trend towards modular monoliths shows that sometimes, the best step forward is a step back to simplicity.
Disadvantages of Modular Monolithic Architecture
Thank you for reading our newsletter blog. I hope that this information was helpful and will help you with the Backend Design. If you found this blog useful, please share it with your colleagues and friends. And don't forget to subscribe to our newsletter to receive updates on the latest developments in data engineering and other related topics. Until next time, keep learning!