Download - Micro Service Architecture
![Page 1: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/1.jpg)
Service Architectureµ
![Page 3: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/3.jpg)
Agenda
• Anatomy of a micro service• Micro service architecture by
example• The Good Parts of the solution• Tooling• Q&A
![Page 4: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/4.jpg)
Anatomy of a micro service
![Page 5: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/5.jpg)
Micro services are tiny apps talking via uniform interface
installed as well-behaved OS services.
![Page 6: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/6.jpg)
java –jar micro-service.jar config.yml
![Page 7: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/7.jpg)
![Page 8: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/8.jpg)
Traditional application vs. µ service based
![Page 9: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/9.jpg)
Micro service architecture by example
![Page 10: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/10.jpg)
Dropwizard
• Jetty
• Jersey
• Jackson
• Metrics
• Guava
• Joda Time
• Hibernate Validator
• LiquiBase
• YAML configuration
• Graceful shutdown
• Command-line API
Foundation for production ready micro services developed by
Dropwizard on InfoQ goo.gl/2RYALb
![Page 11: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/11.jpg)
Command-line API?
unrecognized argument '--tpye'Did you mean: --type
![Page 12: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/12.jpg)
Internal Loan Underwriting System
Requirement №1
Perform underwriting according to rules
specified in DSL and store decisions in
relational DB.
![Page 13: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/13.jpg)
“…according to rules specified in DSL
DSL hero is…
![Page 14: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/14.jpg)
RDB hero is…
“…and store decisions in Relational DB
![Page 15: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/15.jpg)
Underwriter
Relational DB
RESTful API / JSON
![Page 16: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/16.jpg)
Internal Loan Underwriting System
Requirement №2
Fancy back-office application that allows users to
perform underwriting and look over decisions.
Why separate micro service?
• Back-office is a regular client. Many still to come.
• Back-office is stateful
• Back-office is server-centric, no JavaScript
experience
• Independent coding, testing & deployment
![Page 17: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/17.jpg)
“…fancy back-office application
Fancy UI hero
is…
…because it’s Java conference
![Page 18: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/18.jpg)
Underwriter
Relational DB
Back-Office
![Page 19: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/19.jpg)
Internal Loan Underwriting System
Requirement №3
Collect credit history from various 3rd party
providers in parallel.
Why separate micro service?
• SRP!
• We have a team of Scala enthusiasts
• Operations must self-heal in case of failure –
Akka
• Independent coding, testing & deployment
![Page 20: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/20.jpg)
Underwriter
Relational DB
Back-Office
Credit History Collector
![Page 21: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/21.jpg)
Internal Loan Underwriting System
Requirement №4
Project codename «CHNAPI» - API for our brand new
partner «Chuck Norris».
Why separate micro service?
• Public service must run in DMZ
• Huge number of requests – queuing is a must
• Underwriter is not ready to scale – other dev
priorities
• We don’t know what kind of architecture to apply
yet
![Page 22: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/22.jpg)
Underwriter & CHNAPI Gateway integration
• Push can cause overload• What if Underwriter is down?
Underwriter CHNAPIGateway?
HTTPUnderwriter CHNAPI
Gateway
• More elements in chain• How well does it scale?
JMSUnderwriter CHNAPIGateway
• CHNAPI exposes Feed• Underwriter polls CHNAPI
for updates
Underwriter CHNAPIGateway
HTTP Polling
![Page 23: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/23.jpg)
Underwriter CHNAPIGateway
HTTP Polling
CHNAPIGateway
CHNAPIGateway
Load Balance
r
Load Balancer
DMZ
CHNAPI Gateway
JSON feed, OData or custom-crafted
Any JSON storage, e.g. MongoDB
![Page 24: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/24.jpg)
CHNAPI Gateway
Underwriter
Relational DB
Back-Office
Credit History Collector
MongoDB
![Page 25: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/25.jpg)
Internal Loan Underwriting System
Requirement №5
Chuck Norris is interested in all underwriting
decisions. Project codename «CHNORR».
Why separate micro service?
• Daily reporting, during active working hours
• External Client API with a tail of transitive
dependencies
• Neightbor dev team would like to use CHNORR!
![Page 26: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/26.jpg)
Underwriter CHNORR
CHNORR
CHNORR
DMZ
CHNORR
Load Balancer
Events
Spring Batch
Any storage for keeping data in reporting-friendly format
HTTP
![Page 27: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/27.jpg)
CHNAPI Gateway
Underwriter
Relational DB
Back-Office
Credit History Collector
MongoDB
CHNORR
MongoDB
![Page 28: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/28.jpg)
The Good Parts of the solution
![Page 29: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/29.jpg)
Toolset unchained
• Architectural approaches
• Polyglot• Storages
• Frameworks
![Page 30: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/30.jpg)
Scalability
• HTTP stack• Independent
provisioning• Fine tuning
• Elasticity
![Page 31: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/31.jpg)
Independence
• Development• Testing
• Deployment
![Page 32: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/32.jpg)
How to deploy in a proper order?
Supply Dependency Descriptor
with each micro service. For example:
depend.yaml for foo-service
dependencies:group: com.microservicesartifact: bar-serviceversion: 2.x.x
-
![Page 33: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/33.jpg)
How to deploy in a proper order?
We can forbid deployment in the wrong
order by validating dependencies on
Pipeline2.0.0
Test Prodbar-service
1.0.0
foo-service
Test Prod
1.9.0
bar-service
1.0.0
foo-service
![Page 34: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/34.jpg)
How to develop?
Together with Dependency Descriptor
(DD), put Vagrant file with DD-fed
provisioner in a root source directory.
- depend.yaml
- Vagrantfileup
Launch app with test doubles in place of real dependencies
![Page 35: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/35.jpg)
How to test?
For every dependency create a test
double
App
Foo
Bar Qux
Production
HTTP App
Foo-TD
Bar-TD
Testing
HTTP
Never mock internals. Mock externals
instead.
![Page 36: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/36.jpg)
![Page 37: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/37.jpg)
Tooling
![Page 38: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/38.jpg)
Testing & Live Doc
• MOCO for test double creation
• REST-assured for testing REST APIs
• Cucumber for describing API usage with examples
• Relish for publishing Cucumbers online
![Page 39: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/39.jpg)
![Page 40: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/40.jpg)
![Page 41: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/41.jpg)
![Page 42: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/42.jpg)
A shipping container system for your apps
VM without an overhead of VM
Docker on InfoQ http://goo.gl/ALnjYt
Why Docker? Why Not Chef? goo.gl/iJ8Idl
![Page 43: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/43.jpg)
Learn more • Micro Services by James Lewis goo.gl/PS7BYK
• Micro Services by Fred George goo.gl/dgd8Ya
![Page 44: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/44.jpg)
http://goo.gl/khddl
![Page 45: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/45.jpg)
Conclusion
![Page 46: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/46.jpg)
The next morning, "we had this orgy of `one liners.' Everybody had a one liner. Look at this, look at that. ...Everybody started putting forth the UNIX philosophy. Write programs that do one thing and do it well. Write programs to work together. Write programs that handle text streams, because that is a universal interface." Those ideas which add up to the tool approach, were there in some unformed way before pipes, but they really came together afterwards. Pipes became the catalyst for this UNIX philosophy. "The tool thing has turned out to be actually successful. With pipes, many programs could work together, and they could work together at a distance."
The Unix Philosophy http://www.faqs.org/docs/artu/ch01s06.html
The next morning, "we had this orgy of `one liners.' Everybody had a one liner. Look at this, look at that. ...Everybody started putting forth the UNIX philosophy. Write programs that do one thing and do it well. Write programs to work together. Write programs that handle text streams, because that is a universal interface." Those ideas which add up to the tool approach, were there in some unformed way before pipes, but they really came together afterwards. Pipes became the catalyst for this UNIX philosophy. "The tool thing has turned out to be actually successful. With pipes, many programs could work together, and they could work together at a distance."
The next morning, "we had this orgy of `one liners.' Everybody had a one liner. Look at this, look at that. ...Everybody started putting forth the UNIX philosophy. Write programs that do one thing and do it well. Write programs to work together. Write programs that handle text streams, because that is a universal interface." Those ideas which add up to the tool approach, were there in some unformed way before pipes, but they really came together afterwards. Pipes became the catalyst for this UNIX philosophy. "The tool thing has turned out to be actually successful. With pipes, many programs could work together, and they could work together at a distance."
The next morning, "we had this orgy of `one liners.' Everybody had a one liner. Look at this, look at that. ...Everybody started putting forth the UNIX philosophy. Write programs that do one thing and do it well. Write programs to work together. Write programs that handle text streams, because that is a universal interface." Those ideas which add up to the tool approach, were there in some unformed way before pipes, but they really came together afterwards. Pipes became the catalyst for this UNIX philosophy. "The tool thing has turned out to be actually successful. With pipes, many programs could work together, and they could work together at a distance."
The next morning, "we had this orgy of `one liners.' Everybody had a one liner. Look at this, look at that. ...Everybody started putting forth the UNIX philosophy. Write programs that do one thing and do it well. Write programs to work together. Write programs that handle text streams, because that is a universal interface." Those ideas which add up to the tool approach, were there in some unformed way before pipes, but they really came together afterwards. Pipes became the catalyst for this UNIX philosophy. "The tool thing has turned out to be actually successful. With pipes, many programs could work together, and they could work together at a distance."
![Page 47: Micro Service Architecture](https://reader036.vdocuments.site/reader036/viewer/2022062617/54b715044a7959a2718b45a6/html5/thumbnails/47.jpg)
THANK YOU!