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

ArmeriaとCentral Dogmaから学ぶ、マイクロサービスに必要な機能 #edayf...

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. About me • Nameɿ Manabu Matsuzaki • Work atɿ LINE

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

    • ࣮ફฤ • ArmeriaͱCentral DogmaΛ࢖ͬͨαϯϓϧΞϓϦͰػೳ঺հ
  3. ϚΠΫϩαʔϏεʹඞཁͳػೳΛߟ͑ͯΈΔ ʢαʔϏε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/
  4. ࢀߟࢿྉ • 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
  5. 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
  6. 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
  7. Why async and reactive? • Why async? • ಉظతͳAPIͰϚΠΫϩαʔϏεΛߏஙͨ͠৔߹ɺݺͼग़͠ݩͷεϨου͸Ϩεϙϯε ͕ฦͬͯ͘Δ·Ͱɺͦͷ1ͭͷϦΫΤετʹઐ༗͞Εͯ͠·͏

    • ಉظతͳAPIͰ͸ݺͼग़͠ઌ͕٧·Δͱɺυϛϊ౗͠తʹݺͼग़͠ݩ΋٧·ͬͯ͠·͏ • Why reactive(Non Blocking I/O using event loop)? • async͸ϒϩοΩϯάͰ΋࣮ݱͰ͖Δ͚Ͳʢྫ͑͹ɺεϨουϓʔϧͰͷasyncʣɺ
 େྔͷϦΫΤετΛॲཧ͢Δ৔߹ɺεϨουΛ࡞ΔͨΊͷαʔόϦιʔε͕୔ࢁඞཁ • ͦΕΛղܾ͢ΔͨΊͷNon Blocking I/O
  8. 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/
  9. 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
  10. Features for microservices • Resilience • Circuit Breaker • ݺͼग़͠ଆͰFailFastExceptionΛcatchͯ͠fallbackॲཧ͕Մೳ

    • Automatic retry (with Backoff+Jitter) • Rate limit (i.e. Throttling) • Health check
  11. ࢀߟࢿྉ • 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
  12. 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
  13. Why use Central Dogma? • ΞϓϦ΍ίϯςφΠϝʔδͷ࠶Ϗϧυ΍σϓϩΠແ͠Ͱઃఆͷಈతมߋ ͕Ͱ͖Δ • ಈతʹมߋ͢Δඞཁ͕ͳ͍΋ͷ͸ΞϓϦͷઃఆϑΝΠϧʹهड़ •

    ಈతʹઃఆ͍ͨ͠΋ͷ͸Central DogmaͰ؅ཧ • e.g. APIαʔόϦετ, Rate limitઃఆ, ϒϥοΫϦετ, A/BςετͳͲ
  14. αϯϓϧΞϓϦΛ࢖ͬͨσϞ • 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ͷಈ͖Λݟ ͯΈΔ