Microservices and Layers

275 views
Skip to first unread message

Arun Nair

unread,
Apr 27, 2020, 8:03:11 PM4/27/20
to microservices
Hi,
   Is it recommended that you follow a layered architecture while developing microservices?  For example at https://docs.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/microservice-application-layer-web-api-design they talk about application layer.

My understanding was that there are no physical layers in microservices.  Is this wrong?

Thanks,
Arun

Chris Richardson

unread,
Apr 28, 2020, 8:47:44 AM4/28/20
to Arun Nair, microservices
Arun,

The primary principle is that services (and the teams that own them) should be organized around business capabilities.
They are vertical slices.

I've seen architectures that have a technically layered architecture:
  • Entity services - entity services that wrap the DB
  • Business logic services
  • Coordination services
This kind of technical layering (of backend services) is generally an anti-pattern.

Perhaps the one exception is that you still might have a presentation layer, e.g. web application that generates HTML pages.

Chris



--
You received this message because you are subscribed to the Google Groups "microservices" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microservice...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microservices/2480b2ed-45b7-4e4b-966d-1bc45cab054a%40googlegroups.com.


--
Learn microservices - http://learn.microservices.io
Microservices application platform http://eventuate.io
Consulting and training http://chrisrichardson.net

Dinkar Gupta

unread,
Apr 28, 2020, 12:41:35 PM4/28/20
to microservices
Adding to what Chris mentioned (completely agree), layering is perfectly ok within design of the capability. Follow responsibility layers with a capability (hence microservice) to organize its internal design). The responsibility maybe to offer an API (say headless servixe), presentation (for a f2b MS, translational (a service which needs to deal with integration scenarios or handling some logical layering implicit to the design of the MS (e.g. capture data, process it and publish results as three distinct responsibilities). All these are just examples so maybe more specific scenarios will apply to your case.

Just avoid layering of MS itself into artificial layering inspired by client server types layering thought process. I have seen people using terms like core services layer, composite service layer and channel service layer (even API MS layer :-)) and that is definitely not recommended. Vertical decomposition aligned to capabilities tends to deliver better.

Arun Naik

unread,
Apr 28, 2020, 4:20:28 PM4/28/20
to microservices
Chris,
  Thank you for clarifying this.  Incidentally I also found an article at https://www.thoughtworks.com/radar/techniques/layered-microservices-architecture  which states "We've observed a number of organizations who've adopted a layered microservices architecture, which in some ways is a contradiction in terms".

 I started the microservice  with a layered architecture, but after some time, it did not make sense, with my very limited exposure to writing  microservices.  Hence wanted to check with the community.  The presentation layer is still  kept separate.

Thank you,
Arun

On Tuesday, April 28, 2020 at 6:17:44 PM UTC+5:30, Chris Richardson wrote:
Arun,

The primary principle is that services (and the teams that own them) should be organized around business capabilities.
They are vertical slices.

I've seen architectures that have a technically layered architecture:
  • Entity services - entity services that wrap the DB
  • Business logic services
  • Coordination services
This kind of technical layering (of backend services) is generally an anti-pattern.

Perhaps the one exception is that you still might have a presentation layer, e.g. web application that generates HTML pages.

Chris



On Mon, Apr 27, 2020 at 5:03 PM Arun Nair <arun...@gmail.com> wrote:
Hi,
   Is it recommended that you follow a layered architecture while developing microservices?  For example at https://docs.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/microservice-application-layer-web-api-design they talk about application layer.

My understanding was that there are no physical layers in microservices.  Is this wrong?

Thanks,
Arun

--
You received this message because you are subscribed to the Google Groups "microservices" group.
To unsubscribe from this group and stop receiving emails from it, send an email to micros...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages