The 'microservices' architectural style has taken the software development industry by storm over the past two years. Several people are arguing that this is simply classical SOA being rebranded, while others are suggesting that creating loosely-coupled composable services is simply architectural best-practice. Join Daniel for a brief introduction to the topic of microservices, and also a tour of the nastiest sins (anti-patterns) he has seen in his journey as a consultant.
Topics covered include:
* Pride - selfishly ignoring the new requirements for testing
* Envy - introducing inappropriate intimacy within services by creating a shared domain model
* Wrath - failing to deal with the inevitable bad things that occur within a distributed system
* Sloth - composing services in a lazy fashion, which ultimately leads to the creation of a Distributed Monolith
* Lust - embracing the latest and greatest technology without evaluating the operational impact incurred by these choices
Presented at the BCS Software Practice Advancement SPA-298 event on 6/4/2016
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 Deadly Sins
1. LUST …
2. GLUTTONY
3. GREED…
4. SLOTH
5. WRATH
6. ENVY
7. PRIDE
07/04/2016 @danielbryantuk
3. 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
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 are microservices?
“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 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
9. Microservices Were often a 'Result'
07/04/2016 @danielbryantuk
www.slideshare.net/trenaman/javaone-2015-scaling-micro-services-at-gilt
10. 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
11. So, we've done this before?
Oh, Yes...
but this time it's Different...
maybe...
07/04/2016 @danielbryantuk
12. 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
13. Get ready for the (Gartner) rollercoaster...
07/04/2016 @danielbryantuk
en.wikipedia.org/wiki/Hype_cycle
Microservices
14. 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/
15. 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
16. 1. Lust - Using THE LATEST and Greatest Tech…
07/04/2016 @danielbryantuk
17. Microservices...
They solve all of our problems, Right?
(If you have silver bullets, watch out for the werewolves)
07/04/2016 @danielbryantuk
18. No... Not necessarily good for speed
07/04/2016 @danielbryantuk
skillsmatter.com/skillscasts/6143-microservices-for-speed
Additional Reading!!
martinfowler.com/bliki/
MonolithFirst.html
19. 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
20. No... Check your architecture/design skills
07/04/2016 @danielbryantuk
21. No... Operational maturity is vital
07/04/2016 @danielbryantuk
martinfowler.com/bliki/MicroservicePrerequisites.html
22. Microservices are very useful
But check your use case...
...Evaluation is a key skill
07/04/2016 @danielbryantuk
23. 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
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
26. 2. GLUTTONY - Excessive Communication PROTOCOLS
07/04/2016 @danielbryantuk
27. 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
28. Enterprise communication (Beam me 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 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
31. 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
33. Technical problems are often 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 Telling the Truth... Deal with it!
07/04/2016 @danielbryantuk
36. Final Thoughts for the organisation
Can your business team take advantage of microservices?
07/04/2016 @danielbryantuk
37. Inspiration (for the business)
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 Services Independently?
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 Services Independently?
• Schema-first design
– Michael Bryzek (Gilt): APIdoc
• Consumer-driven Contracts FTW
– Martin Fowler: CDC - A Service Evolution Pattern
07/04/2016 @danielbryantuk
41. 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
42. 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
43. 5. WRATH - Blowing up when bad things happen
07/04/2016 @danielbryantuk
44. Bring in Michael Nygard (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
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
49. “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
50. 6. ENVY - The shared SINGLE domain fallacy
07/04/2016 @danielbryantuk
51. 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
52. But... how do I 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 surprisingly quiet about this...
07/04/2016 @danielbryantuk
martinfowler.com/articles/microservice-testing/
55. Testing With Microservices is Difficult...
• Invest in your build pipeline testing
– Serenity BDD
– Hoverfly & Wiremock / Saboteur
– Jenkins Performance plugin
07/04/2016 @danielbryantuk
56. Testing With Microservices is 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