Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Microservice with go and gRPC
Search
Eunju Amy Sohn
November 05, 2018
Programming
1
550
Microservice with go and gRPC
2018 GDG DevFest - go와 gRPC로 함께하는 마이크로서비스
Eunju Amy Sohn
November 05, 2018
Tweet
Share
More Decks by Eunju Amy Sohn
See All by Eunju Amy Sohn
내가 커뮤니티 스피킹을 하는 이유
ejsohn
1
360
Cloud Deep Learning for everyone
ejsohn
0
150
Spot Utilization for GPU Instance Cost Efficiency
ejsohn
0
85
40만명이 쓰는 Django channels 채팅서버, 우리는 어떻게 만들었나?
ejsohn
1
2.4k
Implementing Reactive Programming with ReSwift
ejsohn
0
170
Other Decks in Programming
See All in Programming
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
820
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
720
MCP with Cloudflare Workers
yusukebe
2
230
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
300
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
160
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
950
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
130
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
730
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
Online-Dokumentation, die hilft: Strukturen, Prozesse, Tools
ahus1
0
100
Kaigi on Railsに初参加したら、その日にLT登壇が決定した件について
tama50505
0
110
fs2-io を試してたらバグを見つけて直した話
chencmd
0
240
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Optimising Largest Contentful Paint
csswizardry
33
3k
Testing 201, or: Great Expectations
jmmastey
41
7.1k
The World Runs on Bad Software
bkeepers
PRO
66
11k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Automating Front-end Workflow
addyosmani
1366
200k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Writing Fast Ruby
sferik
628
61k
Unsuck your backbone
ammeep
669
57k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Transcript
, / EJSohn Korea go gRPC
- - - - - Korea
- go - REST .. gRPC ..? - gRPC -
- Korea
- What is gRPC? - Let s make it! (a.k.a
coding time) - gRPC features - Why Microservice? - Summary Korea
What is gRPC? Korea
gRPC Users
History of Server - Client communication Socket RPC CORBA DCOM
SOAP REST RMI 1983~ 1980s~1990s 1998~ 1999~ ~ ~ ~
History of Server - Client communication Socket RPC CORBA DCOM
SOAP REST RMI 1983~ 1980s~1990s 1998~ 1999~ ~ ~ ~ ?
History of Server - Client communication Socket RPC CORBA DCOM
SOAP REST RMI 1983~ 1980s~1990s 1998~ 1999~ ~ ~ ~ Socket .
History of Server - Client communication RPC (Remote Procedure Call)
• RPC • . • .
History of Server - Client communication Socket RPC CORBA DCOM
SOAP REST RMI 1983~ 1980s~1990s 1998~ 1999~ ~ ~ ~ RPC .. !
History of Server - Client communication Socket RPC CORBA DCOM
SOAP REST RMI 1983~ 1980s~1990s 1998~ 1999~ ~ ~ ~ HTTP . SOAP - XML REST - ( )JSON
History of Server - Client communication Socket RPC CORBA DCOM
SOAP REST RMI 1983~ 1980s~1990s 1998~ 1999~ ~ ~ ~ HTTP . SOAP - XML REST - ( )JSON
History of Server - Client communication gRPC (google Remote Procedure
Call) Stubby RPC Stubby
How it works gRPC • Stub • IDL (Interface Description
Language) • Protocol Buffers
How it works? RPC - Stub • . • Polyglot
programming
How it works gRPC • Stub • IDL (Interface Description
Language) - - Stub • Protocol Buffers
How it works gRPC • Stub • IDL (Interface Description
Language) • Protocol Buffers - (serialization) - IDL stub service interface code
How it works gRPC
None
None
gRPC service outline API - Unary RPC Model (User) -
name, age, cache API - cache - cache User Server lang - go Client lang - python
Go • google • Docker, Kubernetes, Packer • • gRPC
gRPC tool ( https:// github.com/grpc-ecosystem/ awesome-grpc )
api.proto file
Proto3 Protocol buffers language Version: proto2(default) & proto3 Service Message
type Service field type generally scalar, enum or other message types filed number message .
api.proto file Version Service Message Field type Field number
Protocol Buffers stub, service interface code • protoc • .proto
service interface code =
. go / python
- go api.pb.go
- go api.pb.go
How it works - Again gRPC
gRPC Go Server interface *pb=imported service interface code
Context in golang For deadlines, cancelation, and requested-scoped values -
- cancelation goroutine? - go - Dave Cheny Never start a goroutine without knowing how it will stop
gRPC Go Server - 1 NewServer
gRPC Go Server - 2 RunServer
gRPC Python Client
Try it out! Compile and Run • Server • Client
Diagram Unary RPC Diagram Client Server Request Response
Diagram Stream RPC Diagram Client Server Message Message Message Message
Message Message Example: Chatting
Diagram RPC with goroutine & channel Diagram - 1 Client
Server 1 Request Response Server 2 Request Response
gRPC tips .proto - - git submodule .proto message -
Load balancing - low-latency gRPC client-side LB
gRPC Pros 1.
gRPC Pros 2. .. • HTTP/2 default, binary data, header
compression, cancellation propagation • Google App Engine n1-highcpu-16 CPU 11
gRPC Pros Others • • - , Tracing, Load Balancing,
Health checking
gRPC Cons • - HTTP . (curl, postman..) ..?
gRPC compare with REST • , , REST . •
.. !
Go s http request multiplexer Content-type base routing application/grpc ->
direct grpc else -> grpc-gateway https://github.com/grpc- ecosystem/grpc-gateway
Go s http request multiplexer Alternative way
why gRPC is good at Microservice? What is Microservice •
• / . • ? - - - -
None
why gRPC is good at Microservice? Microservice gRPC • •
• gRPC network latency • typing/versioning •
Summary go grpc • Microservice gRPC • Polyglot • REST
Resources References & Resources • reference tutorial Github . •
https://github.com/EJSohn/microservice-with-go-and-grpc
! Q&A -