Introduction to Microservices (And)
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
07/04/2016 @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
07/04/2016 @danielbryantuk
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
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
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
Monolith vs microservices
07/04/2016 @danielbryantuk
martinfowler.com/articles/microservices.html
AKF Scale Cube
07/04/2016 @danielbryantuk
Microservices
Microservices Were often a 'Result'
07/04/2016 @danielbryantuk
www.slideshare.net/trenaman/javaone-2015-scaling-micro-services-at-gilt
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
So, we've done this before?
Oh, Yes...
but this time it's Different...
maybe...
07/04/2016 @danielbryantuk
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
Get ready for the (Gartner) rollercoaster...
07/04/2016 @danielbryantuk
en.wikipedia.org/wiki/Hype_cycle
Microservices
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/
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
1. Lust - Using THE LATEST and Greatest Tech…
07/04/2016 @danielbryantuk
Microservices...
They solve all of our problems, Right?
(If you have silver bullets, watch out for the werewolves)
07/04/2016 @danielbryantuk
No... Not necessarily good for speed
07/04/2016 @danielbryantuk
skillsmatter.com/skillscasts/6143-microservices-for-speed
Additional	 Reading!!
martinfowler.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)
07/04/2016 @danielbryantuk
No... Check your architecture/design skills
07/04/2016 @danielbryantuk
No... Operational maturity is vital
07/04/2016 @danielbryantuk
martinfowler.com/bliki/MicroservicePrerequisites.html
Microservices are very useful
But check your use case...
...Evaluation is a key skill
07/04/2016 @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
07/04/2016 @danielbryantuk
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
Matt Raible’s Comparison Framework
07/04/2016 @danielbryantuk
2. GLUTTONY - Excessive Communication PROTOCOLS
07/04/2016 @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
07/04/2016 @danielbryantuk
Enterprise communication (Beam me up?)
07/04/2016 @danielbryantuk
www.dzone.com/research/guide-to-enterprise-integration
3. GREED - All your service are Belong to us…
07/04/2016 @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
07/04/2016 @danielbryantuk
07/04/2016 @danielbryantuk
Dev QA Ops
Hand-off	delaysHand-off	delays
Slow	feedback Slow	feedback
Lack	of	cohesion,	shared	understanding	 and	joint	accountability
Front-end Database
Middleware
07/04/2016 @danielbryantuk
Technical problems are often people problems...
07/04/2016 @danielbryantuk
bit.ly/1L43U4H
Cross-functional Teams
• Spotify (bit.ly/1C46ZKo)
– Culture
• Amazon (bit.ly/1F3Dgkm)
– Communication
• Gilt (gi.lt/1rgyWvO)
– Strategic alignment
07/04/2016 @danielbryantuk
Conway was Telling the Truth... Deal with it!
07/04/2016 @danielbryantuk
Final Thoughts for the organisation
Can your business team take advantage of microservices?
07/04/2016 @danielbryantuk
Inspiration (for the business)
07/04/2016 @danielbryantuk
https://opencredo.com/the-business-behind-microservices-redux/
4. SLOTH - Creating a distributed monolith
07/04/2016 @danielbryantuk
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
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
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
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
5. WRATH - Blowing up when bad things happen
07/04/2016 @danielbryantuk
Bring in Michael Nygard (Or some monkeys)
07/04/2016 @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)
07/04/2016 @danielbryantuk
OPERATIONAL Concerns: Technical
• Continuous delivery is a microservice prerequisite
– Rapid provisioning
– Basic monitoring
– Rapid application deployment
• Automate, automate, automate...
07/04/2016 @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
07/04/2016 @danielbryantuk
Share the pain...
07/04/2016 @danielbryantuk
“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
6. ENVY - The shared SINGLE domain fallacy
07/04/2016 @danielbryantuk
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
But... how do I generate Reports?
• Aggregated reporting pattern
– Pull by service
• Data Pumps
– Push (Event sourcing?)
07/04/2016 @danielbryantuk
7. PRIDE - testing in the world of transience
07/04/2016 @danielbryantuk
People are surprisingly quiet about this...
07/04/2016 @danielbryantuk
martinfowler.com/articles/microservice-testing/
Testing With Microservices is Difficult...
• Invest in your build pipeline testing
– Serenity BDD
– Hoverfly & Wiremock / Saboteur
– Jenkins Performance plugin
07/04/2016 @danielbryantuk
Testing With Microservices is Difficult...
• Do it in production(?)
– Netflix
– Hailo
– Gilt
• This is an advanced pattern!
– Automation is essential!
07/04/2016 @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
07/04/2016 @danielbryantuk
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
07/04/2016 @danielbryantuk
https://opencredo.com/blog/
https://opencredo.com/tag/microservices/
http://muservicesweekly.com/
http://www.infoq.com/author/Daniel-Bryant
THANKS...
@danielbryantuk
daniel.bryant@opencredo.com
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

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

  • 1.
    Introduction to Microservices(And) The Seven DEADLY SINS OF Microservices Daniel Bryant @danielbryantuk OpencRedo (WITH Credit to Tareq Abedrabbo)
  • 2.
    The Seven DeadlySins 1. LUST … 2. GLUTTONY 3. GREED… 4. SLOTH 5. WRATH 6. ENVY 7. PRIDE 07/04/2016 @danielbryantuk
  • 3.
    The Seven DeadlySins (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
  • 4.
    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
  • 5.
    So, What aremicroservices? “Loosely coupled service oriented architecture with bounded contexts” Adrian Cockcroft “Applications that fit in your head” James Lewis 07/04/2016 @danielbryantuk
  • 6.
    So, What aremicroservices? • 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
  • 7.
    Monolith vs microservices 07/04/2016@danielbryantuk martinfowler.com/articles/microservices.html
  • 8.
    AKF Scale Cube 07/04/2016@danielbryantuk Microservices
  • 9.
    Microservices Were oftena 'Result' 07/04/2016 @danielbryantuk www.slideshare.net/trenaman/javaone-2015-scaling-micro-services-at-gilt
  • 10.
    I'm sure afew 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
  • 11.
    So, we've donethis before? Oh, Yes... but this time it's Different... maybe... 07/04/2016 @danielbryantuk
  • 12.
    The Perfect Stormin 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
  • 13.
    Get ready forthe (Gartner) rollercoaster... 07/04/2016 @danielbryantuk en.wikipedia.org/wiki/Hype_cycle Microservices
  • 14.
    Opencredo have workedwith 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/
  • 15.
    The Seven DeadlySins (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
  • 16.
    1. Lust -Using THE LATEST and Greatest Tech… 07/04/2016 @danielbryantuk
  • 17.
    Microservices... They solve allof our problems, Right? (If you have silver bullets, watch out for the werewolves) 07/04/2016 @danielbryantuk
  • 18.
    No... Not necessarilygood for speed 07/04/2016 @danielbryantuk skillsmatter.com/skillscasts/6143-microservices-for-speed Additional Reading!! martinfowler.com/bliki/ MonolithFirst.html
  • 19.
    No... Check yourarchitecture/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
  • 20.
    No... Check yourarchitecture/design skills 07/04/2016 @danielbryantuk
  • 21.
    No... Operational maturityis vital 07/04/2016 @danielbryantuk martinfowler.com/bliki/MicroservicePrerequisites.html
  • 22.
    Microservices are veryuseful But check your use case... ...Evaluation is a key skill 07/04/2016 @danielbryantuk
  • 23.
    Evaluation “I will postponeusing 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
  • 24.
    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
  • 25.
    Matt Raible’s ComparisonFramework 07/04/2016 @danielbryantuk
  • 26.
    2. GLUTTONY -Excessive Communication PROTOCOLS 07/04/2016 @danielbryantuk
  • 27.
    Standardize Across theOrganization • 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
  • 28.
    Enterprise communication (Beamme up?) 07/04/2016 @danielbryantuk www.dzone.com/research/guide-to-enterprise-integration
  • 29.
    3. GREED -All your service are Belong to us… 07/04/2016 @danielbryantuk
  • 30.
    How Do CommitteesInvent? “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
  • 31.
    07/04/2016 @danielbryantuk Dev QAOps Hand-off delaysHand-off delays Slow feedback Slow feedback Lack of cohesion, shared understanding and joint accountability Front-end Database Middleware
  • 32.
  • 33.
    Technical problems areoften people problems... 07/04/2016 @danielbryantuk bit.ly/1L43U4H
  • 34.
    Cross-functional Teams • Spotify(bit.ly/1C46ZKo) – Culture • Amazon (bit.ly/1F3Dgkm) – Communication • Gilt (gi.lt/1rgyWvO) – Strategic alignment 07/04/2016 @danielbryantuk
  • 35.
    Conway was Tellingthe Truth... Deal with it! 07/04/2016 @danielbryantuk
  • 36.
    Final Thoughts forthe organisation Can your business team take advantage of microservices? 07/04/2016 @danielbryantuk
  • 37.
    Inspiration (for thebusiness) 07/04/2016 @danielbryantuk https://opencredo.com/the-business-behind-microservices-redux/
  • 38.
    4. SLOTH -Creating a distributed monolith 07/04/2016 @danielbryantuk
  • 39.
    Can’t Deploy ServicesIndependently? Check your ‘bounded contexts’ and/or data ‘fault-lines’ (Also, check you have separated deploy and release) 07/04/2016 @danielbryantuk
  • 40.
    Can’t Deploy ServicesIndependently? • Schema-first design – Michael Bryzek (Gilt): APIdoc • Consumer-driven Contracts FTW – Martin Fowler: CDC - A Service Evolution Pattern 07/04/2016 @danielbryantuk
  • 41.
    Architecture - nota Dirty Word • Technical leadership (bit.ly/1EUwpLl) • Communication (bit.ly/1Ia3u8o) • Promote shared understanding • ‘Just enough’ up front design 07/04/2016 @danielbryantuk
  • 42.
    Architectural memes forMicroservices • 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
  • 43.
    5. WRATH -Blowing up when bad things happen 07/04/2016 @danielbryantuk
  • 44.
    Bring in MichaelNygard (Or some monkeys) 07/04/2016 @danielbryantuk
  • 45.
    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
  • 46.
    OPERATIONAL Concerns: Technical •Continuous delivery is a microservice prerequisite – Rapid provisioning – Basic monitoring – Rapid application deployment • Automate, automate, automate... 07/04/2016 @danielbryantuk
  • 47.
    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
  • 48.
  • 49.
    “Developer-on-call” An occasional spiketo the head is a good thing... ...metaphorically speaking • You build it, you run it – Accountability – Shared responsibility – Communication 07/04/2016 @danielbryantuk
  • 50.
    6. ENVY -The shared SINGLE domain fallacy 07/04/2016 @danielbryantuk
  • 51.
    One Model toRule Them All... • One 'Canonical' model… – Breaks encapsulation – Introduces coupling • Know your DDD – Entities – Value Objects – Aggregates and Roots 07/04/2016 @danielbryantuk
  • 52.
    But... how doI generate Reports? • Aggregated reporting pattern – Pull by service • Data Pumps – Push (Event sourcing?) 07/04/2016 @danielbryantuk
  • 53.
    7. PRIDE -testing in the world of transience 07/04/2016 @danielbryantuk
  • 54.
    People are surprisinglyquiet about this... 07/04/2016 @danielbryantuk martinfowler.com/articles/microservice-testing/
  • 55.
    Testing With Microservicesis Difficult... • Invest in your build pipeline testing – Serenity BDD – Hoverfly & Wiremock / Saboteur – Jenkins Performance plugin 07/04/2016 @danielbryantuk
  • 56.
    Testing With Microservicesis Difficult... • Do it in production(?) – Netflix – Hailo – Gilt • This is an advanced pattern! – Automation is essential! 07/04/2016 @danielbryantuk
  • 57.
    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
  • 58.
  • 59.
  • 60.
    THANKS... @danielbryantuk daniel.bryant@opencredo.com Credit to TareqAbedrabbo and the OpenCredo Team for inspiration/guidance Big Thanks to our clients: Noths.com, Sedex and Millenoki 07/04/2016 @danielbryantuk