Microservices Architecture – APPENDIX A: Service Granularity

 

The various levels of service granularity and the positioning of microservices can be illustrated using the following diagram:

Assume there is an imaginary horizontal line (x-axis), representing the line of granularity; the right level determined for MSA. The services that fall closer, or around this line (green services within the dotted box), are good microservices; those that are way above this line trend towards exhibiting characteristics of monoliths, and those that fall way below the line trend towards exhibiting characteristics of nano-services. Many of the yellow services and all of the red services fall in either of these camps.

Problems with monoliths include:

  • Even small, minor changes require rebuilding of the entire code base and re-deployment of the new build.
  • Change cycles (for various functions and features) will have to be tied together, causing an undesirable dependency.
  • Achieving modular structure within a monolith is hard to enforce.
  • Scaling is achieved by replicating the entire application (though specific functions may have different scalability requirements).

Problems with nano-services include:

  • Remote calls are expensive (from a performance perspective).
  • Communication between services becomes chatty, resulting in a sub-optimal system.
  • Unmanageable explosion of services can result in service proliferation, challenging governance.