SlideShare uma empresa Scribd logo
1 de 53
Baixar para ler offline
Decomposing applications for
deployability and scalability
 Chris Richardson

 Author of POJOs in Action
 Founder of the original CloudFoundry.com

   @crichardson
 crichardson@vmware.com
 http://plainoldobjects.com/




                                            1
Presentation goal
  How decomposing
 applications improves
   deployability and
       scalability

                         2
vmc push About-Chris
     Developer Advocate for
       CloudFoundry.com


Signup at http://cloudfoundry.com
         cfopentour2012

                                    3
Agenda
§The (sometimes evil) monolith
§Decomposing applications into services
§How do services communicate?




                                           4
Let’s imagine you are building
 an e-commerce application




                             5
Traditional web application architecture
                         WAR



                                StoreFrontUI


                                 Accounting
                                  Service

                                                  MySQL
 Browser     Apache
                               InventoryService   Database


                                   Shipping
                                   Service


Simple to             Tomcat
   develop
   test
   deploy
   scale                                                     6
But there are problems with
 a monolithic architecture



                          7
Users expect a rich, dynamic
and interactive experience
                                                           h
                                                        oug
                                                      en
                                                ood
                                             ’tg
                        HTTP Request
                                          isn
                                    ure
                                 ect
                                                Java Web
    Browser
                               it
                        HTML/Javascript        Application

                        Ia rch
              ty le U
         s
     Old



     Real-time web ≅ NodeJS
                                                               8
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
§e.g. Makes A/B testing UI really difficult              9
Overloads your IDE and container




     Slows down development    10
Obstacle to scaling development




    Accounting team
                      E-commerce
      Engineering
                       application



     Shipping team




                                     11
Obstacle to scaling development


                      WAR


        UI team              StoreFrontUI


    Accounting team           Accounting


    Inventory team          InventoryService


     Shipping team              Shipping




                                               12
Obstacle to scaling development




   Lots of coordination and
    communication required        13
Requires long-
term commitment
 to a technology
       stack




                   14
Agenda
§The (sometimes evil) monolith
§Decomposing applications into services
§How do services communicate?




                                           15
16
The scale cube


Y axis -
functional
decomposition
Scale by




                                                                 im ing
splitting




                                                              g s on

                                                                      r
                                                                   ila
                                                           tin iti
different things




                                                        lit art
                                                               p
                                                 gs y ata
                                             th ale - d
                                                     sp
                                            i        s
                                         ax
                                               in b
                                         Z

                   X axis - horizontal
                                             Sc

                   duplication
                                                                          17
Y-axis scaling - application level

              WAR



                     StoreFrontUI


                      Accounting
                       Service


                    InventoryService



                        Shipping
                        Service




                                       18
Y-axis scaling - application level
                                        accounting web application

                                                  Accounting
                                                   Service




  Store front web application            inventory web application


                                               InventoryService
           StoreFrontUI




                                        shipping web application


                                                    Shipping
                                                    Service




   Apply X axis cloning and/or Z axis partitioning to each service   19
Partitioning strategies
§Partition by verb, e.g. shipping service
§Partition by noun, e.g. inventory service
§Single Responsibility Principle
§Unix utilities - do one focussed thing well




     Something of an art
                                                20
Real world examples
          http://techblog.netflix.com/




          Between 100-150 services are accessed to build a
          page.
          http://highscalability.com/amazon-architecture




          http://www.addsimplicity.com/downloads/
          eBaySDForum2006-11-29.pdf

          http://queue.acm.org/detail.cfm?id=1394128

                                                           21
There are drawbacks



                      22
Complexity


   See Steve Yegge’s Google
Platforms Rant re Amazon.com

                               23
Multiple databases
            =
Transaction management
       challenges


                         24
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   25
But there are many benefits
§Scales development: develop, deploy and scale
  each service independently
§Update UI independently
§Improves fault isolation
§Eliminates long-term commitment to a single
  technology stack



      Modular, polyglot, multi-
      framework applications
                                                  26
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


                                                              27
If services are small...
§Regularly rewrite using a better technology stack
§Adapt system to changing requirements and
  better technology without a total rewrite
§Pick the best developers rather than best <pick
  a language> developers polyglot culture

    Fred George
    “Developer Anarchy”

                                                      28
The human body as a system




                             29
50 to 70 billion of your cells die each
                  day




                                      30
Yet you (the system) remain you




                                  31
Can we build software systems
  with these characteristics?

              http://dreamsongs.com/Files/
              DesignBeyondHumanAbilitiesSimp.pdf




              http://dreamsongs.com/Files/WhitherSoftware.pdf




                                                            32
Agenda
§The (sometimes evil) monolith
§Decomposing applications into services
§How do services communicate?




                                           33
Inter-service communication options
§Synchronous HTTP        asynchronous AMQP

§Formats: JSON, XML, Protocol Buffers, Thrift, ...
§Even via the database


   Asynchronous is preferred

   JSON is fashionable but binary
   format is more efficient
                                                      34
Asynchronous message-based communication
                                 wgrus-billing.war

                                          Accounting
                                           Service



wgrus-store.war                wgrus-inventory.war
                    RabbitMQ
     StoreFrontUI   (Message          InventoryService   MySQL
                     Broker)



                               wgrus-shipping.war


                                       ShippingService




                                                                 35
Benefits
§Decouples caller from server
§Caller unaware of server’s coordinates (URL)
§Message broker buffers message when server is
down/slow




                                                  36
Drawbacks
§Additional complexity of message broker
§RPC using messaging is more complex




                                            37
Writing code that calls
       services



                          38
The need for parallelism
                                   Service B
                b = serviceB()


                                               Call in parallel
                  c = serviceC()
 Service A                         Service C



             d = serviceD(b, c)
                                   Service D


                                                                  39
Java Futures are a great
concurrency abstraction


  http://en.wikipedia.org/wiki/Futures_and_promises
                                                      40
Akka’s composable
futures are even better



                          41
Using Akka futures
def callB() : Future[...] = ...
def callC() : Future[...] = ...
def callD() : Future[...] = ...                           Two calls execute in parallel


val future = for {
  (b, c) <- callB() zip callC();
  d <- callD(b, c)
                                                                And then invokes D
 } yield d

val result = Await.result(future, 1 second)


  http://doc.akka.io/docs/akka/2.0.1/scala/futures.html           Get the result of D
                                                                                          42
Spring Integration
§Implements EAI patterns
§Provides the building blocks for
  a pipes and filters architecture
§Enables development of
  application components that are
  •loosely coupled
  •insulated from messaging
  infrastructure
§Messaging defined declaratively



                                     43
Handling failure


   Service A                   Service B




               Errors happen
           in distributed systems



                                           44
About Netflix
          > 1B API calls/day
 1 API call average 6 service calls
     Fault tolerance is essential




        http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html




                                                                                 45
Use timeouts and retries

         Never wait forever

   Errors can be transient                             retry




                    http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html
                                                                                             46
Use per-dependency bounded thread pool
 Service A

    Runnable 1               Task 1

     Runnable 2              Task 2
                                                                                  Service B
     Runnable ...            Task ...

     bounded queue        bounded thread pool


       Fails fast if         Limits number of
service is slow or down     outstanding requests




                                                   http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html   47
Use a circuit breaker
High error rate   stop calling temporarily

   Down     wait for it to come back up

  Slow     gives it a chance to recover




                      http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html   48
On failure
          Return cached data
Avoid
Failing
          Return default data

               Fail fast




                     http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html   49
Summary



          50
Monolithic applications are
simple to develop and deploy

    BUT have significant
        drawbacks

                               51
Apply the scale cube

                                                                       §Modular, polyglot, and
                                                                         scalable applications
                                                                       §Services developed,
Y axis -
functional
decomposition

                                                                  ng
                                                                         deployed and scaled
                                                                         independently
                                                                  i
                                                               on
                                                              iti
                                                             rt
                                                           pa
                                                         ta
                                                       da
                                                     is-
                                                  ax
                                                  Z




                X axis - horizontal duplication




                                                                                                  52
@crichardson crichardson@vmware.com
         http://slideshare.net/chris.e.richardson/




                Questions?
www.cloudfoundry.com promo code: cfopentour2012

Mais conteúdo relacionado

Semelhante a Decomposing applications for deployability and scalability (cfopentour india)

Decomposing applications for scalability and deployability - svcc sv_code_ca...
Decomposing applications for scalability and deployability  - svcc sv_code_ca...Decomposing applications for scalability and deployability  - svcc sv_code_ca...
Decomposing applications for scalability and deployability - svcc sv_code_ca...Chris Richardson
 
Decomposing applications for deployability and scalability (SpringOne China 2...
Decomposing applications for deployability and scalability (SpringOne China 2...Decomposing applications for deployability and scalability (SpringOne China 2...
Decomposing applications for deployability and scalability (SpringOne China 2...Chris Richardson
 
Decomposing applications for deployability and scalability #springone2gx #s12gx
Decomposing applications for deployability and scalability #springone2gx #s12gxDecomposing applications for deployability and scalability #springone2gx #s12gx
Decomposing applications for deployability and scalability #springone2gx #s12gxChris Richardson
 
Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)Chris Richardson
 
Developing polyglot applications on Cloud Foundry (#oredev 2012)
Developing polyglot applications on Cloud Foundry (#oredev 2012)Developing polyglot applications on Cloud Foundry (#oredev 2012)
Developing polyglot applications on Cloud Foundry (#oredev 2012)Chris Richardson
 
Decomposing applications for scalability and deployability (devnexus 2013)
Decomposing applications for scalability and deployability (devnexus 2013)Decomposing applications for scalability and deployability (devnexus 2013)
Decomposing applications for scalability and deployability (devnexus 2013)Chris Richardson
 
Spring into the Cloud - JDC2012 Cairo, Egypt
Spring into the Cloud - JDC2012 Cairo, EgyptSpring into the Cloud - JDC2012 Cairo, Egypt
Spring into the Cloud - JDC2012 Cairo, EgyptChris Richardson
 
Cloud Foundry Bootcamp
Cloud Foundry BootcampCloud Foundry Bootcamp
Cloud Foundry BootcampJoshua Long
 
Evolving big microservice architectures
Evolving big microservice architecturesEvolving big microservice architectures
Evolving big microservice architecturesNikolay Stoitsev
 
eBay Architecture
eBay Architecture eBay Architecture
eBay Architecture Tony Ng
 
Evolving Mobile Architectures
Evolving Mobile ArchitecturesEvolving Mobile Architectures
Evolving Mobile Architecturessgleadow
 
Resource Oriented Architecture in Wireless Sensor Network
Resource Oriented Architecture in Wireless Sensor NetworkResource Oriented Architecture in Wireless Sensor Network
Resource Oriented Architecture in Wireless Sensor NetworkThomas Pham
 
An Introduction To Space Based Architecture
An Introduction To Space Based ArchitectureAn Introduction To Space Based Architecture
An Introduction To Space Based ArchitectureAmin Abbaspour
 
Enterprise Mashups With Soa
Enterprise Mashups With SoaEnterprise Mashups With Soa
Enterprise Mashups With Soaumityalcinalp
 
[Infosecworld 08 Orlando] New Defenses for .NET Web Apps: IHttpModule in Prac...
[Infosecworld 08 Orlando] New Defenses for .NET Web Apps: IHttpModule in Prac...[Infosecworld 08 Orlando] New Defenses for .NET Web Apps: IHttpModule in Prac...
[Infosecworld 08 Orlando] New Defenses for .NET Web Apps: IHttpModule in Prac...Shreeraj Shah
 
Node.js User Group Belgium - 1st meetup
Node.js User Group Belgium - 1st meetupNode.js User Group Belgium - 1st meetup
Node.js User Group Belgium - 1st meetupSteven Beeckman
 
Order Capture Highlight
Order Capture HighlightOrder Capture Highlight
Order Capture HighlightLABaumann
 
[2011-17-C-4] Heroku & database.com
[2011-17-C-4] Heroku & database.com[2011-17-C-4] Heroku & database.com
[2011-17-C-4] Heroku & database.comMitch Okamoto
 
(How) Does VA Smalltalk fit into today's IT landscapes?
(How) Does VA Smalltalk fit into today's IT landscapes?(How) Does VA Smalltalk fit into today's IT landscapes?
(How) Does VA Smalltalk fit into today's IT landscapes?Joachim Tuchel
 

Semelhante a Decomposing applications for deployability and scalability (cfopentour india) (20)

Decomposing applications for scalability and deployability - svcc sv_code_ca...
Decomposing applications for scalability and deployability  - svcc sv_code_ca...Decomposing applications for scalability and deployability  - svcc sv_code_ca...
Decomposing applications for scalability and deployability - svcc sv_code_ca...
 
Decomposing applications for deployability and scalability (SpringOne China 2...
Decomposing applications for deployability and scalability (SpringOne China 2...Decomposing applications for deployability and scalability (SpringOne China 2...
Decomposing applications for deployability and scalability (SpringOne China 2...
 
Decomposing applications for deployability and scalability #springone2gx #s12gx
Decomposing applications for deployability and scalability #springone2gx #s12gxDecomposing applications for deployability and scalability #springone2gx #s12gx
Decomposing applications for deployability and scalability #springone2gx #s12gx
 
Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)
 
Developing polyglot applications on Cloud Foundry (#oredev 2012)
Developing polyglot applications on Cloud Foundry (#oredev 2012)Developing polyglot applications on Cloud Foundry (#oredev 2012)
Developing polyglot applications on Cloud Foundry (#oredev 2012)
 
Decomposing applications for scalability and deployability (devnexus 2013)
Decomposing applications for scalability and deployability (devnexus 2013)Decomposing applications for scalability and deployability (devnexus 2013)
Decomposing applications for scalability and deployability (devnexus 2013)
 
Spring into the Cloud - JDC2012 Cairo, Egypt
Spring into the Cloud - JDC2012 Cairo, EgyptSpring into the Cloud - JDC2012 Cairo, Egypt
Spring into the Cloud - JDC2012 Cairo, Egypt
 
Cloud Foundry Bootcamp
Cloud Foundry BootcampCloud Foundry Bootcamp
Cloud Foundry Bootcamp
 
Evolving big microservice architectures
Evolving big microservice architecturesEvolving big microservice architectures
Evolving big microservice architectures
 
eBay Architecture
eBay Architecture eBay Architecture
eBay Architecture
 
Evolving Mobile Architectures
Evolving Mobile ArchitecturesEvolving Mobile Architectures
Evolving Mobile Architectures
 
Resource Oriented Architecture in Wireless Sensor Network
Resource Oriented Architecture in Wireless Sensor NetworkResource Oriented Architecture in Wireless Sensor Network
Resource Oriented Architecture in Wireless Sensor Network
 
An Introduction To Space Based Architecture
An Introduction To Space Based ArchitectureAn Introduction To Space Based Architecture
An Introduction To Space Based Architecture
 
Enterprise Mashups With Soa
Enterprise Mashups With SoaEnterprise Mashups With Soa
Enterprise Mashups With Soa
 
[Infosecworld 08 Orlando] New Defenses for .NET Web Apps: IHttpModule in Prac...
[Infosecworld 08 Orlando] New Defenses for .NET Web Apps: IHttpModule in Prac...[Infosecworld 08 Orlando] New Defenses for .NET Web Apps: IHttpModule in Prac...
[Infosecworld 08 Orlando] New Defenses for .NET Web Apps: IHttpModule in Prac...
 
Node.js User Group Belgium - 1st meetup
Node.js User Group Belgium - 1st meetupNode.js User Group Belgium - 1st meetup
Node.js User Group Belgium - 1st meetup
 
Order Capture Highlight
Order Capture HighlightOrder Capture Highlight
Order Capture Highlight
 
[2011-17-C-4] Heroku & database.com
[2011-17-C-4] Heroku & database.com[2011-17-C-4] Heroku & database.com
[2011-17-C-4] Heroku & database.com
 
(How) Does VA Smalltalk fit into today's IT landscapes?
(How) Does VA Smalltalk fit into today's IT landscapes?(How) Does VA Smalltalk fit into today's IT landscapes?
(How) Does VA Smalltalk fit into today's IT landscapes?
 
Spring Into the Cloud
Spring Into the CloudSpring Into the Cloud
Spring Into the Cloud
 

Mais de Chris Richardson

The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?Chris Richardson
 
More the merrier: a microservices anti-pattern
More the merrier: a microservices anti-patternMore the merrier: a microservices anti-pattern
More the merrier: a microservices anti-patternChris Richardson
 
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...Chris Richardson
 
Dark Energy, Dark Matter and the Microservices Patterns?!
Dark Energy, Dark Matter and the Microservices Patterns?!Dark Energy, Dark Matter and the Microservices Patterns?!
Dark Energy, Dark Matter and the Microservices Patterns?!Chris Richardson
 
Dark energy, dark matter and microservice architecture collaboration patterns
Dark energy, dark matter and microservice architecture collaboration patternsDark energy, dark matter and microservice architecture collaboration patterns
Dark energy, dark matter and microservice architecture collaboration patternsChris Richardson
 
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdfScenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdfChris Richardson
 
Using patterns and pattern languages to make better architectural decisions
Using patterns and pattern languages to make better architectural decisions Using patterns and pattern languages to make better architectural decisions
Using patterns and pattern languages to make better architectural decisions Chris Richardson
 
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...Chris Richardson
 
Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...Chris Richardson
 
A pattern language for microservices - June 2021
A pattern language for microservices - June 2021 A pattern language for microservices - June 2021
A pattern language for microservices - June 2021 Chris Richardson
 
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice ArchitectureQConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice ArchitectureChris Richardson
 
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...Chris Richardson
 
Designing loosely coupled services
Designing loosely coupled servicesDesigning loosely coupled services
Designing loosely coupled servicesChris Richardson
 
Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)Chris Richardson
 
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...Chris Richardson
 
Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...Chris Richardson
 
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...Chris Richardson
 
Overview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders applicationOverview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders applicationChris Richardson
 
An overview of the Eventuate Platform
An overview of the Eventuate PlatformAn overview of the Eventuate Platform
An overview of the Eventuate PlatformChris Richardson
 
#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolith#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolithChris Richardson
 

Mais de Chris Richardson (20)

The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?
 
More the merrier: a microservices anti-pattern
More the merrier: a microservices anti-patternMore the merrier: a microservices anti-pattern
More the merrier: a microservices anti-pattern
 
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
 
Dark Energy, Dark Matter and the Microservices Patterns?!
Dark Energy, Dark Matter and the Microservices Patterns?!Dark Energy, Dark Matter and the Microservices Patterns?!
Dark Energy, Dark Matter and the Microservices Patterns?!
 
Dark energy, dark matter and microservice architecture collaboration patterns
Dark energy, dark matter and microservice architecture collaboration patternsDark energy, dark matter and microservice architecture collaboration patterns
Dark energy, dark matter and microservice architecture collaboration patterns
 
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdfScenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
 
Using patterns and pattern languages to make better architectural decisions
Using patterns and pattern languages to make better architectural decisions Using patterns and pattern languages to make better architectural decisions
Using patterns and pattern languages to make better architectural decisions
 
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
iSAQB gathering 2021 keynote - Architectural patterns for rapid, reliable, fr...
 
Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...
 
A pattern language for microservices - June 2021
A pattern language for microservices - June 2021 A pattern language for microservices - June 2021
A pattern language for microservices - June 2021
 
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice ArchitectureQConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
 
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
 
Designing loosely coupled services
Designing loosely coupled servicesDesigning loosely coupled services
Designing loosely coupled services
 
Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)
 
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
 
Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...
 
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
 
Overview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders applicationOverview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders application
 
An overview of the Eventuate Platform
An overview of the Eventuate PlatformAn overview of the Eventuate Platform
An overview of the Eventuate Platform
 
#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolith#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolith
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Último (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Decomposing applications for deployability and scalability (cfopentour india)

  • 1. Decomposing applications for deployability and scalability Chris Richardson Author of POJOs in Action Founder of the original CloudFoundry.com @crichardson crichardson@vmware.com http://plainoldobjects.com/ 1
  • 2. Presentation goal How decomposing applications improves deployability and scalability 2
  • 3. vmc push About-Chris Developer Advocate for CloudFoundry.com Signup at http://cloudfoundry.com cfopentour2012 3
  • 4. Agenda §The (sometimes evil) monolith §Decomposing applications into services §How do services communicate? 4
  • 5. Let’s imagine you are building an e-commerce application 5
  • 6. Traditional web application architecture WAR StoreFrontUI Accounting Service MySQL Browser Apache InventoryService Database Shipping Service Simple to Tomcat develop test deploy scale 6
  • 7. But there are problems with a monolithic architecture 7
  • 8. Users expect a rich, dynamic and interactive experience h oug en ood ’tg HTTP Request isn ure ect Java Web Browser it HTML/Javascript Application Ia rch ty le U s Old Real-time web ≅ NodeJS 8
  • 9. 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 §e.g. Makes A/B testing UI really difficult 9
  • 10. Overloads your IDE and container Slows down development 10
  • 11. Obstacle to scaling development Accounting team E-commerce Engineering application Shipping team 11
  • 12. Obstacle to scaling development WAR UI team StoreFrontUI Accounting team Accounting Inventory team InventoryService Shipping team Shipping 12
  • 13. Obstacle to scaling development Lots of coordination and communication required 13
  • 14. Requires long- term commitment to a technology stack 14
  • 15. Agenda §The (sometimes evil) monolith §Decomposing applications into services §How do services communicate? 15
  • 16. 16
  • 17. The scale cube Y axis - functional decomposition Scale by im ing splitting g s on r ila tin iti different things lit art p gs y ata th ale - d sp i s ax in b Z X axis - horizontal Sc duplication 17
  • 18. Y-axis scaling - application level WAR StoreFrontUI Accounting Service InventoryService Shipping Service 18
  • 19. Y-axis scaling - application level accounting web application Accounting Service Store front web application inventory web application InventoryService StoreFrontUI shipping web application Shipping Service Apply X axis cloning and/or Z axis partitioning to each service 19
  • 20. Partitioning strategies §Partition by verb, e.g. shipping service §Partition by noun, e.g. inventory service §Single Responsibility Principle §Unix utilities - do one focussed thing well Something of an art 20
  • 21. Real world examples http://techblog.netflix.com/ Between 100-150 services are accessed to build a page. http://highscalability.com/amazon-architecture http://www.addsimplicity.com/downloads/ eBaySDForum2006-11-29.pdf http://queue.acm.org/detail.cfm?id=1394128 21
  • 23. Complexity See Steve Yegge’s Google Platforms Rant re Amazon.com 23
  • 24. Multiple databases = Transaction management challenges 24
  • 25. 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 25
  • 26. But there are many benefits §Scales development: develop, deploy and scale each service independently §Update UI independently §Improves fault isolation §Eliminates long-term commitment to a single technology stack Modular, polyglot, multi- framework applications 26
  • 27. 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 27
  • 28. If services are small... §Regularly rewrite using a better technology stack §Adapt system to changing requirements and better technology without a total rewrite §Pick the best developers rather than best <pick a language> developers polyglot culture Fred George “Developer Anarchy” 28
  • 29. The human body as a system 29
  • 30. 50 to 70 billion of your cells die each day 30
  • 31. Yet you (the system) remain you 31
  • 32. Can we build software systems with these characteristics? http://dreamsongs.com/Files/ DesignBeyondHumanAbilitiesSimp.pdf http://dreamsongs.com/Files/WhitherSoftware.pdf 32
  • 33. Agenda §The (sometimes evil) monolith §Decomposing applications into services §How do services communicate? 33
  • 34. Inter-service communication options §Synchronous HTTP asynchronous AMQP §Formats: JSON, XML, Protocol Buffers, Thrift, ... §Even via the database Asynchronous is preferred JSON is fashionable but binary format is more efficient 34
  • 35. Asynchronous message-based communication wgrus-billing.war Accounting Service wgrus-store.war wgrus-inventory.war RabbitMQ StoreFrontUI (Message InventoryService MySQL Broker) wgrus-shipping.war ShippingService 35
  • 36. Benefits §Decouples caller from server §Caller unaware of server’s coordinates (URL) §Message broker buffers message when server is down/slow 36
  • 37. Drawbacks §Additional complexity of message broker §RPC using messaging is more complex 37
  • 38. Writing code that calls services 38
  • 39. The need for parallelism Service B b = serviceB() Call in parallel c = serviceC() Service A Service C d = serviceD(b, c) Service D 39
  • 40. Java Futures are a great concurrency abstraction http://en.wikipedia.org/wiki/Futures_and_promises 40
  • 42. Using Akka futures def callB() : Future[...] = ... def callC() : Future[...] = ... def callD() : Future[...] = ... Two calls execute in parallel val future = for { (b, c) <- callB() zip callC(); d <- callD(b, c) And then invokes D } yield d val result = Await.result(future, 1 second) http://doc.akka.io/docs/akka/2.0.1/scala/futures.html Get the result of D 42
  • 43. Spring Integration §Implements EAI patterns §Provides the building blocks for a pipes and filters architecture §Enables development of application components that are •loosely coupled •insulated from messaging infrastructure §Messaging defined declaratively 43
  • 44. Handling failure Service A Service B Errors happen in distributed systems 44
  • 45. About Netflix > 1B API calls/day 1 API call average 6 service calls Fault tolerance is essential http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html 45
  • 46. Use timeouts and retries Never wait forever Errors can be transient retry http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html 46
  • 47. Use per-dependency bounded thread pool Service A Runnable 1 Task 1 Runnable 2 Task 2 Service B Runnable ... Task ... bounded queue bounded thread pool Fails fast if Limits number of service is slow or down outstanding requests http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html 47
  • 48. Use a circuit breaker High error rate stop calling temporarily Down wait for it to come back up Slow gives it a chance to recover http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html 48
  • 49. On failure Return cached data Avoid Failing Return default data Fail fast http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html 49
  • 50. Summary 50
  • 51. Monolithic applications are simple to develop and deploy BUT have significant drawbacks 51
  • 52. Apply the scale cube §Modular, polyglot, and scalable applications §Services developed, Y axis - functional decomposition ng deployed and scaled independently i on iti rt pa ta da is- ax Z X axis - horizontal duplication 52
  • 53. @crichardson crichardson@vmware.com http://slideshare.net/chris.e.richardson/ Questions? www.cloudfoundry.com promo code: cfopentour2012