Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Hypermedia-Driven Orchestration in Microservices

Hypermedia-Driven Orchestration in Microservices

Presented at; O'Reilly Software Architecture Conference, Boston, 2015.

The notion of Affordances has played seminal role in transforming our understanding of usable service design. It is key in Hypermedia architectural style and enables us to build resilient systems “at the scale of decades”.

With Microservice architectural style we end-up building systems that have higher degrees of freedom than those having monolith architectures. In such systems, effective orchestration and choreography are crucial. In this talk we explore hypermedia-enabled approach that leads to loosely-coupled, evolvable service design.

Irakli Nadareishvili

March 18, 2015
Tweet

More Decks by Irakli Nadareishvili

Other Decks in Technology

Transcript

  1. Hypermedia-­‐Driven  
    Orchestra3on  in  Microservices  
    Irakli  Nadareishvili  -­‐  @inadarei  
    Director  of  Strategy,  API  Academy  
     
    March,  2015  

    View Slide

  2. 2   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Marc Andreessen

    View Slide

  3. 3   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Marc Andreessen

    View Slide

  4. 4   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Marc Andreessen
    “This is a pattern that we love
    to fund: unbundle X from Y,
    but then use the liberation of
    X as leverage to do amazing
    new things with X.”

    View Slide

  5. 5   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    “Unbundling”

    View Slide

  6. 6   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    «unbundled by»

    View Slide

  7. 7   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    «unbundled by»

    View Slide

  8. 8   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    «unbundled by»

    View Slide

  9. 9   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    «unbundled by»

    View Slide

  10. 10   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Irakli  Nadareishvili  –  @inadarei  
    Hypermedia-­‐Driven  
    Orchestra3on  in  Microservices  

    View Slide

  11. 11   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    What are “Microservices ”?

    View Slide

  12. 12   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Martin Fowler:
    -­‐  hPp://marTnfowler.com/arTcles/microservices.html  
    “We  cannot  say  there  is  a  formal  
    definiTon  of  the  microservices  
    architectural  style,  but  we  can  aPempt  
    to  describe  what  we  see  as  common  
    characterisTcs  for  architectures  that  fit  
    the  label.  ”  

    View Slide

  13. 13   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    EVOLUTIONARY  DESIGN  
    Characteristics of a Microservice Architecture per Fowler:
    COMPONENTIZATION  VIA  SERVICES  
    ORGANIZED  AROUND  BUSINESS  CAPABILITIES  
    PRODUCTS,  NOT    PROJECTS  
    SMART  ENDPOINTS  AND  DUMB  PIPES  
    DECENTRALIZED  GOVERNANCE  &  DATA  MANAGEMENT  
    1  
    2  
    3  
    4  
    5  
    INFRASTRUCTURE  AUTOMATION/DESIGN  FOR  FAILURE  
    6  
    7  

    View Slide

  14. 14   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    We Know What It Is Not:
    Monolith

    View Slide

  15. 15   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    We Know It Is Popular:

    View Slide

  16. 16   ©  2015  CA.  ALL  RIGHTS  RESERVED.  

    View Slide

  17. 17   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    It is not just about technology

    View Slide

  18. 18   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Unbundling: greatest disruptor of tech industry
    “Microservices unbundle your business
    for internal and [controlled] external
    disruption”
    – Irakli Nadareishvili

    View Slide

  19. 19   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Microservice Architecture
    is complex
    Uncomfortable truth:

    View Slide

  20. 20   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Monolith is brittle, but has order

    View Slide

  21. 21   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Microservices: High Degree of Freedom

    View Slide

  22. 22   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Most of us are quite awful at
    designing distributed systems.
    Uncomfortable truth:

    View Slide

  23. 23   ©  2015  CA.  ALL  RIGHTS  RESERVED.  

    View Slide

  24. 24   ©  2015  CA.  ALL  RIGHTS  RESERVED.  

    View Slide

  25. 25   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    EVOLUTIONARY  DESIGN  
    Characteristics of a Microservice Architecture per Fowler:
    DECENTRALIZED  GOVERNANCE  &  DATA  MANAGEMENT  
    5  
    7  

    View Slide

  26. 26   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Watch-out for tight coupling!

    View Slide

  27. 27   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    We can build loosely-coupled,
    evolvable services, by designing
    them as Hypermedia APIs
    Solution we know works:

    View Slide

  28. 28   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Hypermedia per Fielding
    Architectural  Styles  and  the  Design  of  Network-­‐based  
    So\ware,  2001  
    -­‐  Roy  T.  Fielding  
    “Hypermedia  is  defined  by  the  
    presence  of  applicaTon  control  
    informaTon  embedded  within,  or    
    as  a  layer  above,  the  presentaTon    
    of  informaTon”  

    View Slide

  29. 29   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Or: response = data + controls
    API  server  would  have  to  send  client  
    not  just  sta$c  data,  but  also  controls  
    describing  API  affordances.  

    View Slide

  30. 30   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Challenge by Ioseb Dzmanashvili:
    Most  common  hypermedia  
    controls  facilitate  “a  single  step”.  

    View Slide

  31. 31   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    How do we orchestrate
    Loosely-coupled microservices
    for complex workflows?

    View Slide

  32. 32   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    E-­‐COMMERCE  
    BOOKING  TRAVEL  
    1  
    2  
    Examples:

    View Slide

  33. 33   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Booking Travel

    View Slide

  34. 34   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Diagram  by:  Clemens  Vasters    
    source:  hPp://vasters.com/clemensv/2012/09/01/Sagas.aspx    
    Saga: Long-Lived Compensating Transactions

    View Slide

  35. 35   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Link Relations for Saga:
    •  rel  =  “rouTng-­‐slip”  (new:  microformats)  
    •  rel  =  “compensaTngtx”  (new:  microformats)  
    @see:  hPp://rels.messages.io  

    View Slide

  36. 36   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    E-Commerce

    View Slide

  37. 37   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    BROWSING/DISCOVERY  –  “HYPERMEDIA  MAZE”  (AMUNDSEN)  
    CHECKOUT  –  SERVICE  ORCHESTRATION  
    POST-­‐PURCHASE  –  SERVICE  CHOREOGRAPHY  
    1  
    2  
    3  
    3 Types of Complex Workflows

    View Slide

  38. 38   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Maze Problems

    View Slide

  39. 39   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Maze+XML

    View Slide

  40. 40   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Checkout: Orchestration
    Checkout  
    1.  Collect  Shipping  Info   2.  Billing  Info   3.  Authorize  Payment  
    4.  Post-­‐purchase  processing  

    View Slide

  41. 41   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Orchestration for Wizard-Style WFs:
    •  rel  =  “next”  
    •  rel  =  “prev”  
    Standard  IANA  link  relaTons:  

    View Slide

  42. 42   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Post Purchase: Choreography
    Post-­‐Purchase  
    service  
    Shipping  Service  
    E-­‐mail  noTficaTon  service  
    SMS  NoTficaTon  Service  
    Purchase  
    Completed  
    event  
    Push  NoTficaTon  Service  
    «subscribes to»

    View Slide

  43. 43   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Service Choreography
    •  rel  =  “hub”  (IANA  standard)  
    •  rel  =  “sub”  (new:  microformats)  
    •  rel  =  “unsub”  (new:  microformats)  
    •  rel  =  “events”  (new:  microformats)  
    Async  and  event-­‐driven.    
    Standard:  Pubsubhubbub  
    @see:  hPp://rels.messages.io  

    View Slide

  44. 44   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    BROWSING/DISCOVERY  –  “HYPERMEDIA  MAZE”  (MIKE  AMUNDSEN)  
    CHECKOUT  –  SERVICE  ORCHESTRATION  
    POST-­‐PURCHASE  –  SERVICE  CHOREOGRAPHY  
    1  
    2  
    3  
    Types of Complex Workflows
    DISTRIBUTED  TRANSACTIONS  –  SAGA  (HECTOR  GARCIA-­‐MOLINA  &  KENNETH  SALEM  )  
    4  

    View Slide

  45. 45   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Are there more workflow types?
    Probably, but: next time!

    View Slide

  46. 46   ©  2015  CA.  ALL  RIGHTS  RESERVED.  
    Microservices ❤ Hypermedia-Driven Orchestration
    Photo  credit:  Corey  Seeman,  CC  BY-­‐NC-­‐SA  2.0.  hPps://www.flickr.com/photos/cseeman/14144834659  

    View Slide

  47. Director  of  Strategy,  API  Academy  
         
    Irakli  Nadareishvili    
    @inadarei  @apiacademy  @cainc  
    Slideshare.net/cainc  
    linkedin.com/company/ca-­‐technologies  
    ca.com  

    View Slide