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

Reactive Microservices Architecture

Go Tanaka
September 09, 2016

Reactive Microservices Architecture

Go Tanaka

September 09, 2016
Tweet

More Decks by Go Tanaka

Other Decks in Technology

Transcript

  1. Reactive
    Microservices
    Architecture
    @tan_go238

    View full-size slide

  2. ࠓ೔࿩͢͜ͱ

    View full-size slide

  3. ͬ͘͘͢͟͝Γ࿩͠·͢

    View full-size slide

  4. ϚΠΫϩαʔϏεͷίϯηϓτ
    • খͯ͘͞
    • ಠཱͨ͠αʔϏεͰ
    • ͦΕͧΕ͕ࣗ෼ͷυϝΠϯͷσʔλΛ࣋ͪ
    • ಠཱͯ͠
    • ෼཭͞Ε͍ͯͯ
    • εέʔϥϒϧ
    • ͦͯ͠ରো֐ੑ͕͋Δ

    View full-size slide

  5. Monolith
    https://goo.gl/keQyrL

    View full-size slide

  6. SOA
    Microservices
    Reactive Microservices


    View full-size slide

  7. Reactive Microserviceͱ͸ʁ

    View full-size slide

  8. Reactive Manifest
    • ଈԠੑ
    • ରো֐ੑ
    • ஄ྗੑ
    • ϝοηʔδۦಈ
    http://www.reactivemanifesto.org/ja

    View full-size slide

  9. Reactive Microservice
    (Failure isolation)
    Bulkheading (SPOFΛͭ͘Βͳ͍)

    View full-size slide

  10. Reactive Microservice
    (Own your state, Exclusively)

    View full-size slide

  11. Reactive Microservice
    (Event Sourcing, CQRS)

    View full-size slide

  12. Reactive Microservice
    (Asynchronous Message-Passing)

    View full-size slide

  13. Reactive Microserviceͱ͸ʁ
    • ಠཱ͍ͯ͠Δ (DockerΈ͍ͨͳԾ૝Խͱ૊Έ߹Θͤͯߋʹޮ཰Խ)
    • ରো֐ੑ͕͋Δ
    • ඇಉظϝοηʔδϯά
    ଎͍͠ɺམͪͯ΋ଞ΁ͷӨڹ͕গͳ͘ɺ
    εέʔϥϒϧʹͰ͖ͯΔͷͰ͙͢ճ෮͢Δ

    View full-size slide

  14. ࣮ࡍͲ͏΍ͬͯ࡞Δͷʁ

    View full-size slide

  15. Microservices Come in Systems
    (Service Discovery)
    • ͓ޓ͍ͷαʔϏεͷΞυϨεΛ஌͍ͬͯΔඞཁ͕͋Δ
    • ͦͷ໾໨Λݞ୅ΘΓ͢Δͷ͕ Service Discovery
    • CAPఆཧͷ CP-Based ͱ AP-Based ͕͋Δ
    • CP-Based … Zookeeper, etcd
    • AP-Based … Lightbend Reactive Platform, eureka, Serf

    View full-size slide

  16. Microservices Come in Systems
    (API Gateway)
    ΫϥΠΞϯτ͔ΒͷϦΫΤετΛड͚औͬͯɺਖ਼͍͠αʔϏε΁౉͢
    ྫ) Netflix API, Amazon API Gateway

    View full-size slide

  17. Microservices Come in Systems
    (Managing Communication Patterns)
    • ίϛϡχέʔγϣϯύλʔϯ΋ෳࡶʹͳͬͯ͘Δ
    • Publish-Subscribe ύλʔϯΛ࢖͏
    • Subscriber͸ҎԼͷϥΠϒϥϦ͔ΒσʔλΛऔಘ͢Δ
    • Kafka, Amazon Kinesis, Cassandra, Riak
    • ·ͩෆे෼
    • σʔλετϦʔϜ … Akka Stream, Apache Camel

    View full-size slide

  18. Microservices Come in Systems
    (Back-pressure)
    • Publish-Subscribe ͷΑ͏ͳύλʔϯͰ͸ Pub ͷॲཧ͕଎
    ͗ͯ͢ Sub ͷॲཧ͕௥͍͔ͭͳ͍͜ͱ͕͋Δ
    • Subscriber͕ࣗ෼͕ॲཧͰ͖ΔྔΛPublisherʹϦΫΤε
    τΛૹΔ͜ͱͰແବͳ͘Subscriber͕ॲཧͰ͖ΔྔΛॲ
    ཧ͢Δ࢓૊Έ
    • Akka Stream, RxJava, Spark Streaming, Cassandra
    drivers

    View full-size slide

  19. Microservices Come in Systems
    (Circuit Breaker pattern)
    • ϦϞʔτΞΫηεͷ੒ޭʗࣦഊΛΧ΢ϯτ͠ɺ Τϥʔ
    ཰ (failure rate) ͕ᮢ஋Λ௒͑ͨͱ͖ʹࣗಈతʹΞΫη
    εΛःஅ͢Δ࢓૊Έ
    • Netflix Hystrix, Akka (akka.pattern.CircuitBreaker)

    View full-size slide

  20. Microservices Come in Systems
    (Event-Driven Architecture)
    • σʔλͷมߋ͸͙͢ଞͷαʔϏε͔Β΋ར༻Ͱ͖ͳ͍ͱ͍͚ͳ͍
    • Event Sourcing, CQRS
    • Command … ෭࡞༻͕͋Δૢ࡞
    • Event … Կ͔͕ىͬͨ͜ͱ͍͏ϩά (ࣄ࣮)
    • Event Logging and Event Streaming Product
    • Riak, RedBull Eventuate

    View full-size slide

  21. Microservices Come in Systems
    (SAGA pattern)
    • ෼ࢄγεςϜͰͷτϥϯβΫγϣϯ (Process Manager)

    View full-size slide

  22. Summery
    • Reactive Microservice ʹ͢Δʹ͸
    • ҎԼͷಛੑʹݻࣥ͢Δ
    • ෼཭͢Δ͜ͱ
    • ̍αʔϏεʹ͖ͭ̍ͭͷ੹೚ͷΈ
    • ഉଞతͳঢ়ଶʹ͢Δ
    • ඇಉظϝοηʔδύογϯά
    • ػಈੑ͕͋Δ (Mobility)
    • ߋʹҎԼͷΑ͏ͳಛੑΛซͤ࣋ͭ
    • αʔϏεಉ࢜ڠௐͯ͠ಈ࡞͢Δ
    • ͦͷαʔϏε͚ͩͰ׬݁͢Δ

    View full-size slide

  23. ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ

    View full-size slide