How to scope a microservice?

Play
The write-up below meant to be a companion to the video above. Please watch the above video to build a better understanding.

The process of creating a new microservice is filled with excitement, primarily because developers get to engage with a clean codebase. This fresh start opens avenues for the adoption of innovative practices and exploration of various tech stacks, libraries, and frameworks. Nonetheless, it is essential to evaluate whether starting anew is the most advantageous approach.# Defining Rigid Boundaries for Microservices

Establishing clear boundaries when defining microservices is essential. A service that is too broad may result in slower deployments and hinder collaboration, while an overly narrow service can create interdependencies and increase architectural complexity. Properly defined boundaries help maintain efficiency and simplicity within the microservices architecture.# Guiding Principles for Microservice Design

Two principles for effective microservice modeling: loose coupling and high cohesion. Loose coupling allows for independent changes within services, ensuring that modifications in one do not necessitate updates in others. High cohesion, on the other hand, promotes the organization of related components within the same service, reducing the need for excessive inter-service communication. Collectively, these principles enhance the flexibility and maintainability of microservices.# Understanding Loose Coupling

Loose coupling refers to the design approach where services are structured in a way that modifications in one service do not require alterations in another. This independence is facilitated by API contracts and well-defined communication protocols, enabling services to operate without being affected by each other’s internal workings.# Exploring High Cohesion

High cohesion involves organizing related behaviors and services together, enhancing deployment speed and minimizing dependencies among unrelated components. It’s crucial to evaluate whether components should be clustered within a single microservice or if they need to be divided.# Conclusion and Next Steps

When considering the creation of a separate microservice, evaluate the coupling and cohesion between the involved components. Maintaining simplicity in architecture is crucial, as it ensures better understanding and management. Upcoming videos will delve deeper into these principles and their real-world applications.


Arpit's Newsletter read by 100,000 engineers

Weekly essays on real-world system design, distributed systems, or a deep dive into some super-clever algorithm.