DLJCJUG 2015: The Seven Deadly Sins of Microservices

48
The Seven DEADLY SINS OF Microservices Daniel Bryant @danielbryantuk OpencRedo (WITH Credit to Tareq Abedrabbo)

Transcript of DLJCJUG 2015: The Seven Deadly Sins of Microservices

The Seven DEADLY SINS OF Microservices

Daniel Bryant @danielbryantuk

OpencRedo

(WITH Credit to Tareq Abedrabbo)

The Seven Deadly Sins

1. LUST …

2. GLUTTONY

3. GREED…

4. SLOTH

5. WRATH

6. ENVY

7. PRIDE

12/08/15   @danielbryantuk  

The Seven Deadly Sins (of Microservices)

1. LUST - Using the latest and greatest tech…

2. GLUTTONY - Excessive communication protocols

3. GREED - All your service are belong to us…

4. SLOTH - Creating a distributed monolith

5. WRATH - Blowing up when bad things happen

6. ENVY - The shared single domain fallacy

7. PRIDE - testing in the world of transience

12/08/15   @danielbryantuk  

Who Am I?

•  Principle Consultant at OpenCredo

ü  Agile, CI/CD, DevOps

ü  Microservices and cloud

ü  Docker, Mesos and Kubernetes

•  London Java Community Associate

•  Adopt OpenJDK and JSR

•  InfoQ Editor and DZone MVB

12/08/15   @danielbryantuk  

So, What is a microservice?

“Loosely coupled service oriented architecture with bounded contexts”

Adrian Cockcroft

“Applications that fit in your head” James Lewis

12/08/15   @danielbryantuk  

1. Lust - Using THE LATEST and Greatest Tech… 12/08/15   @danielbryantuk  

Microservices...

They solve all of our problems, Right?

12/08/15   @danielbryantuk  

No... Not necessarily good for speed

12/08/15   @danielbryantuk  skillsma7er.com/skillscasts/6143-­‐microservices-­‐for-­‐speed    

AddiConal  Reading!!  marCnfowler.com/bliki/

MonolithFirst.html    

No... Check your architecture/design skills “If you can't build a [well-structured] monolith,

what makes you think microservices are the answer?”

Simon Brown (bit.ly/1n7D0vp)

12/08/15   @danielbryantuk  

No... Check your architecture/design skills

12/08/15   @danielbryantuk  

No... Operational maturity is vital

12/08/15   @danielbryantuk  

marCnfowler.com/bliki/MicroservicePrerequisites.html    

Microservices are very useful

But check your use case...

...Evaluation is a key skill

12/08/15   @danielbryantuk  

Evaluation

“I will postpone using this shiny new framework until my peers have validated the proposed benefits with

rigorous scientific experiments”

- Said by no programmer …ever

12/08/15   @danielbryantuk  

Pick Your (Technical) Battles...…

•  As Dan McKinley says, “Choose Boring Technology” –  Optimize globally across organisation

•  Java and Spring (Boot) are perfectly acceptable

•  ... As are tomcat/jetty

12/08/15   @danielbryantuk  

Matt Raible’s Comparison Framework

12/08/15   @danielbryantuk  

2. GLUTTONY - Excessive Communication PROTOCOLS 12/08/15   @danielbryantuk  

Standardize Across the Organization

•  Choose one synchronous protocol

–  e.g. JSON over HTTP

•  Choose one asynchronous protocol

–  e.g. RabbitMQ

Don’t gold-plate, but know your options: ProtoBuf, Thrift, ZeroMQ, MQTT

12/08/15   @danielbryantuk  

Enterprise communication (Beam me up?)

12/08/15   @danielbryantuk  

www.dzone.com/research/guide-­‐to-­‐enterprise-­‐integraCon    

3. GREED - All your service are Belong to us… 12/08/15   @danielbryantuk  

How Do Committees Invent?

“organizations which design systems ...

are constrained to produce designs which are copies of the communication structures of these organizations”

- Melvin Conway, 1968

12/08/15   @danielbryantuk  

12/08/15   @danielbryantuk  

Dev   QA   Ops  

Hand-­‐off  delays  Hand-­‐off  delays  

Slow  feedback   Slow  feedback  

Lack  of  cohesion,  shared  understanding  and  joint  accountability  

Front-­‐end   Database  

Middleware  12/08/15   @danielbryantuk  

12/08/15   @danielbryantuk  

Technical problems are often people problems...

12/08/15   @danielbryantuk  

bit.ly/1L43U4H    

Cross-functional Teams

•  Spotify (bit.ly/1C46ZKo) –  Culture

•  Amazon (bit.ly/1F3Dgkm) –  Communication

•  Gilt (gi.lt/1rgyWvO) –  Strategic alignment

12/08/15   @danielbryantuk  

Conway was Telling the Truth... Deal with it!

12/08/15   @danielbryantuk  

Final Thoughts for the organisation

Can your business team take advantage of microservices?

12/08/15   @danielbryantuk  

Inspiration (for the business)

12/08/15   @danielbryantuk  

bit.ly/1Mi3hDi    

4. SLOTH - Creating a distributed monolith 12/08/15   @danielbryantuk  

Can’t Deploy Services Independently?

Check your ‘bounded contexts’ and/or data ‘fault-lines’

(Also, check you have separated deploy and release)

12/08/15   @danielbryantuk  

Can’t Deploy Services Independently?

•  Schema-first design

–  Michael Bryzek (Gilt): APIdoc

•  Consumer-driven Contracts FTW

–  Martin Fowler: CDC - A Service Evolution Pattern

“CDC is BDD for microservices” 12/08/15   @danielbryantuk  

Architecture - not a Dirty Word

•  Technical leadership (bit.ly/1EUwpLl)

•  Communication (bit.ly/1Ia3u8o)

•  Promote shared understanding

•  ‘Just enough’ up front design

12/08/15   @danielbryantuk  

5. WRATH - Blowing up when bad things happen 12/08/15   @danielbryantuk  

Bring in Michael Nygard (Or some monkeys)

12/08/15   @danielbryantuk  

Distributed computing - your new best friend

•  Notes on distributed systems for young bloods –  Jeff hodges (bit.ly/1pKVepz)

•  8 Fallacies of distributed computing –  Sun Microsystems, ROTEM-GAL-OZ (bit.ly/1IEpFC0)

•  Distributed systems theory for the distributed systems engineer –  Henry Robinson (bit.ly/1qcxqZ3)

12/08/15   @danielbryantuk  

OPERATIONAL Concerns: Technical

•  Continuous delivery is a microservice prerequisite

–  Rapid provisioning

–  Basic monitoring

–  Rapid application deployment

•  I.E. Agile & DevOps

12/08/15   @danielbryantuk  

Operational Concerns: Social

•  Failure happens all the time... Get used to it!

•  'Gameday' or 'Disaster in recovery testing' (Real) Scenarios

•  Failure injection testing (FIT):

–  Building 'Failure as a Service' at Netflix without the Simian Army

12/08/15   @danielbryantuk  

Share the pain...

12/08/15   @danielbryantuk  

“Dev-on-call” An occasional spike to the head

is a good thing...

...metaphorically speaking

•  You write it, you run it –  Accountability

–  Shared responsibility

–  Communication

12/08/15   @danielbryantuk  

6. ENVY - The shared SINGLE domain fallacy 12/08/15   @danielbryantuk  

One Model to Rule Them All...

•  One model… –  Breaks encapsulation

–  Introduces coupling

•  Know your DDD –  Entities –  Value Objects

–  Aggregates and Roots

12/08/15   @danielbryantuk  

But... how do I generate Reports?

•  Aggregated reporting pattern

–  Pull by service

•  Data Pumps

–  Push (Event sourcing?)

12/08/15   @danielbryantuk  

7. PRIDE - testing in the world of transience 12/08/15   @danielbryantuk  

People are surprisingly quiet about this...

12/08/15   @danielbryantuk  marCnfowler.com/arCcles/microservice-­‐tesCng/    

Testing With Microservices is Difficult...

•  Invest in your build pipeline testing

–  Serenity BDD

– Wiremock / Saboteur

–  Jenkins Performance plugin

12/08/15   @danielbryantuk  

Testing With Microservices is Difficult...

•  Do it in production(?)

–  Netflix –  Hailo

–  Gilt

•  This is an advanced pattern! –  Automation is essential!

12/08/15   @danielbryantuk  

Summary

1. LUST - Using the latest and greatest tech…

2. GLUTTONY - Excessive communication protocols

3. GREED - All your service are belong to us…

4. SLOTH - Creating a distributed monolith

5. WRATH - Blowing up when bad things happen

6. ENVY - The shared single domain fallacy

7. PRIDE - testing in the world of transience

12/08/15   @danielbryantuk  

12/08/15   @danielbryantuk  

THANKS...

@danielbryantuk

[email protected]

https://www.parleys.com/tutorial/seven-deadly-sins-microservices

(Credit to Tareq Abedrabbo for inspiration/guidance)

12/08/15   @danielbryantuk