Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
“So, ihr macht dann mal Microservices!”
Und nu?
André Goliath
(English slide deck for a german title, because why not)
Disclaimer
Everything in this talk is based on experiences…
… from my current project
… from other projects I worked on
… ...
Spoiler:
That´s not how it works.
Before we start:
What are we actually talking about?
What is a microservice?
A microservice is not…
… something with X lines of code.
A microservice is not…
… your monolith cut into pieces.
(Well, maybe it is, if it was a good one.)
(But most likely not.)
A microservice is not…
… the cure to all your pain.
Anyway, let´s start coding!
Microservices are not about code.
They are about functional domains.
(Bummer, I know.)
Designing a microservice landscape
is all about bounded contexts
and domain driven design.
https://www.infoq.com/minibooks...
Loose Frontend Integration
Accounts
CustomerManagement
CreditCardManagement
One Microservice represents
one domain.
Domain...
Big Pile of HTML
Accounts
Big Pile of Data
CustomerManagement
CreditCardManagement
You are not doing it right if your micr...
Okay, okay, got it. Domain first.
So we can code now, right?
Yes, but know what you are doing!
Spring Boot can be scary!
(and sometimes somewhat frustrating)
Get to know it.
Understand auto configuration
C:exampletarget>java -jar demo-0.0.1-SNAPSHOT.jar –debug
…
2017-03-26 13:54:24.371 DEBUG 5316 --- [ main]
AutoConfiguratio...
Auto Configuration Test Questions
• What does @EnableAutoConfiguration do?
• What is the purpose of spring.factories files...
Read the release notes!
There WILL be breaking changes
going from 1.x to 1.y
shamelessly copy&pasted from
https://github.com/spring-projects/spring-boot/wiki/spring-boot-1.3-release-notes
Now you´ve got 1 Microservice.
How about 2? Or 100?
1) Code sharing
2) Communication
3) Ops & Deployment
4) Compliance, Processes, Team Setup
1)
Code Sharing
sharing is caring
Share framework code, nothing else.
Share framework code, nothing else.
If you have no regrets
about sharing your code
on github, it is probably
framework code
Share framework code, nothing else.
Filter (security, logging, monitoring,…)
Error handling
Profile / Environment configur...
2)
Communication
Blah, blah, blah, blah…
There are (at least) 2 different kinds
of communication going on
Client  Microservice Communication
REST, but how?
HATEOAS yes/no/maybe?
One API for all clients?
Customer Search Card Management Account Management
„Backend“ Microservices
Mobile App Online Banking Branch
Actual Fronten...
Customer Search Card Management Account Management
„Backend“ Microservices
Mobile App Online Banking Branch
Actual Fronten...
Customer Search Card Management Account Management
„Backend“ Microservices
Mobile App
BFF Service
Online Banking
BFF Servi...
Microservice  Microservice Communication
REST will usually work.
But many use cases profit
from asynchronous messaging.
(...
3)
Ops and Deployment
Keep in mind:
Microservices make devs’ life a lot easier,
but will make ops’ life much more difficult.
Keep in mind:
Microservices make devs’ life a lot easier,
but will make ops’ life much more difficult.
TALK TO THEM. EARLY...
The three golden rules
of microservice deployments
(In my opinion. Don´t ask for scientific proof.)
1) Build once, run everywhere.
Build once, run everywhere.
A microservice JAR file is built exactly once
and then never touched again.
Good
java –jar ser...
2) Use the same tools. Everywhere.
Use the same tools. Everywhere.
Development, test, production. Everywhere.
Use the same tools. Everywhere.
Development, test, production. Everywhere.
no can do
in
Production
“You can not use the same software tools and
infrastructure components in test and production.”
– No regulatory body, neve...
Developer
Jenkins / Ansible / PaaS / …
Development / Test Environment
Service
Host A
Service
Host B
Config
Server
Ops Guy
...
3) if it hurts, do it more often.
You’ve heard that one before?
SCRUM feedback cycles maybe?
if it hurts, do it more often.
The most important steps of a delivery pipeline
should be based on the most tested and
bull...
That´s hardly the case
if you deploy to production only twice a year
and use production-only scripts for that.
if it hurts...
4)
Compliance, Processes, Team Setup
Strong, the dark side is with this one...
Very specific to your individual setting.
Here are two general tips though.
1)
Don´t let the word ‘Compliance’ stop you
from taking the first steps to revamp
your software delivery process.
2)
The company needs to work vertically,
not horizontally.
Team „Business“
Team „Frontend Developer“
Team „Middleware Developer“
Team „Database and Backend Gurus“
Credits Online Cha...
Team „Credit“
Domain Experts
Domain Experts
Frontend Frontend
Tester
Tester
Backend
Backend
Teaming up along domain
expert...
Team „Credit“
Domain Experts
Domain Experts
Frontend
Tester
Tester
Backend
Backend
Still, Tech Experts
need to be aware
of...
Key Takeaways
A microservice is defined by a Bounded Context,
not by anything else.
Know your Spring Boot (or whatever else you use).
Bu...
Thank You!
André Goliath
andre.goliath@senacor.de
https://www.slideshare.net/andregoliath
https://blog.senacor.com/author/...
Javaland 2017: "You´ll do microservices now". Now what?
Javaland 2017: "You´ll do microservices now". Now what?
Javaland 2017: "You´ll do microservices now". Now what?
Upcoming SlideShare
Loading in …5
×

Javaland 2017: "You´ll do microservices now". Now what?

242 views

Published on

The slides for my talk at JavaLand 2017. Note: The slides are in english, only the title is german. The talk is all about do's and dont's in microservice landscapes.

Published in: Technology
  • Be the first to comment

Javaland 2017: "You´ll do microservices now". Now what?

  1. 1. “So, ihr macht dann mal Microservices!” Und nu? André Goliath (English slide deck for a german title, because why not)
  2. 2. Disclaimer Everything in this talk is based on experiences… … from my current project … from other projects I worked on … from other colleagues’ projects … from other smart people About me? Full-Stack Dev. since around 2006. But basically just a guy that worked on and discussed a lot about microservices.
  3. 3. Spoiler: That´s not how it works.
  4. 4. Before we start: What are we actually talking about? What is a microservice?
  5. 5. A microservice is not… … something with X lines of code.
  6. 6. A microservice is not… … your monolith cut into pieces. (Well, maybe it is, if it was a good one.) (But most likely not.)
  7. 7. A microservice is not… … the cure to all your pain.
  8. 8. Anyway, let´s start coding!
  9. 9. Microservices are not about code. They are about functional domains. (Bummer, I know.)
  10. 10. Designing a microservice landscape is all about bounded contexts and domain driven design. https://www.infoq.com/minibooks/domain-driven-design-quickly
  11. 11. Loose Frontend Integration Accounts CustomerManagement CreditCardManagement One Microservice represents one domain. Domains are technically separated all the way from the Frontend to the Backend. The concept of ‘microservices’ is only the first step in the right direction. Eventually we want to achieve truly Self Contained Systems. Messaging / Data Sync.
  12. 12. Big Pile of HTML Accounts Big Pile of Data CustomerManagement CreditCardManagement You are not doing it right if your microservices somewhat represent bounded contexts, but everything above and below is shared and tightly coupled. Things WILL break. Please read up on domain driven design before doing microservices. Legacy Backends are no excuse.
  13. 13. Okay, okay, got it. Domain first. So we can code now, right?
  14. 14. Yes, but know what you are doing!
  15. 15. Spring Boot can be scary! (and sometimes somewhat frustrating) Get to know it.
  16. 16. Understand auto configuration
  17. 17. C:exampletarget>java -jar demo-0.0.1-SNAPSHOT.jar –debug … 2017-03-26 13:54:24.371 DEBUG 5316 --- [ main] AutoConfigurationReportLoggingInitializer : ========================= AUTO-CONFIGURATION REPORT ========================= Positive matches: ----------------- DispatcherServletAutoConfiguration matched: - @ConditionalOnClass found required class 'org.springframework.web.servlet.DispatcherServlet'; @ConditionalOnMissingClass did not find unwanted class (OnClassCondition) - @ConditionalOnWebApplication (required) found StandardServletEnvironment (OnWebApplicationCondition) … Negative matches: ----------------- ActiveMQAutoConfiguration: Did not match: - @ConditionalOnClass did not find required classes 'javax.jms.ConnectionFactory', 'org.apache.activemq.ActiveMQConnectionFactory' (OnClassCondition)
  18. 18. Auto Configuration Test Questions • What does @EnableAutoConfiguration do? • What is the purpose of spring.factories files? • How would you replace the standard Spring Boot error page?  Try to solve this without looking up the docs, dive right into org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration
  19. 19. Read the release notes! There WILL be breaking changes going from 1.x to 1.y
  20. 20. shamelessly copy&pasted from https://github.com/spring-projects/spring-boot/wiki/spring-boot-1.3-release-notes
  21. 21. Now you´ve got 1 Microservice. How about 2? Or 100?
  22. 22. 1) Code sharing 2) Communication 3) Ops & Deployment 4) Compliance, Processes, Team Setup
  23. 23. 1) Code Sharing sharing is caring
  24. 24. Share framework code, nothing else.
  25. 25. Share framework code, nothing else. If you have no regrets about sharing your code on github, it is probably framework code
  26. 26. Share framework code, nothing else. Filter (security, logging, monitoring,…) Error handling Profile / Environment configuration Logging configuration Common documentation If you have no regrets about sharing your code on github, it is probably framework code
  27. 27. 2) Communication Blah, blah, blah, blah…
  28. 28. There are (at least) 2 different kinds of communication going on
  29. 29. Client  Microservice Communication REST, but how? HATEOAS yes/no/maybe? One API for all clients?
  30. 30. Customer Search Card Management Account Management „Backend“ Microservices Mobile App Online Banking Branch Actual Frontends
  31. 31. Customer Search Card Management Account Management „Backend“ Microservices Mobile App Online Banking Branch Actual Frontends „API Gateway“ / „BFF (Backend For Frontend)“ Microservices Mobile App BFF Service Online Banking BFF Service Branch BFF Service
  32. 32. Customer Search Card Management Account Management „Backend“ Microservices Mobile App BFF Service Online Banking BFF Service Branch BFF Service Mobile App Online Banking Branch Actual Frontends „API Gateway“ / „BFF (Backend For Frontend)“ Microservices Data Tailoring HATEOAS Links Service Orchestration Clientspecific Security
  33. 33. Microservice  Microservice Communication REST will usually work. But many use cases profit from asynchronous messaging. (Just talk to one of the ‘reactive’ experts)
  34. 34. 3) Ops and Deployment
  35. 35. Keep in mind: Microservices make devs’ life a lot easier, but will make ops’ life much more difficult.
  36. 36. Keep in mind: Microservices make devs’ life a lot easier, but will make ops’ life much more difficult. TALK TO THEM. EARLY. OFTEN. THEY ARE YOUR FRIENDS.
  37. 37. The three golden rules of microservice deployments (In my opinion. Don´t ask for scientific proof.)
  38. 38. 1) Build once, run everywhere.
  39. 39. Build once, run everywhere. A microservice JAR file is built exactly once and then never touched again. Good java –jar service.jar –spring.profiles.active=“production” Bad mvn clean install spring-boot:repackage -P “production”
  40. 40. 2) Use the same tools. Everywhere.
  41. 41. Use the same tools. Everywhere. Development, test, production. Everywhere.
  42. 42. Use the same tools. Everywhere. Development, test, production. Everywhere. no can do in Production
  43. 43. “You can not use the same software tools and infrastructure components in test and production.” – No regulatory body, never.
  44. 44. Developer Jenkins / Ansible / PaaS / … Development / Test Environment Service Host A Service Host B Config Server Ops Guy Production Environment Gateway Jenkins / Ansible / PaaS / … Service Host A Service Host B Config Server Use a gateway if you need to. “You can not use the same software tools and infrastructure components in test and production.” – No regulatory body, never. Note: This has nothing to do with DevOps*. *) DevOps is helpful, but by no means required. Nevertheless, Dev and Ops need to talk.
  45. 45. 3) if it hurts, do it more often. You’ve heard that one before? SCRUM feedback cycles maybe?
  46. 46. if it hurts, do it more often. The most important steps of a delivery pipeline should be based on the most tested and bullet-proof processes and tools.
  47. 47. That´s hardly the case if you deploy to production only twice a year and use production-only scripts for that. if it hurts, do it more often. The most important steps of a delivery pipeline should be based on the most tested and bullet-proof processes and tools.
  48. 48. 4) Compliance, Processes, Team Setup Strong, the dark side is with this one...
  49. 49. Very specific to your individual setting. Here are two general tips though.
  50. 50. 1) Don´t let the word ‘Compliance’ stop you from taking the first steps to revamp your software delivery process.
  51. 51. 2) The company needs to work vertically, not horizontally.
  52. 52. Team „Business“ Team „Frontend Developer“ Team „Middleware Developer“ Team „Database and Backend Gurus“ Credits Online Channels Internal Online JEE COBOL COBOL DB Admins Teaming up along technology antagonizes a domain driven software architecture. (Ever heard of Conway’s law?)
  53. 53. Team „Credit“ Domain Experts Domain Experts Frontend Frontend Tester Tester Backend Backend Teaming up along domain expertise makes Domain Driven Development much easier. Team „Account“
  54. 54. Team „Credit“ Domain Experts Domain Experts Frontend Tester Tester Backend Backend Still, Tech Experts need to be aware of each other. But it remains a “Domain First” organization. Team „Account“ Frontend
  55. 55. Key Takeaways
  56. 56. A microservice is defined by a Bounded Context, not by anything else. Know your Spring Boot (or whatever else you use). Build once, run everywhere. Use the same tools. Everywhere. if it hurts, do it more often. Don’t let ‘Compliance’ stop you. Only vertical teams will succeed.
  57. 57. Thank You! André Goliath andre.goliath@senacor.de https://www.slideshare.net/andregoliath https://blog.senacor.com/author/andre/

×