21
Microservices Done Right (or SOA Lessons Learnt) Sean Farmar MILAN 25-26 NOVEMBER 2016

Microservices done right or SOA lessons learnt - Sean Farmar - Codemotion Milan 2016

Embed Size (px)

Citation preview

Microservices Done Right(or SOA Lessons Learnt)

Sean Farmar

MILAN 25-26 NOVEMBER 2016

Microservices Done Right(or SOA Lessons Learnt)

Sean Farmar

@farmar

My journey to SOATried all “Best Practices”Layers and TiersDistributed monoliths using Web Services … and failed

So I went to my master

Solve the problem you want?mmmm…Coupling your problem is…

Coupling

Temporal (time, synchronous communication)Spatial (physical, deployment, endpoint address)Platform (protocols, .Net Remoting)

Coupling Dimensions

Fallacies of Distributed Computing

var svc = new MyService();

var result = svc.Process(data);

Fallacies of Distributed Computing1. The network is reliable. (Bill Joy and Tom Lyon)

2. Latency is zero. (Bill Joy and Tom Lyon)

3. Bandwidth is infinite. (Bill Joy and Tom Lyon)

4. The network is secure. (Bill Joy and Tom Lyon)

5. Topology doesn’t change. (Peter Deutsch)

6. There is one administrator. (Peter Deutsch)

7. Transport cost is zero. (Peter Deutsch)

8. The network is homogeneous. (James Gosling)

The Fallacies EBook

•Go to: http://go.particular.net/codem16

•Ted Neward’s blog: http://blogs.tedneward.com/post/enterprise-computing-fallacies/

Why Microservices?

Break down the monolith

Why SOA / Microservices?

“Address coupling in our software design by building loosely coupled and highly encapsulated components”

Udi Dahan

EncapsulationAutonomyDecomposing business entitiesSRP (Single Responsibility Principle)Be explicit Keep your vertical slice thin, top to bottom

Monolith

UI

BL

DAL

DB

Tight CouplingLoose Coupling

Monolith

UI

BL

DAL

DB

Tight CouplingLoose Coupling

Vertical Slicing

UI

BL

DAL

DB Referential Integrity

Tight CouplingLoose Coupling

Re-introduces Coupling

SalesConte

ntCRMOps

Lessons learntIt’s hard (er)Messaging: Asynchronous fire and forget, Pub/SubCQ(R)S: Separating data writes and data readsUse messaging only if it suites

Lessons learnt (cont.)

Decomposing your business domain is hard, no framework/tools will magically fix thatData (write) ownershipReferential integrity and GUIDSData reads and eventual consistency

Lessons learnt (cont.)

Monitoring - Lights onTesting is HARDDeployment - Automate everythingOrganization and people, trustBe pragmatic but keep the paradigm

Summary• Avoid all dimensions of coupling• Avoid synchronous communication between

components/microservices, • Don't share data, use view/read models to share

read only data• Decomposing your business domain and entities• You can do it on .Net platform using NServiceBus• Blog post:

http://particular.net/blog/goodbye-microservices-hello-right-sized-services

• Fallacies EBook: http://go.particular.net/codem16

Q&A

Thank You!Sean Farmartwitter: @farmarParticular.net