SlideShare a Scribd company logo
@crichardson 
Developing applications 
with a microservice 
architecture 
Chris Richardson 
Author of POJOs in Action 
Founder of the original CloudFoundry.com 
@crichardson 
chris@chrisrichardson.net 
http://plainoldobjects.com
Presentation goal 
How decomposing applications into 
@crichardson 
microservices 
improves deployability and scalability 
and 
simplifies the adoption of new 
technologies
@crichardson 
About Chris
@crichardson 
About Chris
@crichardson 
About Chris 
Founder of a buzzword compliant (stealthy, social, mobile, 
big data, machine learning, ...) startup 
Consultant helping organizations improve how they 
architect and deploy applications using cloud computing, 
micro services, polyglot applications, NoSQL, ...
@crichardson 
Agenda 
The (sometimes evil) monolith 
Decomposing applications into services 
Using an API gateway 
Inter-service communication mechanisms
@crichardson 
Let’s imagine you are 
building an online store
@crichardson 
Traditional application 
architecture 
StoreFrontUI 
Product Info 
Service 
Recommendation 
Service 
Tomcat 
Browser/ 
Client 
WAR/EAR 
MySQL 
Database 
Review Service 
Simple to 
develop 
test 
deploy 
Load 
balancer 
scale 
Spring MVC 
Spring 
Hibernate 
Order Service 
HTML 
REST/JSON
@crichardson 
But big, complex, monolithic 
applications 
⇒ 
big problems
@crichardson 
Intimidates developers
@crichardson 
Obstacle to frequent 
deployments 
Need to redeploy everything to change one component 
Interrupts long running background (e.g. Quartz) jobs 
Increases risk of failure 
Fear of change 
Updates will happen less often - really long QA cycles 
e.g. Makes A/B testing UI really difficult 
Eggs in 
one basket
@crichardson 
Overloads your IDE and 
container 
Slows down development
@crichardson 
Obstacle to scaling 
development 
I want 
to update the UI 
But 
the backend is not working 
yet! 
Lots of coordination and 
communication required
Requires long-term commitment 
to a technology stack 
@crichardson
@crichardson 
Agenda 
The (sometimes evil) monolith 
Decomposing applications into services 
Using an API gateway 
Inter-service communication mechanisms
@crichardson
@crichardson 
The scale cube 
X axis 
- horizontal duplication 
Z axis - data partitioning 
Y axis - 
functional 
decomposition 
similar 
splitting by things 
Scale Scale by 
splitting 
different things
@crichardson 
Y-axis scaling - application level 
WAR 
Storefront UI 
Product Info 
Service 
Recommendation 
Service 
Review 
Service 
Order 
Service
@crichardson 
Y-axis scaling - application level 
Storefront UI 
Product Info 
Service 
Recommendation 
Service 
Review 
Service 
Order 
Service
@crichardson 
Y-axis scaling - application level 
Product Info 
Service 
Product Info 
Recommendation 
Service 
Review 
Service 
Order 
Service 
Browse Products 
UI 
Checkout UI 
Order management 
UI 
Account 
management UI 
Apply X-axis and Z-axis scaling 
to each service independently
Service deployment options 
@crichardson 
Isolation, manageability 
VM or Physical Machine 
Docker/Linux container 
JVM 
JAR/WAR/OSGI bundle/... 
Density/efficiency
@crichardson 
Partitioning strategies... 
Partition by noun, e.g. product info service 
Partition by verb, e.g. Checkout UI 
Single Responsibility Principle 
Unix utilities - do one focussed thing well
@crichardson 
Partitioning strategies 
Too few 
Drawbacks of the monolithic architecture 
Too many - a.k.a. Nano-service anti-pattern 
Runtime overhead 
Potential risk of excessive network hops 
Potentially difficult to understand system 
Something of an art
@crichardson 
Example micro-service 
require 'sinatra' 
post '/' do 
phone_number = params[:From] 
registration_url = "#{ENV['REGISTRATION_URL']}?phoneNumber=#{URI.encode(phone_number, "+")}" 
<<-eof 
<Response> 
<Sms>To complete registration please go to #{registration_url}</Sms> 
</Response> 
eof 
end 
Responds to incoming SMS messages 
via Twilio
@crichardson 
More service, less micro 
But more realistically... 
Focus on building services that make 
development and deployment easier 
- not just tiny services
@crichardson 
Real world examples 
http://techblog.netflix.com/ 
~600 services 
http://highscalability.com/amazon-architecture 
100-150 services to build a page 
http://www.addsimplicity.com/downloads/ 
eBaySDForum2006-11-29.pdf 
http://queue.acm.org/detail.cfm?id=1394128
@crichardson 
There are many benefits
@crichardson 
Smaller, simpler apps 
Easier to understand and develop 
Less jar/classpath hell - who needs OSGI? 
Faster to build and deploy 
Reduced startup time - important for GAE
Scales development: 
develop, deploy and scale 
each service independently 
@crichardson
@crichardson 
Improves fault isolation
Eliminates long-term commitment 
to a single technology stack 
@crichardson 
Modular, polyglot, multi-framework 
applications
@crichardson 
Two levels of architecture 
System-level 
Services 
Inter-service glue: interfaces and communication mechanisms 
Slow changing 
Service-level 
Internal architecture of each service 
Each service could use a different technology stack 
Pick the best tool for the job 
Rapidly evolving
Easily try other technologies 
@crichardson 
... and fail safely
But there are drawbacks 
@crichardson
@crichardson 
Complexity
Complexity of developing a 
@crichardson 
distributed system 
http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html
@crichardson 
Multiple databases 
& 
Transaction management 
e.g. Fun with eventual consistency 
Come to my 11.30 am talk
@crichardson 
Complexity of testing a 
distributed system 
http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html
Complexity of deploying and 
operating a distributed 
@crichardson 
system 
http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html 
You need a lot of automation
@crichardson 
Developing and deploying 
features that span multiple 
services requires careful 
coordination
@crichardson 
When to use it? 
In the beginning: 
•You don’t need it 
•It will slow you down 
Later on: 
•You need it 
•Refactoring is painful
@crichardson 
Agenda 
The (sometimes evil) monolith 
Decomposing applications into services 
Using an API gateway 
Inter-service communication mechanisms
Let’s imagine that you want to 
display a product’s details... 
Product 
Info Reviews 
Recommendations 
@crichardson
Directly connecting the front-end to the backend 
@crichardson 
View Controller 
Model 
Product Info 
service 
Recommendation 
Service 
Review 
service 
REST 
REST 
Thrift 
Traditional server-side 
web application 
View Controller 
Model 
Browser/Native App 
Chatty API 
Web unfriendly 
protocols
@crichardson 
Use an API gateway 
View Controller 
Model 
Product Info 
service 
Recommendation 
Service 
Review 
service 
REST 
REST 
Thrift 
API 
Gateway 
View Controller 
Model 
Browser/Native App 
Single entry point 
Client 
specific APIs 
Protocol 
translation 
Traditional server-side 
web application
@crichardson 
Optimized client-specific 
APIs 
Web 
application 
Mobile 
App 
NodeJS 
API 
Gateway 
REST 
proxy 
Event 
publishing 
Product Info 
service 
Recommendation 
Service 
Review 
service 
REST 
REST 
Thrift 
getProductInfo() 
getRecomm...() 
getReviews() 
getProductDetails()
@crichardson 
Netflix API Gateway 
http://techblog.netflix.com/2013/01/optimizing-netflix-api.html 
Device specific 
end points
@crichardson 
API gateway design 
challenges 
Performance and scalability 
Non-blocking I/O 
Asynchronous, concurrent code 
Handling partial failures 
.... 
http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
@crichardson 
Useful frameworks for 
building an API gateway 
JVM: 
Netty, Vertex 
Netflix Hystrix 
... 
Other: 
NodeJS
@crichardson 
Agenda 
The (sometimes evil) monolith 
Decomposing applications into services 
Using an API gateway 
Inter-service communication mechanisms
Inter-service communication 
options 
@crichardson 
Synchronous HTTP ⇔ asynchronous AMQP 
Formats: JSON, XML, Protocol Buffers, Thrift, ... 
Asynchronous is preferred 
JSON is fashionable but binary format 
is more efficient
Pros and cons of messaging 
Pros 
Cons 
Decouples client from 
Additional complexity of 
server 
message broker 
Message broker buffers 
Request/reply-style 
messages 
communication is more 
Supports a variety of 
complex 
communication patterns
Pros and cons of HTTP 
Pros 
Simple and familiar 
Request/reply is easy 
Firewall friendly 
No intermediate broker 
Cons 
Only supports request/ 
reply 
Server must be 
available 
Client needs to 
discover URL(s) of 
server(s)
@crichardson 
Discovery option #1: 
Internal load balancer 
Load 
Balancer 
Product Info 
Service 
Product Info 
Service 
Product Info 
Service 
Product Info 
Service 
Client/ 
API gateway 
Services register 
with load balancer 
Client talks to 
load balancer 
Has a well-known 
location 
http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/USVPC_creating_basic_lb.html
@crichardson 
Discovery option #2: 
client-side load balancing 
REST 
Client 
Product Info 
Service 
Product Info 
Service 
Product Info 
Service 
Product Info 
Service 
Client 
Service 
Registry 
Services register 
with registry 
Client polls 
registry 
http://techblog.netflix.com/2013/01/announcing-ribbon-tying-netflix-mid.html 
http://techblog.netflix.com/2012/09/eureka.html
@crichardson 
Lots of moving parts! 
PProrodducutc tIn Ifnofo 
Service 
Recommendation 
Service 
Review 
Service 
Order 
Service 
Browse Products UI 
Checkout UI 
Order management 
UI 
Account 
management UI 
API 
Gate 
way 
Service registry 
Content 
Router 
HTML 
Browser 
REST 
Client 
Ext. 
LB 
Ext. 
LB
@crichardson 
Summary
Monolithic applications are 
simple to develop and deploy 
@crichardson 
BUT have significant 
drawbacks
@crichardson 
Apply the scale cube 
Modular, polyglot, and 
scalable applications 
Services developed, 
deployed and scaled 
independently
Use a modular, polyglot architecture 
View Controller Product Info 
@crichardson 
Model 
service 
Recommendation 
Service 
Review 
service 
REST 
REST 
AMQP 
API 
Gateway 
Server-side web 
application 
View Controller 
Model 
Browser/Native 
application
@crichardson 
Start refactoring your 
monolith 
Monolith Anti-corruption Service 
layer 
Glue code 
Pristine
Come to my 11.30 am talk 
to learn more.... 
Building microservices 
with Scala, functional 
domain models and 
@crichardson 
Spring Boot
@crichardson chris@chrisrichardson.net 
@crichardson 
Questions? 
http://plainoldobjects.com http://microservices.io

More Related Content

What's hot (20)

PDF
There is no such thing as a microservice! (oracle code nyc)
Chris Richardson
 
PDF
A pattern language for microservices (melbourne)
Chris Richardson
 
PDF
QCONSF - ACID Is So Yesterday: Maintaining Data Consistency with Sagas
Chris Richardson
 
PDF
Building microservices with Scala, functional domain models and Spring Boot
Chris Richardson
 
PDF
Futures and Rx Observables: powerful abstractions for consuming web services ...
Chris Richardson
 
PDF
Designing loosely coupled services
Chris Richardson
 
PDF
Developing microservices with aggregates (melbourne)
Chris Richardson
 
PDF
GotoChgo 2019: Not Just Events: Developing Asynchronous Microservices
Chris Richardson
 
PDF
Oracle Code One: Events and commands: developing asynchronous microservices
Chris Richardson
 
PDF
OReilly SACON2018 - Events on the outside, on the inside, and at the core
Chris Richardson
 
PDF
ArchSummit Shenzhen - Using sagas to maintain data consistency in a microserv...
Chris Richardson
 
PDF
Events to the rescue: solving distributed data problems in a microservice arc...
Chris Richardson
 
PDF
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...
Chris Richardson
 
PDF
Developing microservices with aggregates (SpringOne platform, #s1p)
Chris Richardson
 
PDF
#hacksummit 2016 - event-driven microservices – Events on the outside, on the...
Chris Richardson
 
PDF
JavaOne2017: ACID Is So Yesterday: Maintaining Data Consistency with Sagas
Chris Richardson
 
PDF
NodeJS: the good parts? A skeptic’s view (jax jax2013)
Chris Richardson
 
PDF
Microservices in Java and Scala (sfscala)
Chris Richardson
 
PDF
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
Chris Richardson
 
PDF
Events on the outside, on the inside and at the core (jfokus jfokus2016)
Chris Richardson
 
There is no such thing as a microservice! (oracle code nyc)
Chris Richardson
 
A pattern language for microservices (melbourne)
Chris Richardson
 
QCONSF - ACID Is So Yesterday: Maintaining Data Consistency with Sagas
Chris Richardson
 
Building microservices with Scala, functional domain models and Spring Boot
Chris Richardson
 
Futures and Rx Observables: powerful abstractions for consuming web services ...
Chris Richardson
 
Designing loosely coupled services
Chris Richardson
 
Developing microservices with aggregates (melbourne)
Chris Richardson
 
GotoChgo 2019: Not Just Events: Developing Asynchronous Microservices
Chris Richardson
 
Oracle Code One: Events and commands: developing asynchronous microservices
Chris Richardson
 
OReilly SACON2018 - Events on the outside, on the inside, and at the core
Chris Richardson
 
ArchSummit Shenzhen - Using sagas to maintain data consistency in a microserv...
Chris Richardson
 
Events to the rescue: solving distributed data problems in a microservice arc...
Chris Richardson
 
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...
Chris Richardson
 
Developing microservices with aggregates (SpringOne platform, #s1p)
Chris Richardson
 
#hacksummit 2016 - event-driven microservices – Events on the outside, on the...
Chris Richardson
 
JavaOne2017: ACID Is So Yesterday: Maintaining Data Consistency with Sagas
Chris Richardson
 
NodeJS: the good parts? A skeptic’s view (jax jax2013)
Chris Richardson
 
Microservices in Java and Scala (sfscala)
Chris Richardson
 
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
Chris Richardson
 
Events on the outside, on the inside and at the core (jfokus jfokus2016)
Chris Richardson
 

Similar to #JaxLondon keynote: Developing applications with a microservice architecture (20)

PDF
Developing applications with a microservice architecture (svcc)
Chris Richardson
 
PDF
Developing applications with a microservice architecture (SVforum, microservi...
Chris Richardson
 
PDF
Microservices: Decomposing Applications for Deployability and Scalability (ja...
Chris Richardson
 
PDF
Decompose That WAR! Architecting for Adaptability, Scalability, and Deployabi...
Chris Richardson
 
PDF
Decompose That WAR! Architecting for Adaptability, Scalability, and Deployabi...
Chris Richardson
 
PDF
Introduction to MicroServices (Oakjug)
Chris Richardson
 
PDF
Decomposing applications for deployability and scalability(SpringSource webinar)
Chris Richardson
 
PDF
Microservices Architecture
Srinivasan Nanduri
 
PDF
JFokus: Cubes, Hexagons, Triangles, and More: Understanding Microservices
Chris Richardson
 
PPTX
Microservices architecture
Faren faren
 
PDF
SVCC Microservices: Decomposing Applications for Testability and Deployability
Chris Richardson
 
PDF
API’s and Micro Services 0.5
Richard Hudson
 
PDF
#ATAGTR2020 Presentation - Microservices – Explored
Agile Testing Alliance
 
PDF
Melbourne Jan 2019 - Microservices adoption anti-patterns: Obstacles to decom...
Chris Richardson
 
PDF
Building Microservices Software practics
muhammed84essa
 
PDF
Everything you want to know about microservices
Youness Lasmak
 
PPTX
05 microservices microdeck
fenggang wang
 
PDF
Kong Summit 2018 - Microservices: decomposing applications for testability an...
Chris Richardson
 
PDF
Microservices for Architects - Atlanta 2018-03-28
Derek Ashmore
 
PPTX
Architecting Microservices in .Net
Richard Banks
 
Developing applications with a microservice architecture (svcc)
Chris Richardson
 
Developing applications with a microservice architecture (SVforum, microservi...
Chris Richardson
 
Microservices: Decomposing Applications for Deployability and Scalability (ja...
Chris Richardson
 
Decompose That WAR! Architecting for Adaptability, Scalability, and Deployabi...
Chris Richardson
 
Decompose That WAR! Architecting for Adaptability, Scalability, and Deployabi...
Chris Richardson
 
Introduction to MicroServices (Oakjug)
Chris Richardson
 
Decomposing applications for deployability and scalability(SpringSource webinar)
Chris Richardson
 
Microservices Architecture
Srinivasan Nanduri
 
JFokus: Cubes, Hexagons, Triangles, and More: Understanding Microservices
Chris Richardson
 
Microservices architecture
Faren faren
 
SVCC Microservices: Decomposing Applications for Testability and Deployability
Chris Richardson
 
API’s and Micro Services 0.5
Richard Hudson
 
#ATAGTR2020 Presentation - Microservices – Explored
Agile Testing Alliance
 
Melbourne Jan 2019 - Microservices adoption anti-patterns: Obstacles to decom...
Chris Richardson
 
Building Microservices Software practics
muhammed84essa
 
Everything you want to know about microservices
Youness Lasmak
 
05 microservices microdeck
fenggang wang
 
Kong Summit 2018 - Microservices: decomposing applications for testability an...
Chris Richardson
 
Microservices for Architects - Atlanta 2018-03-28
Derek Ashmore
 
Architecting Microservices in .Net
Richard Banks
 
Ad

More from Chris Richardson (20)

PDF
The microservice architecture: what, why, when and how?
Chris Richardson
 
PDF
More the merrier: a microservices anti-pattern
Chris Richardson
 
PDF
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
Chris Richardson
 
PDF
Dark Energy, Dark Matter and the Microservices Patterns?!
Chris Richardson
 
PDF
Dark energy, dark matter and microservice architecture collaboration patterns
Chris Richardson
 
PDF
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
Chris Richardson
 
PDF
Using patterns and pattern languages to make better architectural decisions
Chris Richardson
 
PDF
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
Chris Richardson
 
PDF
A pattern language for microservices - June 2021
Chris Richardson
 
PDF
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Chris Richardson
 
PDF
Microservices - an architecture that enables DevOps (T Systems DevOps day)
Chris Richardson
 
PDF
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
Chris Richardson
 
PDF
Decompose your monolith: Six principles for refactoring a monolith to microse...
Chris Richardson
 
PDF
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
Chris Richardson
 
PDF
Overview of the Eventuate Tram Customers and Orders application
Chris Richardson
 
PDF
An overview of the Eventuate Platform
Chris Richardson
 
PDF
#DevNexus202 Decompose your monolith
Chris Richardson
 
PDF
Decompose your monolith: strategies for migrating to microservices (Tide)
Chris Richardson
 
PDF
Oracle CodeOne 2019: Decompose Your Monolith: Strategies for Migrating to Mic...
Chris Richardson
 
PDF
MicroCPH - Managing data consistency in a microservice architecture using Sagas
Chris Richardson
 
The microservice architecture: what, why, when and how?
Chris Richardson
 
More the merrier: a microservices anti-pattern
Chris Richardson
 
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
Chris Richardson
 
Dark Energy, Dark Matter and the Microservices Patterns?!
Chris Richardson
 
Dark energy, dark matter and microservice architecture collaboration patterns
Chris Richardson
 
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
Chris Richardson
 
Using patterns and pattern languages to make better architectural decisions
Chris Richardson
 
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
Chris Richardson
 
A pattern language for microservices - June 2021
Chris Richardson
 
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Chris Richardson
 
Microservices - an architecture that enables DevOps (T Systems DevOps day)
Chris Richardson
 
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
Chris Richardson
 
Decompose your monolith: Six principles for refactoring a monolith to microse...
Chris Richardson
 
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
Chris Richardson
 
Overview of the Eventuate Tram Customers and Orders application
Chris Richardson
 
An overview of the Eventuate Platform
Chris Richardson
 
#DevNexus202 Decompose your monolith
Chris Richardson
 
Decompose your monolith: strategies for migrating to microservices (Tide)
Chris Richardson
 
Oracle CodeOne 2019: Decompose Your Monolith: Strategies for Migrating to Mic...
Chris Richardson
 
MicroCPH - Managing data consistency in a microservice architecture using Sagas
Chris Richardson
 
Ad

Recently uploaded (20)

PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PPTX
Coefficient of Variance in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PPTX
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Adobe Premiere Pro Crack / Full Version / Free Download
hashhshs786
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
Add Background Images to Charts in IBM SPSS Statistics Version 31.pdf
Version 1 Analytics
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
Coefficient of Variance in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Adobe Premiere Pro Crack / Full Version / Free Download
hashhshs786
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Add Background Images to Charts in IBM SPSS Statistics Version 31.pdf
Version 1 Analytics
 

#JaxLondon keynote: Developing applications with a microservice architecture

  • 1. @crichardson Developing applications with a microservice architecture Chris Richardson Author of POJOs in Action Founder of the original CloudFoundry.com @crichardson [email protected] http://plainoldobjects.com
  • 2. Presentation goal How decomposing applications into @crichardson microservices improves deployability and scalability and simplifies the adoption of new technologies
  • 5. @crichardson About Chris Founder of a buzzword compliant (stealthy, social, mobile, big data, machine learning, ...) startup Consultant helping organizations improve how they architect and deploy applications using cloud computing, micro services, polyglot applications, NoSQL, ...
  • 6. @crichardson Agenda The (sometimes evil) monolith Decomposing applications into services Using an API gateway Inter-service communication mechanisms
  • 7. @crichardson Let’s imagine you are building an online store
  • 8. @crichardson Traditional application architecture StoreFrontUI Product Info Service Recommendation Service Tomcat Browser/ Client WAR/EAR MySQL Database Review Service Simple to develop test deploy Load balancer scale Spring MVC Spring Hibernate Order Service HTML REST/JSON
  • 9. @crichardson But big, complex, monolithic applications ⇒ big problems
  • 11. @crichardson Obstacle to frequent deployments Need to redeploy everything to change one component Interrupts long running background (e.g. Quartz) jobs Increases risk of failure Fear of change Updates will happen less often - really long QA cycles e.g. Makes A/B testing UI really difficult Eggs in one basket
  • 12. @crichardson Overloads your IDE and container Slows down development
  • 13. @crichardson Obstacle to scaling development I want to update the UI But the backend is not working yet! Lots of coordination and communication required
  • 14. Requires long-term commitment to a technology stack @crichardson
  • 15. @crichardson Agenda The (sometimes evil) monolith Decomposing applications into services Using an API gateway Inter-service communication mechanisms
  • 17. @crichardson The scale cube X axis - horizontal duplication Z axis - data partitioning Y axis - functional decomposition similar splitting by things Scale Scale by splitting different things
  • 18. @crichardson Y-axis scaling - application level WAR Storefront UI Product Info Service Recommendation Service Review Service Order Service
  • 19. @crichardson Y-axis scaling - application level Storefront UI Product Info Service Recommendation Service Review Service Order Service
  • 20. @crichardson Y-axis scaling - application level Product Info Service Product Info Recommendation Service Review Service Order Service Browse Products UI Checkout UI Order management UI Account management UI Apply X-axis and Z-axis scaling to each service independently
  • 21. Service deployment options @crichardson Isolation, manageability VM or Physical Machine Docker/Linux container JVM JAR/WAR/OSGI bundle/... Density/efficiency
  • 22. @crichardson Partitioning strategies... Partition by noun, e.g. product info service Partition by verb, e.g. Checkout UI Single Responsibility Principle Unix utilities - do one focussed thing well
  • 23. @crichardson Partitioning strategies Too few Drawbacks of the monolithic architecture Too many - a.k.a. Nano-service anti-pattern Runtime overhead Potential risk of excessive network hops Potentially difficult to understand system Something of an art
  • 24. @crichardson Example micro-service require 'sinatra' post '/' do phone_number = params[:From] registration_url = "#{ENV['REGISTRATION_URL']}?phoneNumber=#{URI.encode(phone_number, "+")}" <<-eof <Response> <Sms>To complete registration please go to #{registration_url}</Sms> </Response> eof end Responds to incoming SMS messages via Twilio
  • 25. @crichardson More service, less micro But more realistically... Focus on building services that make development and deployment easier - not just tiny services
  • 26. @crichardson Real world examples http://techblog.netflix.com/ ~600 services http://highscalability.com/amazon-architecture 100-150 services to build a page http://www.addsimplicity.com/downloads/ eBaySDForum2006-11-29.pdf http://queue.acm.org/detail.cfm?id=1394128
  • 27. @crichardson There are many benefits
  • 28. @crichardson Smaller, simpler apps Easier to understand and develop Less jar/classpath hell - who needs OSGI? Faster to build and deploy Reduced startup time - important for GAE
  • 29. Scales development: develop, deploy and scale each service independently @crichardson
  • 31. Eliminates long-term commitment to a single technology stack @crichardson Modular, polyglot, multi-framework applications
  • 32. @crichardson Two levels of architecture System-level Services Inter-service glue: interfaces and communication mechanisms Slow changing Service-level Internal architecture of each service Each service could use a different technology stack Pick the best tool for the job Rapidly evolving
  • 33. Easily try other technologies @crichardson ... and fail safely
  • 34. But there are drawbacks @crichardson
  • 36. Complexity of developing a @crichardson distributed system http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html
  • 37. @crichardson Multiple databases & Transaction management e.g. Fun with eventual consistency Come to my 11.30 am talk
  • 38. @crichardson Complexity of testing a distributed system http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html
  • 39. Complexity of deploying and operating a distributed @crichardson system http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html You need a lot of automation
  • 40. @crichardson Developing and deploying features that span multiple services requires careful coordination
  • 41. @crichardson When to use it? In the beginning: •You don’t need it •It will slow you down Later on: •You need it •Refactoring is painful
  • 42. @crichardson Agenda The (sometimes evil) monolith Decomposing applications into services Using an API gateway Inter-service communication mechanisms
  • 43. Let’s imagine that you want to display a product’s details... Product Info Reviews Recommendations @crichardson
  • 44. Directly connecting the front-end to the backend @crichardson View Controller Model Product Info service Recommendation Service Review service REST REST Thrift Traditional server-side web application View Controller Model Browser/Native App Chatty API Web unfriendly protocols
  • 45. @crichardson Use an API gateway View Controller Model Product Info service Recommendation Service Review service REST REST Thrift API Gateway View Controller Model Browser/Native App Single entry point Client specific APIs Protocol translation Traditional server-side web application
  • 46. @crichardson Optimized client-specific APIs Web application Mobile App NodeJS API Gateway REST proxy Event publishing Product Info service Recommendation Service Review service REST REST Thrift getProductInfo() getRecomm...() getReviews() getProductDetails()
  • 47. @crichardson Netflix API Gateway http://techblog.netflix.com/2013/01/optimizing-netflix-api.html Device specific end points
  • 48. @crichardson API gateway design challenges Performance and scalability Non-blocking I/O Asynchronous, concurrent code Handling partial failures .... http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
  • 49. @crichardson Useful frameworks for building an API gateway JVM: Netty, Vertex Netflix Hystrix ... Other: NodeJS
  • 50. @crichardson Agenda The (sometimes evil) monolith Decomposing applications into services Using an API gateway Inter-service communication mechanisms
  • 51. Inter-service communication options @crichardson Synchronous HTTP ⇔ asynchronous AMQP Formats: JSON, XML, Protocol Buffers, Thrift, ... Asynchronous is preferred JSON is fashionable but binary format is more efficient
  • 52. Pros and cons of messaging Pros Cons Decouples client from Additional complexity of server message broker Message broker buffers Request/reply-style messages communication is more Supports a variety of complex communication patterns
  • 53. Pros and cons of HTTP Pros Simple and familiar Request/reply is easy Firewall friendly No intermediate broker Cons Only supports request/ reply Server must be available Client needs to discover URL(s) of server(s)
  • 54. @crichardson Discovery option #1: Internal load balancer Load Balancer Product Info Service Product Info Service Product Info Service Product Info Service Client/ API gateway Services register with load balancer Client talks to load balancer Has a well-known location http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/USVPC_creating_basic_lb.html
  • 55. @crichardson Discovery option #2: client-side load balancing REST Client Product Info Service Product Info Service Product Info Service Product Info Service Client Service Registry Services register with registry Client polls registry http://techblog.netflix.com/2013/01/announcing-ribbon-tying-netflix-mid.html http://techblog.netflix.com/2012/09/eureka.html
  • 56. @crichardson Lots of moving parts! PProrodducutc tIn Ifnofo Service Recommendation Service Review Service Order Service Browse Products UI Checkout UI Order management UI Account management UI API Gate way Service registry Content Router HTML Browser REST Client Ext. LB Ext. LB
  • 58. Monolithic applications are simple to develop and deploy @crichardson BUT have significant drawbacks
  • 59. @crichardson Apply the scale cube Modular, polyglot, and scalable applications Services developed, deployed and scaled independently
  • 60. Use a modular, polyglot architecture View Controller Product Info @crichardson Model service Recommendation Service Review service REST REST AMQP API Gateway Server-side web application View Controller Model Browser/Native application
  • 61. @crichardson Start refactoring your monolith Monolith Anti-corruption Service layer Glue code Pristine
  • 62. Come to my 11.30 am talk to learn more.... Building microservices with Scala, functional domain models and @crichardson Spring Boot
  • 63. @crichardson [email protected] @crichardson Questions? http://plainoldobjects.com http://microservices.io