How ‘micro’ can we make our service in Microservices architecture?

Shubham AgrawalShubham Agrawal
4 min read

In this article, I will help you in making this decision out.


The “micro” in microservices refers to the size and scope of each service. However, there’s no fixed rule about how small a service should be. The goal is not just to make services “small” but to make them manageable, cohesive, and loosely coupled. The level of granularity should balance between independence, complexity, and performance.

Here’s how you can think about how “micro” your service should be:

1. Cohesion: Single Responsibility Principle

A service should ideally handle one specific business capability or domain.
For example:

  • Too Broad: A “User Management” service that handles authentication, profile management, and analytics.

  • Appropriately Micro: Separate services:
    - Authentication Service (manages login, tokens, etc.)
    - User Profile Service (handles user details like name, age, preferences)
    - Analytics Service (tracks user behavior, generates reports)

2. Avoid Over-Fragmentation

While it’s tempting to split every small functionality into a microservice, excessive fragmentation can lead to:

  • Increased Complexity: More services to manage, monitor, and deploy.

  • Performance Bottlenecks: Too many network calls between services.

For example:

  • Over-Micro: Splitting a billing service into multiple smaller services (e.g., Tax Calculation, Invoice Generation, Discount Application) that interact heavily.

  • Balanced Approach: A single Billing Service that handles all related tasks internally.

3. Granularity Based on Team Structure

Microservices often align with team ownership. Each service should be owned and managed by a small, cross-functional team.

  • Too Micro: A single developer owns a service.

  • Balanced: A team of 5–10 people manages a service end-to-end.

4. Bounded Contexts

Microservices should align with bounded contexts in Domain-Driven Design (DDD). A bounded context defines a clear boundary for a particular domain or functionality.
For example:

  • In an e-commerce system, you might have:
    - Product Service: Manages product catalogs.
    - Order Service: Handles order creation and tracking.
    - Payment Service: Processes payments.

5. Data Ownership and Independence

Each service should own its data and not rely heavily on other services’ databases.
For example:

  • Too Interdependent: A microservice that constantly queries other microservices for data it should own.

  • Appropriately Micro: A service manages its data, with other services calling its APIs when needed.

6. Consider Performance and Latency

Smaller services mean more network calls, which can introduce latency. When deciding how “micro” to make your services, consider:

  • Critical Path: If services are on the critical path of a user request (e.g., loading a webpage), too many calls can slow the response.

  • Batch Operations: If a service processes large amounts of data (e.g., analytics), splitting it into smaller services can slow down processing.


Key Questions to Determine How Micro to Go

Does the service have a single responsibility?
-
If not, consider breaking it down.

Do services need to interact frequently?
-
If yes, they might be too granular. Club them

Can the service be developed, deployed, and scaled independently?
-
If no, it’s not a true microservice.

Is the operational overhead manageable?
-
If not, reconsider the level of granularity.

Does the team structure support this granularity?
-
Teams should own services fully without being spread too thin.


Practical Advice

  1. Start Coarser, Then Split Gradually: Begin with larger, well-defined services and split them only when bottlenecks, scalability issues, or development challenges arise.

  2. Invest in DevOps and Monitoring: The more microservices you have, the more you need robust monitoring, logging, and orchestration tools.

  3. Use Domain-Driven Design: Let the business domains guide your service boundaries.

  4. Optimize for Change and Scalability: Services should be micro enough to evolve independently but not so micro that they hinder performance or become unmanageable.


Real-World Examples

  • Netflix: Highly granular microservices (e.g., separate services for recommendations, playback, billing). However, they invest heavily in tooling, monitoring, and orchestration to manage complexity.

  • Amazon: Services are small enough to be independently deployable, but not so small that network calls dominate.

  • Smaller Organizations: Typically use less granular services due to limited resources and expertise.

Conclusion:- By carefully balancing granularity with practical considerations, you can determine the right level of “micro” for your specific system.


Thank you for your time! 😊

Connect with me on LinkedIn

0
Subscribe to my newsletter

Read articles from Shubham Agrawal directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shubham Agrawal
Shubham Agrawal