Share
Embed
ArmeriaとCentral Dogmaから学ぶ、マイクロサービスに必要な機能 #edayfuk / lean-from-armeria-and-central-dogma
FUKUOKA Engineers Day 2019 ~Summer~ での発表資料です
Manabu Matsuzaki
July 20, 2019
Transcript
23 slides
-
About me • Nameɿ Manabu Matsuzaki • Work atɿ LINE
Fukuoka Corporation • Roleɿ SRE • Twitterɿ @matsumana -
Agenda • ͜ͷηογϣϯͷͶΒ͍ • ೖฤ • Armeriaೖ • Central Dogmaೖ
• ࣮ફฤ • ArmeriaͱCentral DogmaΛͬͨαϯϓϧΞϓϦͰػೳհ -
͜ͷηογϣϯͷͶΒ͍ • αʔϏεReliabilityͷࢹ͔ΒɺϚΠΫϩαʔϏεʹඞཁͳػೳΛߟ ͑Δ • Armeria + Central DogmaͰԿ͕ग़དྷΔͷ͔Λհ •
k8sʹσϓϩΠͰ͖ΔαϯϓϧΞϓϦΛͬͯհ͠·͢ -
ϚΠΫϩαʔϏεʹඞཁͳػೳΛߟ͑ͯΈΔ ʢαʔϏε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/ -
ϚΠΫϩαʔϏεʹඞཁͳػೳΛߟ͑ͯΈΔ ʢαʔϏεReliabilityͷࢹʣ • Async • Service Discovery • Distributed tracing
• Circuit Breaker • Metrics • etc -
ࢀߟࢿྉ • 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 -
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 -
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 -
Why async and reactive? • Why async? • ಉظతͳAPIͰϚΠΫϩαʔϏεΛߏஙͨ͠߹ɺݺͼग़͠ݩͷεϨουϨεϙϯε ͕ฦͬͯ͘Δ·Ͱɺͦͷ1ͭͷϦΫΤετʹઐ༗͞Εͯ͠·͏
• ಉظతͳAPIͰݺͼग़͠ઌ͕٧·Δͱɺυϛϊ͠తʹݺͼग़͠ݩ٧·ͬͯ͠·͏ • Why reactive(Non Blocking I/O using event loop)? • asyncϒϩοΩϯάͰ࣮ݱͰ͖Δ͚Ͳʢྫ͑ɺεϨουϓʔϧͰͷasyncʣɺ େྔͷϦΫΤετΛॲཧ͢Δ߹ɺεϨουΛ࡞ΔͨΊͷαʔόϦιʔε͕ࢁඞཁ • ͦΕΛղܾ͢ΔͨΊͷNon Blocking I/O -
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/ -
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 -
Features for microservices • Resilience • Circuit Breaker • ݺͼग़͠ଆͰFailFastExceptionΛcatchͯ͠fallbackॲཧ͕Մೳ
• Automatic retry (with Backoff+Jitter) • Rate limit (i.e. Throttling) • Health check -
ࢀߟࢿྉ • 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 -
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 -
Why use Central Dogma? • ΞϓϦίϯςφΠϝʔδͷ࠶ϏϧυσϓϩΠແ͠Ͱઃఆͷಈతมߋ ͕Ͱ͖Δ • ಈతʹมߋ͢Δඞཁ͕ͳ͍ͷΞϓϦͷઃఆϑΝΠϧʹهड़ •
ಈతʹઃఆ͍ͨ͠ͷCentral DogmaͰཧ • e.g. APIαʔόϦετ, Rate limitઃఆ, ϒϥοΫϦετ, A/BςετͳͲ -
αϯϓϧΞϓϦΛͬͨσϞ • 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ͷಈ͖Λݟ ͯΈΔ