SlideShare una empresa de Scribd logo
1 de 38
Descargar para leer sin conexión
이희승 (@trustin) / 開発1センター / LINE
Building Asynchronous
Microservices with Armeria
Armeriaで始める非同期Microservice開発
Why build another
microservice framework?
Asynchrony
●
Most web frameworks are blocking and synchronous.
– 1000 concurrent requests require 1000 threads.
– In modern systems, a service sends requests to another backend.
– Threads are busy doing nothing but just waiting for the backend.
– Request queue is not consumed fast enough.
– Result:
●
Fragile system that falls apart even on a tiny backend failure
●
Inefficient system that takes more memory and CPU than what it actually does
Reactive Streams
●
Should we really buffer everything until a response is sent?
– Retrieving 100,000 rows from a table
●
Why should a client send many requests to reduce the server memory
pressure?
– Retrieving 1,000 rows 100 times
●
What if we want to stream infinitely?
– Stock quotes
●
Our protocol is not a problem here.
– Our ‘blocking’ programming model is blocking ‘us’.
Better RPC support
●
RPC has been hardly a 1st-class citizen in web
frameworks.
– Distinction from RPC-level and HTTP-level failure
– Access logs with RPC-level details
– Debugging console
●
What if …
– We build a microservice framework with RPC at its core?
More reasons back in 2015
●
Leverage Java 8 syntax
– Lambda expressions
– Default interface methods
– Static interface methods
●
Provide ‘working’ HTTP/2 implementation
– ‘H2C’ support (HTTP/2 over ‘C’leartext)
– OpenSSL-based faster TLS connection
Better UX for devs
●
This is the last yet most important part.
●
Nobody wants a framework that’s hard to use.
●
Can we design …
– a user-friendly asynchronous programming API
– … with modest learning curve?
Our answer – Armeria
●
HTTP/2
– Both ciphertext and cleartext, a.k.a. h2 and h2c
●
Reactive
– Implements Reactive Streams API
●
Ability to mix different types of services in a single server
– gRPC, Thrift, REST services
– Legacy webapps via embedded Tomcat or Jetty
●
High-performance
– Netty with /dev/epoll transport and BoringSSL SSLEngine
●
Easy to learn and fun to use (hopefully)
Armeria by examples
HTTP / REST
Hello, world!
Hello, world – Parameterized
Hello, world – Annotated
With CompletableFuture
Streaming a million integers
There are more!
●
Query parameters
●
Request and response converters
●
Exception handlers
●
Content type negotiation
●
Regular-expression path mapping
●
Aims to be on-par or better than <your favorite web framework>
Armeria by examples
Thrift and gRPC
gRPC & Thrift basics
a. Write an IDL file – .proto or .thrift
b. A compiler compiles it into .java files.
c. Implement interfaces generated at ‘b’.
gRPC
Thrift
Decorating services
Separation of concerns
Intercepting an HTTP request
Intercepting a RPC request
●
Complete access to the RPC call information
●
Override the parameters and methods
Decorator as core extension mechanism
●
Request throttling
●
Metric collection
●
Distributed tracing (Zipkin)
●
HTTP content encoding
●
HTTP authn/z
●
CORS
●
Circuit breakers
●
Automatic retries
●
…
Distributed tracing with Brave·Zipkin
Playing better with RPC
Armeria documentation service
Armeria documentation service
●
Enabled by adding DocService to ServerBuilder
●
Browse and invoke RPC services in an Armeria server
●
Supports both gRPC and Thrift
●
We have a plan to add:
– Support for plain HTTP, like Swagger
– Metric monitoring console
– Runtime configuration editor, e.g. logger level
●
Share the URL to reproduce a call.
All the pieces fit together
The ultimate all-in-one micro(?) service
What about client-side?
Armeria client API
●
Similar experience to the server-side API
– e.g. Common type, Decorators, RPC-friendliness
●
Client-specific stuff
– Circuit breakers
– Automatic retries
– Client-side load balancing
– Retrofit integration
Got interested?
Let’s build Armeria together!
●
Use it.
●
Ask questions.
●
Request new features.
●
Tell us what rocks and sucks.
●
Consider joining the effort.
Meet us at GitHub and Slack
●
https://github.com/line/armeria
●
https://line-slacknow.herokuapp.com/line-armeria/

Más contenido relacionado

La actualidad más candente

AGS_Estatal Master 2023_Resultados generales.pdf
AGS_Estatal Master 2023_Resultados generales.pdfAGS_Estatal Master 2023_Resultados generales.pdf
AGS_Estatal Master 2023_Resultados generales.pdf
agssports.com
 

La actualidad más candente (10)

Hyster b274 (h50 ct) forklift service repair manual
Hyster b274 (h50 ct) forklift service repair manualHyster b274 (h50 ct) forklift service repair manual
Hyster b274 (h50 ct) forklift service repair manual
 
Outlet and Plug Types Photos
Outlet and Plug Types PhotosOutlet and Plug Types Photos
Outlet and Plug Types Photos
 
Support de cours dynamique des gaz
Support de cours dynamique des gazSupport de cours dynamique des gaz
Support de cours dynamique des gaz
 
Tabela espessura chapas_finas
Tabela espessura chapas_finasTabela espessura chapas_finas
Tabela espessura chapas_finas
 
Tipos de fogueiras
Tipos de fogueirasTipos de fogueiras
Tipos de fogueiras
 
Archer Modular Rigs
Archer Modular RigsArcher Modular Rigs
Archer Modular Rigs
 
Planejamento anual de classes 01
Planejamento anual de classes 01Planejamento anual de classes 01
Planejamento anual de classes 01
 
Boxer BM 150 UG 2022.pdf
Boxer BM 150 UG 2022.pdfBoxer BM 150 UG 2022.pdf
Boxer BM 150 UG 2022.pdf
 
AGS_Estatal Master 2023_Resultados generales.pdf
AGS_Estatal Master 2023_Resultados generales.pdfAGS_Estatal Master 2023_Resultados generales.pdf
AGS_Estatal Master 2023_Resultados generales.pdf
 
Fogueiras e cozinha ao ar livre
Fogueiras e cozinha ao ar livreFogueiras e cozinha ao ar livre
Fogueiras e cozinha ao ar livre
 

Similar a Building Asynchronous Microservices with Armeria

Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
RX-M Enterprises LLC
 

Similar a Building Asynchronous Microservices with Armeria (20)

Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
 
WebSocket MicroService vs. REST Microservice
WebSocket MicroService vs. REST MicroserviceWebSocket MicroService vs. REST Microservice
WebSocket MicroService vs. REST Microservice
 
The Internet of Things ... Babel
The Internet of Things ... BabelThe Internet of Things ... Babel
The Internet of Things ... Babel
 
Apache Thrift, a brief introduction
Apache Thrift, a brief introductionApache Thrift, a brief introduction
Apache Thrift, a brief introduction
 
gRPC Design and Implementation
gRPC Design and ImplementationgRPC Design and Implementation
gRPC Design and Implementation
 
HTTP/2
HTTP/2HTTP/2
HTTP/2
 
Netflix Massively Scalable, Highly Available, Immutable Infrastructure
Netflix Massively Scalable, Highly Available, Immutable InfrastructureNetflix Massively Scalable, Highly Available, Immutable Infrastructure
Netflix Massively Scalable, Highly Available, Immutable Infrastructure
 
The new (is it really ) api stack
The new (is it really ) api stackThe new (is it really ) api stack
The new (is it really ) api stack
 
Web technology-guide
Web technology-guideWeb technology-guide
Web technology-guide
 
Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
 
Achieving mass scale with Quasar Fibers
Achieving mass scale with Quasar FibersAchieving mass scale with Quasar Fibers
Achieving mass scale with Quasar Fibers
 
Realtime traffic analyser
Realtime traffic analyserRealtime traffic analyser
Realtime traffic analyser
 
gRPC
gRPCgRPC
gRPC
 
Otimizando servidores web
Otimizando servidores webOtimizando servidores web
Otimizando servidores web
 
Advanced web application architecture - Talk
Advanced web application architecture - TalkAdvanced web application architecture - Talk
Advanced web application architecture - Talk
 
Api 101
Api 101Api 101
Api 101
 
Zero Downtime JEE Architectures
Zero Downtime JEE ArchitecturesZero Downtime JEE Architectures
Zero Downtime JEE Architectures
 
Stevens Hfc2010
Stevens Hfc2010Stevens Hfc2010
Stevens Hfc2010
 
LEC_10_Week_10_Server_Configuration_in_Linux.pdf
LEC_10_Week_10_Server_Configuration_in_Linux.pdfLEC_10_Week_10_Server_Configuration_in_Linux.pdf
LEC_10_Week_10_Server_Configuration_in_Linux.pdf
 
APIs & Underlying Protocols #APICraftSF
APIs & Underlying Protocols #APICraftSFAPIs & Underlying Protocols #APICraftSF
APIs & Underlying Protocols #APICraftSF
 

Más de LINE Corporation

Más de LINE Corporation (20)

JJUG CCC 2018 Fall 懇親会LT
JJUG CCC 2018 Fall 懇親会LTJJUG CCC 2018 Fall 懇親会LT
JJUG CCC 2018 Fall 懇親会LT
 
Reduce dependency on Rx with Kotlin Coroutines
Reduce dependency on Rx with Kotlin CoroutinesReduce dependency on Rx with Kotlin Coroutines
Reduce dependency on Rx with Kotlin Coroutines
 
Kotlin/NativeでAndroidのNativeメソッドを実装してみた
Kotlin/NativeでAndroidのNativeメソッドを実装してみたKotlin/NativeでAndroidのNativeメソッドを実装してみた
Kotlin/NativeでAndroidのNativeメソッドを実装してみた
 
Use Kotlin scripts and Clova SDK to build your Clova extension
Use Kotlin scripts and Clova SDK to build your Clova extensionUse Kotlin scripts and Clova SDK to build your Clova extension
Use Kotlin scripts and Clova SDK to build your Clova extension
 
The Magic of LINE 購物 Testing
The Magic of LINE 購物 TestingThe Magic of LINE 購物 Testing
The Magic of LINE 購物 Testing
 
GA Test Automation
GA Test AutomationGA Test Automation
GA Test Automation
 
UI Automation Test with JUnit5
UI Automation Test with JUnit5UI Automation Test with JUnit5
UI Automation Test with JUnit5
 
Feature Detection for UI Testing
Feature Detection for UI TestingFeature Detection for UI Testing
Feature Detection for UI Testing
 
LINE 新星計劃介紹與新創團隊分享
LINE 新星計劃介紹與新創團隊分享LINE 新星計劃介紹與新創團隊分享
LINE 新星計劃介紹與新創團隊分享
 
​LINE 技術合作夥伴與應用分享
​LINE 技術合作夥伴與應用分享​LINE 技術合作夥伴與應用分享
​LINE 技術合作夥伴與應用分享
 
LINE 開發者社群經營與技術推廣
LINE 開發者社群經營與技術推廣LINE 開發者社群經營與技術推廣
LINE 開發者社群經營與技術推廣
 
日本開發者大會短講分享
日本開發者大會短講分享日本開發者大會短講分享
日本開發者大會短講分享
 
LINE Chatbot - 活動報名報到設計分享
LINE Chatbot - 活動報名報到設計分享LINE Chatbot - 活動報名報到設計分享
LINE Chatbot - 活動報名報到設計分享
 
在 LINE 私有雲中使用 Managed Kubernetes
在 LINE 私有雲中使用 Managed Kubernetes在 LINE 私有雲中使用 Managed Kubernetes
在 LINE 私有雲中使用 Managed Kubernetes
 
LINE TODAY高效率的敏捷測試開發技巧
LINE TODAY高效率的敏捷測試開發技巧LINE TODAY高效率的敏捷測試開發技巧
LINE TODAY高效率的敏捷測試開發技巧
 
LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹
LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹
LINE 區塊鏈平台及代幣經濟 - LINK Chain及LINK介紹
 
LINE Things - LINE IoT平台新技術分享
LINE Things - LINE IoT平台新技術分享LINE Things - LINE IoT平台新技術分享
LINE Things - LINE IoT平台新技術分享
 
LINE Pay - 一卡通支付新體驗
LINE Pay - 一卡通支付新體驗LINE Pay - 一卡通支付新體驗
LINE Pay - 一卡通支付新體驗
 
LINE Platform API Update - 打造一個更好的Chatbot服務
LINE Platform API Update - 打造一個更好的Chatbot服務LINE Platform API Update - 打造一個更好的Chatbot服務
LINE Platform API Update - 打造一個更好的Chatbot服務
 
Keynote - ​LINE 的技術策略佈局與跨國產品開發
Keynote - ​LINE 的技術策略佈局與跨國產品開發Keynote - ​LINE 的技術策略佈局與跨國產品開發
Keynote - ​LINE 的技術策略佈局與跨國產品開發
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 

Building Asynchronous Microservices with Armeria

  • 1. 이희승 (@trustin) / 開発1センター / LINE Building Asynchronous Microservices with Armeria Armeriaで始める非同期Microservice開発
  • 3. Asynchrony ● Most web frameworks are blocking and synchronous. – 1000 concurrent requests require 1000 threads. – In modern systems, a service sends requests to another backend. – Threads are busy doing nothing but just waiting for the backend. – Request queue is not consumed fast enough. – Result: ● Fragile system that falls apart even on a tiny backend failure ● Inefficient system that takes more memory and CPU than what it actually does
  • 4. Reactive Streams ● Should we really buffer everything until a response is sent? – Retrieving 100,000 rows from a table ● Why should a client send many requests to reduce the server memory pressure? – Retrieving 1,000 rows 100 times ● What if we want to stream infinitely? – Stock quotes ● Our protocol is not a problem here. – Our ‘blocking’ programming model is blocking ‘us’.
  • 5. Better RPC support ● RPC has been hardly a 1st-class citizen in web frameworks. – Distinction from RPC-level and HTTP-level failure – Access logs with RPC-level details – Debugging console ● What if … – We build a microservice framework with RPC at its core?
  • 6. More reasons back in 2015 ● Leverage Java 8 syntax – Lambda expressions – Default interface methods – Static interface methods ● Provide ‘working’ HTTP/2 implementation – ‘H2C’ support (HTTP/2 over ‘C’leartext) – OpenSSL-based faster TLS connection
  • 7. Better UX for devs ● This is the last yet most important part. ● Nobody wants a framework that’s hard to use. ● Can we design … – a user-friendly asynchronous programming API – … with modest learning curve?
  • 8. Our answer – Armeria ● HTTP/2 – Both ciphertext and cleartext, a.k.a. h2 and h2c ● Reactive – Implements Reactive Streams API ● Ability to mix different types of services in a single server – gRPC, Thrift, REST services – Legacy webapps via embedded Tomcat or Jetty ● High-performance – Netty with /dev/epoll transport and BoringSSL SSLEngine ● Easy to learn and fun to use (hopefully)
  • 11. Hello, world – Parameterized
  • 12. Hello, world – Annotated
  • 15.
  • 16. There are more! ● Query parameters ● Request and response converters ● Exception handlers ● Content type negotiation ● Regular-expression path mapping ● Aims to be on-par or better than <your favorite web framework>
  • 18. gRPC & Thrift basics a. Write an IDL file – .proto or .thrift b. A compiler compiles it into .java files. c. Implement interfaces generated at ‘b’.
  • 19. gRPC
  • 23. Intercepting a RPC request ● Complete access to the RPC call information ● Override the parameters and methods
  • 24. Decorator as core extension mechanism ● Request throttling ● Metric collection ● Distributed tracing (Zipkin) ● HTTP content encoding ● HTTP authn/z ● CORS ● Circuit breakers ● Automatic retries ● …
  • 25. Distributed tracing with Brave·Zipkin
  • 26. Playing better with RPC Armeria documentation service
  • 27. Armeria documentation service ● Enabled by adding DocService to ServerBuilder ● Browse and invoke RPC services in an Armeria server ● Supports both gRPC and Thrift ● We have a plan to add: – Support for plain HTTP, like Swagger – Metric monitoring console – Runtime configuration editor, e.g. logger level
  • 28.
  • 29.
  • 30. ● Share the URL to reproduce a call.
  • 31. All the pieces fit together The ultimate all-in-one micro(?) service
  • 32.
  • 34. Armeria client API ● Similar experience to the server-side API – e.g. Common type, Decorators, RPC-friendliness ● Client-specific stuff – Circuit breakers – Automatic retries – Client-side load balancing – Retrofit integration
  • 35.
  • 37. Let’s build Armeria together! ● Use it. ● Ask questions. ● Request new features. ● Tell us what rocks and sucks. ● Consider joining the effort.
  • 38. Meet us at GitHub and Slack ● https://github.com/line/armeria ● https://line-slacknow.herokuapp.com/line-armeria/