BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

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

Transcript of BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Page 1: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Introduction to Microservices (And)

The Seven DEADLY SINS OF MicroservicesDaniel Bryant

@danielbryantuk

OpencRedo

(WITH Credit to Tareq Abedrabbo)

Page 2: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

The Seven Deadly Sins

1. LUST …

2. GLUTTONY

3. GREED…

4. SLOTH

5. WRATH

6. ENVY

7. PRIDE

07/04/2016 @danielbryantuk

Page 3: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

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

07/04/2016 @danielbryantuk

Page 4: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Who Am I?

• Chief Scientist at OpenCredo

ü Agile, Architecture, CI/CD, DevOps

ü Microservices, cloud, containers

ü Driving change through the application of technology and teams

• London Java Community Associate

• InfoQ Editor, DZone MVB, VOXXed, O'REILLy

• MBCS (10+ Years), Ex-academic (PhD AI/Software)

07/04/2016 @danielbryantuk

Page 5: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

So, What are microservices?

“Loosely coupled service oriented architecture with bounded contexts”

Adrian Cockcroft

“Applications that fit in your head”James Lewis

07/04/2016 @danielbryantuk

Page 6: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

So, What are microservices?

• Architectural style - build services around biz Capability

• single App composed of multiple services

• Services Running as individual processes, individually deployable

• lightweight external communication (e.g. rest over http)

• Potentially polyglot Language and Data stores

• Minimum centralised management

07/04/2016 @danielbryantuk

Page 7: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Monolith vs microservices

07/04/2016 @danielbryantuk

martinfowler.com/articles/microservices.html

Page 8: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

AKF Scale Cube

07/04/2016 @danielbryantuk

Microservices

Page 9: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Microservices Were often a 'Result'

07/04/2016 @danielbryantuk

www.slideshare.net/trenaman/javaone-2015-scaling-micro-services-at-gilt

Page 10: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

I'm sure a few of you are thinking...

This sounds like distributed objects (CORBA)...

Yes

This sounds like component-based software engineering...

Yes

This sounds like service-oriented architecture (SOA)...

Yes

07/04/2016 @danielbryantuk

Page 11: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

So, we've done this before?

Oh, Yes...

but this time it's Different...

maybe...

07/04/2016 @danielbryantuk

Page 12: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

The Perfect Storm in IT?

• collaborative Processes (and increasing requirements for speed)

– Devops, (Lean and Agile)

• Programmable infrastructure

– Config management, Cloud and containers

• Open source

– Download, consume and contribute

07/04/2016 @danielbryantuk

Page 13: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Get ready for the (Gartner) rollercoaster...

07/04/2016 @danielbryantuk

en.wikipedia.org/wiki/Hype_cycle

Microservices

Page 14: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Opencredo have worked with microservice early adopters...

...And have learnt many lessons

07/04/2016 @danielbryantuk

opencredo.com/casestudies/noths-case-study/opencredo.com/casestudies/millenoki-iot/opencredo.com/casestudies/sedex-google-cloud-platform/

Page 15: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

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

07/04/2016 @danielbryantuk

Page 16: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

1. Lust - Using THE LATEST and Greatest Tech…07/04/2016 @danielbryantuk

Page 17: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Microservices...

They solve all of our problems, Right?

(If you have silver bullets, watch out for the werewolves)

07/04/2016 @danielbryantuk

Page 18: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

No... Not necessarily good for speed

07/04/2016 @danielbryantuk

skillsmatter.com/skillscasts/6143-microservices-for-speed

Additional Reading!!martinfowler.com/bliki/

MonolithFirst.html

Page 19: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

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)

07/04/2016 @danielbryantuk

Page 20: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

No... Check your architecture/design skills

07/04/2016 @danielbryantuk

Page 21: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

No... Operational maturity is vital

07/04/2016 @danielbryantuk

martinfowler.com/bliki/MicroservicePrerequisites.html

Page 22: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Microservices are very useful

But check your use case...

...Evaluation is a key skill

07/04/2016 @danielbryantuk

Page 23: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

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

07/04/2016 @danielbryantuk

Page 24: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Pick Your (Technical) Battles...…

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

• Java and Spring (Boot) are perfectly acceptable

• Do you really need containers?

07/04/2016 @danielbryantuk

Page 25: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Matt Raible’s Comparison Framework

07/04/2016 @danielbryantuk

Page 26: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

2. GLUTTONY - Excessive Communication PROTOCOLS07/04/2016 @danielbryantuk

Page 27: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

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

07/04/2016 @danielbryantuk

Page 28: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Enterprise communication (Beam me up?)

07/04/2016 @danielbryantuk

www.dzone.com/research/guide-to-enterprise-integration

Page 29: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

3. GREED - All your service are Belong to us…07/04/2016 @danielbryantuk

Page 30: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

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

07/04/2016 @danielbryantuk

Page 31: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

07/04/2016 @danielbryantuk

Dev QA Ops

Hand-offdelaysHand-offdelays

Slowfeedback Slowfeedback

Lackofcohesion, sharedunderstanding andjointaccountability

Front-end Database

Middleware07/04/2016 @danielbryantuk

Page 32: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

07/04/2016 @danielbryantuk

Page 33: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Technical problems are often people problems...

07/04/2016 @danielbryantuk

bit.ly/1L43U4H

Page 34: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Cross-functional Teams

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

• Amazon (bit.ly/1F3Dgkm)

– Communication

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

07/04/2016 @danielbryantuk

Page 35: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

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

07/04/2016 @danielbryantuk

Page 36: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Final Thoughts for the organisation

Can your business team take advantage of microservices?

07/04/2016 @danielbryantuk

Page 37: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Inspiration (for the business)

07/04/2016 @danielbryantuk

https://opencredo.com/the-business-behind-microservices-redux/

Page 38: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

4. SLOTH - Creating a distributed monolith07/04/2016 @danielbryantuk

Page 39: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Can’t Deploy Services Independently?

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

(Also, check you have separated deploy and release)

07/04/2016 @danielbryantuk

Page 40: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Can’t Deploy Services Independently?

• Schema-first design

– Michael Bryzek (Gilt): APIdoc

• Consumer-driven Contracts FTW

– Martin Fowler: CDC - A Service Evolution Pattern

07/04/2016 @danielbryantuk

Page 41: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Architecture - not a Dirty Word

• Technical leadership (bit.ly/1EUwpLl)

• Communication (bit.ly/1Ia3u8o)

• Promote shared understanding

• ‘Just enough’ up front design

07/04/2016 @danielbryantuk

Page 42: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Architectural memes for Microservices

• Design for 'replacability'

• Architectural 'safety' (building cities, not houses)

• Messages

– Event-driven architectures (Event sourcing, CQRS)

– Distributed commit logs (Kafka, Kinesis)

– Actors (Akka, Orleans)

07/04/2016 @danielbryantuk

Page 43: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

5. WRATH - Blowing up when bad things happen 07/04/2016 @danielbryantuk

Page 44: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Bring in Michael Nygard (Or some monkeys)

07/04/2016 @danielbryantuk

Page 45: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

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)

07/04/2016 @danielbryantuk

Page 46: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

OPERATIONAL Concerns: Technical

• Continuous delivery is a microservice prerequisite

– Rapid provisioning

– Basic monitoring

– Rapid application deployment

• Automate, automate, automate...

07/04/2016 @danielbryantuk

Page 47: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

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

07/04/2016 @danielbryantuk

Page 48: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Share the pain...

07/04/2016 @danielbryantuk

Page 49: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

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

is a good thing...

...metaphorically speaking

• You build it, you run it– Accountability

– Shared responsibility

– Communication

07/04/2016 @danielbryantuk

Page 50: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

6. ENVY - The shared SINGLE domain fallacy07/04/2016 @danielbryantuk

Page 51: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

One Model to Rule Them All...

• One 'Canonical' model…– Breaks encapsulation

– Introduces coupling

• Know your DDD– Entities

– Value Objects

– Aggregates and Roots

07/04/2016 @danielbryantuk

Page 52: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

But... how do I generate Reports?

• Aggregated reporting pattern

– Pull by service

• Data Pumps

– Push (Event sourcing?)

07/04/2016 @danielbryantuk

Page 53: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

7. PRIDE - testing in the world of transience07/04/2016 @danielbryantuk

Page 54: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

People are surprisingly quiet about this...

07/04/2016 @danielbryantukmartinfowler.com/articles/microservice-testing/

Page 55: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Testing With Microservices is Difficult...

• Invest in your build pipeline testing

– Serenity BDD

– Hoverfly & Wiremock / Saboteur

– Jenkins Performance plugin

07/04/2016 @danielbryantuk

Page 56: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

Testing With Microservices is Difficult...

• Do it in production(?)

– Netflix

– Hailo

– Gilt

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

07/04/2016 @danielbryantuk

Page 57: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

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

07/04/2016 @danielbryantuk

Page 58: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

07/04/2016 @danielbryantuk

https://skillsmatter.com/members/danielbryantuk#skillscasts

https://www.youtube.com/playlist?list=PLzA2sNPAqK1RcVGsFl7up4Phqs6LlmmiY

http://www.infoq.com/presentations/7-sins-microservices

Page 59: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

07/04/2016 @danielbryantuk

https://opencredo.com/blog/https://opencredo.com/tag/microservices/http://muservicesweekly.com/

http://www.infoq.com/author/Daniel-Bryant

Page 60: BCS 2016 "Intro to Microservices (and the Seven Deadly Sins)"

THANKS...

@danielbryantuk

[email protected]

Credit to Tareq Abedrabbo and the OpenCredo Team for inspiration/guidance

Big Thanks to our clients: Noths.com, Sedex and Millenoki

07/04/2016 @danielbryantuk