$30 off During Our Annual Pro Sale. View Details »

ArmeriaとCentral Dogmaから学ぶ、マイクロサービスに必要な機能 #edayfuk / lean-from-armeria-and-central-dogma

ArmeriaとCentral Dogmaから学ぶ、マイクロサービスに必要な機能 #edayfuk / lean-from-armeria-and-central-dogma

FUKUOKA Engineers Day 2019 ~Summer~ での発表資料です

Manabu Matsuzaki

July 20, 2019
Tweet

More Decks by Manabu Matsuzaki

Other Decks in Technology

Transcript

  1. ArmeriaͱCentral Dogma͔ΒֶͿ
    ϚΠΫϩαʔϏεʹඞཁͳػೳ
    FUKUOKA Engineers Day 2019 ~Summer~
    2019/07/20 @matsumana

    View Slide

  2. About me
    • Nameɿ Manabu Matsuzaki
    • Work atɿ LINE Fukuoka Corporation
    • Roleɿ SRE
    • Twitterɿ @matsumana

    View Slide

  3. Agenda
    • ͜ͷηογϣϯͷͶΒ͍
    • ೖ໳ฤ
    • Armeriaೖ໳
    • Central Dogmaೖ໳
    • ࣮ફฤ
    • ArmeriaͱCentral DogmaΛ࢖ͬͨαϯϓϧΞϓϦͰػೳ঺հ

    View Slide

  4. ͜ͷηογϣϯͷͶΒ͍
    • αʔϏεReliabilityͷࢹ఺͔ΒɺϚΠΫϩαʔϏεʹඞཁͳػೳΛߟ
    ͑Δ
    • Armeria + Central DogmaͰԿ͕ग़དྷΔͷ͔Λ঺հ
    • k8sʹσϓϩΠͰ͖ΔαϯϓϧΞϓϦΛ࢖ͬͯ঺հ͠·͢

    View Slide

  5. ϚΠΫϩαʔϏεʹඞཁͳػೳΛߟ͑ͯΈΔ
    ʢαʔϏεReliabilityͷࢹ఺ʣ
    • ࣮ફϚΠΫϩαʔϏε ᴷ ίϯϙʔωϯτ෼ׂ΍τϥϒϧճආͷߟ͑ํΛLINEͷಋೖ
    ࣄྫʹֶͿ

    https://employment.en-japan.com/engineerhub/entry/2018/10/09/110000
    • RxJava 2ͱArmeriaͰϚΠΫϩαʔϏεΛඇಉظԽͯ͠Έͨ

    https://engineering.linecorp.com/ja/blog/asynchronous-micro-service-in-rxjava-2-
    armeria/
    • Envoy Proxy - Learn Envoy

    https://www.envoyproxy.io/learn/

    View Slide

  6. ϚΠΫϩαʔϏεʹඞཁͳػೳΛߟ͑ͯΈΔ
    ʢαʔϏεReliabilityͷࢹ఺ʣ
    • Async
    • Service Discovery
    • Distributed tracing
    • Circuit Breaker
    • Metrics
    • etc

    View Slide

  7. Armeriaೖ໳

    View Slide

  8. ࢀߟࢿྉ
    • Official site

    https://line.github.io/armeria/
    • Examples

    https://github.com/line/armeria-examples
    • JOTB19 - Armeria: The Only Thrift/gRPC/REST Microservice
    Framework You'll Need
    • https://speakerdeck.com/trustin/armeria-the-only-thrift-grpc-
    rest-microservice-framework-youll-need
    • https://www.youtube.com/watch?v=hLlctum1pIA

    View Slide

  9. ArmeriaΛ࢖͍ͬͯΔOSS΍αʔϏε
    • https://github.com/line/armeria/issues/1709
    • OSS
    • OpenZipkin Server
    • Curiostack
    • Services
    • LINE
    • Slack (gRPCʹؔ͢ΔॳͷΧϯϑΝϨϯεɺgRPC Conf͕GoogleຊࣾͰ։࠵ https://thinkit.co.jp/article/16048 )
    • Kakao Pay
    • Infostellar

    View Slide

  10. What is Armeria?
    • Java microservice framework
    • Supports gRPC, Thrift and REST API
    • Based on async and reactive model(Non Blocking I/O using event loop)
    • Supports Reactive Streams (RxJava2, Project Reactor)
    • Supports HTTP/2. Not only gRPC but also Thrift and REST API
    • Has features for microservices
    • Others
    • Spring Boot integration
    • etc

    View Slide

  11. Why async and reactive?
    • Why async?
    • ಉظతͳAPIͰϚΠΫϩαʔϏεΛߏஙͨ͠৔߹ɺݺͼग़͠ݩͷεϨου͸Ϩεϙϯε
    ͕ฦͬͯ͘Δ·Ͱɺͦͷ1ͭͷϦΫΤετʹઐ༗͞Εͯ͠·͏
    • ಉظతͳAPIͰ͸ݺͼग़͠ઌ͕٧·Δͱɺυϛϊ౗͠తʹݺͼग़͠ݩ΋٧·ͬͯ͠·͏
    • Why reactive(Non Blocking I/O using event loop)?
    • async͸ϒϩοΩϯάͰ΋࣮ݱͰ͖Δ͚Ͳʢྫ͑͹ɺεϨουϓʔϧͰͷasyncʣɺ

    େྔͷϦΫΤετΛॲཧ͢Δ৔߹ɺεϨουΛ࡞ΔͨΊͷαʔόϦιʔε͕୔ࢁඞཁ
    • ͦΕΛղܾ͢ΔͨΊͷNon Blocking I/O

    View Slide

  12. Features for microservices
    • Dynamic Configuration
    • service discovery
    • DNS-based
    • ZooKeeper-based
    • Central Dogma-based
    • Deployment Models
    • Client-side load balancing
    • FYI:
    • https://www.usenix.org/conference/srecon19americas/presentation/nolan-loadbalancing
    • https://www.linkedin.com/pulse/microservices-client-side-load-balancing-amit-kumar-sharma/

    View Slide

  13. Features for microservices
    • Observability
    • Metrics
    • Distributed Tracing
    • Access Logs
    See also:
    LINE ShopνʔϜͰͷPrometheus/Grafana/Zipkin/Elasticsearch/KibanaΛ࢖ͬͨαʔϏεϞχλϦϯά
    https://speakerdeck.com/line_developers/service-monitoring-with-prometheus-grafana-zipkin-
    elasticsearch-kibana-at-line-shop-team

    View Slide

  14. Features for microservices
    • Resilience
    • Circuit Breaker
    • ݺͼग़͠ଆͰFailFastExceptionΛcatchͯ͠fallbackॲཧ͕Մೳ
    • Automatic retry (with Backoff+Jitter)
    • Rate limit (i.e. Throttling)
    • Health check

    View Slide

  15. Central Dogmaೖ໳

    View Slide

  16. ࢀߟࢿྉ
    • Official site

    https://line.github.io/centraldogma/
    • LINE DEVELOPER DAY 2017 - Central Dogma LINE's Git-backed
    highly-available service configuration repository
    • https://www.slideshare.net/linecorp/central-dogma-lines-gitbacked-
    highlyavailable-service-configuration-repository
    • https://www.youtube.com/watch?v=BmgizIFwMq4

    View Slide

  17. What is Central Dogma?
    • Service configuration repository
    • Based on Git, ZooKeeper and HTTP/2
    • Version controlled
    • Highly Available
    • Mirroring from an external Git repo
    • Change notification
    • Client libraries
    • Java
    • Golang https://github.com/line/centraldogma-go

    View Slide

  18. Why use Central Dogma?
    • ΞϓϦ΍ίϯςφΠϝʔδͷ࠶Ϗϧυ΍σϓϩΠແ͠Ͱઃఆͷಈతมߋ
    ͕Ͱ͖Δ
    • ಈతʹมߋ͢Δඞཁ͕ͳ͍΋ͷ͸ΞϓϦͷઃఆϑΝΠϧʹهड़
    • ಈతʹઃఆ͍ͨ͠΋ͷ͸Central DogmaͰ؅ཧ
    • e.g. APIαʔόϦετ, Rate limitઃఆ, ϒϥοΫϦετ, A/BςετͳͲ

    View Slide

  19. ArmeriaͱCentral DogmaΛ࢖ͬͨ
    αϯϓϧΞϓϦͰػೳ঺հ

    View Slide

  20. αϯϓϧΞϓϦΛ࢖ͬͨσϞ
    • source code: https://github.com/matsumana/armeria-sandbox
    • k8sʹΞϓϦΛσϓϩΠ
    • k8sͷAPIαʔό͔ΒService discoveryͯ͠ɺCentral DogmaʹPod৘ใ
    Λอଘ
    • Rate limitͷઃఆΛCentral DogmaͰ؅ཧ
    • Central DogmaͷUIͰRate limitΛߋ৽ͯ͠ɺCircuit Breakerͷಈ͖Λݟ
    ͯΈΔ

    View Slide

  21. αϯϓϧΞϓϦ Overview

    View Slide

  22. Demo

    View Slide

  23. Thank you :)

    View Slide