Skip to content

How big is a microservice?

  • The size of a microservice is a frequently debated and sometimes contentious topic, often leading to unnecessary discussions instead of actual implementation.
  • Terms like “microservice” versus “nano service” and whether a container or a certain number of serverless functions define a microservice can cause confusion but are not always relevant.
  • In microservice architecture, each microservice should ideally support a single, specific business capability or function.
  • Microservices should be well-defined, self-contained, and capable of being developed, deployed, and scaled independently.
  • The emphasis should be on creating services that are small, autonomous, cohesive, loosely coupled, and easy to maintain.
  • Keeping microservices small and manageable helps with understanding, testing, and maintenance.
  • Quoting James Lewis of ThoughtWorks UK: “A microservice is as big as my head.” This underlines that a microservice should be understandable by one developer, including understanding how changes in one area affect others.
  • The internal structure of a microservice is flexible as long as its external interface remains strong and clear.
  • There is no universal answer; ideal microservice size depends on business domain, functional complexity, and team capabilities.
  • Key is to balance granularity (how narrowly focused a service is) against the complexity it introduces.
  • Microservices should be focused, cohesive, and independently deployable.
  • The size should be determined by business needs, maintainability, and scalability requirements, not by arbitrary measures like lines of code.
  • Team size and capability are important factors in determining how large or small a service should be.
  • As systems evolve, it’s important to re-evaluate microservice boundaries to ensure ongoing alignment with business and architectural needs.
  • If a service becomes too complex to understand, breaking it down further is encouraged.
  • With the right tooling, automation, and organizational structure, refactoring microservices becomes feasible and should not be overly challenging.