Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Work it harder, Make it better, Do it faster, Makes us stronger - Daft punk

Slide 3

Slide 3 text

How to build? with Armeria, GraphQL, gRPC and Zipkin

Slide 4

Slide 4 text

Agenda - MSA on “SeriesOn” service - Ways to quickly build using Armeria - Why is it better using GraphQL - How to monitor the service? - Summary

Slide 5

Slide 5 text

SeriesOn About OTT video streaming service of NAVER WEBTOON

Slide 6

Slide 6 text

MSA on SeriesOn From the past… Monolithic SQL Driven Service Difficulty in service expansion

Slide 7

Slide 7 text

MSA on SeriesOn Motivation FRONT API SERVICE APP WEB TV EXTERNAL APP SERVICE WEB SERVICE TV SERVICE EXTERNAL SERVICE AGGREGATION SERVICE META AUTH PAYMENT ETC (Components) CLIENTS AGGREGATION SERVICE BACKEND MICROSERVICE

Slide 8

Slide 8 text

MSA on SeriesOn Motivation - Backend services does not directly called by client. - The role of aggregating each data after checking what data is required through front API services Aggregation services Backend services - Server components responsible for multiple business logic - Such as authorization, contents playing, payment and movie meta etc .. Front API services - Manage the client-specific authentication and API invocation

Slide 9

Slide 9 text

SeriesOn MSA Important to consider while implementing components - gRPC + Protobuf , Cache … Light and fast Generate API auto-documentation - Swagger … Support asynchronous - Reactive, Coroutine … Support distributed tracing - Pinpoint, Zipkin …

Slide 10

Slide 10 text

Apply Armeria and gRPC using boilerplate within the team Ways to quickly build using Armeria

Slide 11

Slide 11 text

Ways to quickly build using Armeria Apply Armeria with gRPC Armeria (https://armeria.dev) - Powered by LINE (current version : 1.12.0) - Go-to microservice framework - Support gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.

Slide 12

Slide 12 text

Ways to quickly build using Armeria Apply Armeria with gRPC Armeria (https://armeria.dev) - Support HTTP/2 - Integration with gRPC and Thrift - gRPC-over-HTTP/1 & 2 - Thrift-over-HTTP/1 & 2 - gRPC-Web - Essential features for building microservices - Metrics - Circuit breaker - Distributed call tracing via Zipkin - Completely asynchronous and reactive - Even higher performance on Linux

Slide 13

Slide 13 text

Ways to quickly build using Armeria Armeria with productive combination Kotlin + Coroutine Spring DI gRPC

Slide 14

Slide 14 text

Ways to quickly build using Armeria gRPC weakness - Limited browser support - Not human readable

Slide 15

Slide 15 text

Ways to quickly build using Armeria Armeria with gRPC strength Enables automatic documentation - Can be called directly from the web without using a separate gRPC testing tool (e.g. bloomRPC) - Most frequently used features ! Unlike the native gRPC server, it supports various mime-types with a single port. - application/grpc+proto - application/grpc-web+json - application/grpc-web+proto - application/grpc-web-text+proto - application/json; charset=utf-8; protocol=gRPC - application/protobuf; protocol=gRPC

Slide 16

Slide 16 text

Ways to quickly build using Armeria Armeria with gRPC strength – Auto documentation Example protobuf e.g. LibraryService Auto documentation Automatic protobuf-based documentation and testing like Swaggers. Documenting time is greatly reduced

Slide 17

Slide 17 text

Ways to quickly build using Armeria Armeria with gRPC strength – gRPC API Testing Human readable testing Enable to test gRPC using json body.

Slide 18

Slide 18 text

Ways to quickly build using Armeria Apply boilerplate within the team Add Title 40pt - Add your Text here / Arial, normal, 35pt - Add your Text here / Arial, normal, 35pt Add Title 40pt Add Title 40pt - Set of common frameworks and library dependencies. - Initialize project using a single-line command - Helm charts for Kubernetes - Gradle based project A set of common rules within the team auth-service payment-service meta-service

Slide 19

Slide 19 text

Ways to quickly build using Armeria Apply boilerplate within the team Helm chart structure Gradle6 based project structure Logstash App Filebeat Zipkin Brave SpringBoot2 gRPC + Protobuf Nelo2 Helm chart + Ingress Aremria

Slide 20

Slide 20 text

Ways to quickly build using Armeria Summary - Templates of component specifications within the team - No more confusion on project settings - Building up knowledge on Boilerplate can reduce related errors later on. Applying boilerplate within the team Applying Armeria with gRPC - Most of the MSA’s concerns are included, so it can be developed quickly - Possible to focus on business logics - Can develop REST API as well as gRPC - +@ : Useful DocService function

Slide 21

Slide 21 text

Why is it better? How to solve aggregating microservices using GraphQL

Slide 22

Slide 22 text

Why is it better? Backend service aggregation - motivation - E.g. Team A (APP) : “We need meta information in API A” - E.g. Team B (TV) : “Please include coupon information in API B” - E.g. Team C (Player) : “In the C API … .. lol” GraphQL is the best consideration for clients (APP, PC, MOBILE, and TV) Apply GraphQL for requirement implementation faster - It is always a controversial part of service development. Considered the ways to make the API faster, and easier to use - REST API + HATEOAS vs GraphQL

Slide 23

Slide 23 text

Why is it better? Backend service aggregation – generic GraphQL services - Each client can call the required schema using GraphQL query Strength Weakness - Hard to track and debug requests from clients APP WEB TV GQL query A GQL query B GQL query C GraphQL

Slide 24

Slide 24 text

Why is it better? Backend service aggregation – Apply the front API service layer Manage the GraphQL queries and support the authentication. APP WEB TV EXTERNAL APP SERVICE WEB SERVICE TV SERVICE EXTERNAL SERVICE GraphQL META AUTH PAYMENT ETC ETC ETC Uses GraphQL as a microservices aggregator GQL query

Slide 25

Slide 25 text

Why is it better? Backend service aggregation – Apply the front API service layer E.g. API-Request of the purchased list on TV TV TV SERVICE GraphQL META AUTH PAYMENT ETC ETC ETC /v1/libraries GQL query Meta Library, Auth libraryGroups { … rightContext { deviceUseContext { … } }, product { title } }

Slide 26

Slide 26 text

Why is it better? Backend service aggregation – Apply the front API service layer E.g. API-Request of the purchased list on TV

Slide 27

Slide 27 text

Why is it better? Backend service aggregation – Summary - Possible for versioning GraphQL query and history management for each client - Both of the strengths of GraphQL and the Rest API can be utilized (hybrid). Apply to the front API service layer Use GraphQL as a microservices aggregator - Get closer to the client team (?) - Elegantly solve N+1 problems using the graphql batch dataLoader - The more dataLoader for the model, the faster speed in development - Since GraphQL is flexible, it is necessary to design the initial schema well

Slide 28

Slide 28 text

How to monitor? Monitoring tips on the microservice using Zipkin and Elasticsearch.

Slide 29

Slide 29 text

How to monitor? motivation - ELK (Elasticsearch, Logstash, Kibana) based logging on Kubernetes Components access logs Distributed tracing & monitoring - Zipkin with ELK (Elasticsearch, Logstash, Kibana) Exception tracing & alarm - Nelo2

Slide 30

Slide 30 text

How to monitor? Microservices monitoring - gRPC access logs When pods are deployed on Kubernetes, that bundle app container with Filebeat and Logstash Ingress Armeria APP Filebeat Logstash Elasticsearch

Slide 31

Slide 31 text

How to monitor? Microservices monitoring - gRPC access logs

Slide 32

Slide 32 text

How to monitor? Microservices monitoring - using Zipkin and Elasticsearch - Provides Zipkin Tracing Integration from Armeria - Easily connects to existing legacy Springboot components (using Sleuth, Brave) - Support storages : Cassandra, MySQL, Elasticsearch - Can be easily setup using zipkin-server, zipkin-ui and zipkin-dependency - Combination of Zipkin and Elasticsearch is considered the most flexible Zipkin (https://zipkin.io)

Slide 33

Slide 33 text

How to monitor? Microservices monitoring - using Zipkin and Elasticsearch Filter by requested service, spanName, and tagQuery

Slide 34

Slide 34 text

How to monitor? Microservices monitoring - using Zipkin and Elasticsearch Trace which GraphQL query is called from which services

Slide 35

Slide 35 text

How to monitor? Microservices monitoring - using Zipkin and Elasticsearch Both Kibana dashboard setup and alert are possible based on data stored in Elasticsearch

Slide 36

Slide 36 text

How to monitor? Microservices monitoring - Distributed tracing on asynchronous components - Request from the same thread are not guaranteed. - (Important) Should try not to lose the TraceContext in the same request. In an asynchronous environment (Reactive, Coroutine)

Slide 37

Slide 37 text

How to monitor? Microservices monitoring - Distributed tracing on asynchronous components E.g. Case in which TraceContext was delivered normally TV SERVICE GraphQL META AUTH CONFIG (Thread-1) Parent spanA + spanB (Thread-2) Parent spanA + spanC (Thread-3) Parent spanA + spanD /v1/libraries - spanA spanA + spanB spanA + spanC spanA + spanD Traceable /v1/libraries spanA

Slide 38

Slide 38 text

How to monitor? Microservices monitoring - Distributed tracing on asynchronous components E.g. Case in which TraceContext was delivered abnormally (losing TraceContext) TV SERVICE GraphQL META AUTH CONFIG (Thread-1) spanB (losing spanA) /v1/libraries spanA (Thread-2) spanC (losing spanA) (Thread-3) spanD (losing spanA) /v1/libraries - spanA spanB spanC spanC Untraceable – Each request is recognized as one request

Slide 39

Slide 39 text

How to monitor? Microservices monitoring - Distributed tracing on asynchronous components - When converting to Mono or Flux, need to pass TraceContext if running in different ThreadPool - Or pre-specify with subscribeOn so that it can be executed in one Thread In reactive

Slide 40

Slide 40 text

How to monitor? Microservices monitoring - Distributed tracing on asynchronous components - Like reactive, this can be solved by injecting a CoroutineContext - Armeria will support coroutine context injection in version 1.12.0 In coroutine

Slide 41

Slide 41 text

Summary final microservices architecture APP SERVICE TV SERVICE PC SERVICE Zipkin API Elasticsearch Logstash GraphQL GraphQL query Zipkin SPAN LOG API GATEWAY Kibana DASHBOARD VISUALIZATION Filebeat gRPC/HTTP Zipkin DEPENDENCY NELO2 ERROR LOG FRONT API LAYER AGG LAYER BACKEND LAYER GRPC ACCESS LOG

Slide 42

Slide 42 text

Faster project settings & development Better enhanced gRPC usability Summary with Armeria, GraphQL, gRPC and Zipkin More flexible aggregation Stronger support distributed tracing

Slide 43

Slide 43 text

Thank you

Slide 44

Slide 44 text

Reference gRPC weaknesses - https://docs.microsoft.com/en-us/aspnet/core/grpc/comparison?view=aspnetcore-5.0 Armeria architecture - https://armeria.dev - https://engineering.linecorp.com/ko/blog/reactive-streams-with-armeria-2/ - https://deview.kr/2019/schedule/283