Save 37% off PRO during our Black Friday Sale! »

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~ での発表資料です

0a98ad166f9cdf8d27d92c37438c6e9d?s=128

Manabu Matsuzaki

July 20, 2019
Tweet

Transcript

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

  2. About me • Nameɿ Manabu Matsuzaki • Work atɿ LINE

    Fukuoka Corporation • Roleɿ SRE • Twitterɿ @matsumana
  3. Agenda • ͜ͷηογϣϯͷͶΒ͍ • ೖ໳ฤ • Armeriaೖ໳ • Central Dogmaೖ໳

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

    k8sʹσϓϩΠͰ͖ΔαϯϓϧΞϓϦΛ࢖ͬͯ঺հ͠·͢
  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/
  6. ϚΠΫϩαʔϏεʹඞཁͳػೳΛߟ͑ͯΈΔ ʢαʔϏεReliabilityͷࢹ఺ʣ • Async • Service Discovery • Distributed tracing

    • Circuit Breaker • Metrics • etc
  7. Armeriaೖ໳

  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
  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
  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
  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
  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/
  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
  14. Features for microservices • Resilience • Circuit Breaker • ݺͼग़͠ଆͰFailFastExceptionΛcatchͯ͠fallbackॲཧ͕Մೳ

    • Automatic retry (with Backoff+Jitter) • Rate limit (i.e. Throttling) • Health check
  15. Central Dogmaೖ໳

  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
  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
  18. Why use Central Dogma? • ΞϓϦ΍ίϯςφΠϝʔδͷ࠶Ϗϧυ΍σϓϩΠແ͠Ͱઃఆͷಈతมߋ ͕Ͱ͖Δ • ಈతʹมߋ͢Δඞཁ͕ͳ͍΋ͷ͸ΞϓϦͷઃఆϑΝΠϧʹهड़ •

    ಈతʹઃఆ͍ͨ͠΋ͷ͸Central DogmaͰ؅ཧ • e.g. APIαʔόϦετ, Rate limitઃఆ, ϒϥοΫϦετ, A/BςετͳͲ
  19. ArmeriaͱCentral DogmaΛ࢖ͬͨ αϯϓϧΞϓϦͰػೳ঺հ

  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ͷಈ͖Λݟ ͯΈΔ
  21. αϯϓϧΞϓϦ Overview

  22. Demo

  23. Thank you :)