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
Ruby gRPCを使って「ちゃんと」サービスを作る / Make a service pro...
Search
Shintani Teppei
December 18, 2019
Technology
1
890
Ruby gRPCを使って「ちゃんと」サービスを作る / Make a service properly using Ruby gRPC
Shintani Teppei
December 18, 2019
Tweet
Share
More Decks by Shintani Teppei
See All by Shintani Teppei
モジュラモノリス、その前に / Modular monolith, before that
euglena1215
8
880
いつか使える ObjectSpace / Maybe useful ObjectSpace
euglena1215
2
170
rbs-inlineを導入してYARDからRBSに移行する
euglena1215
1
520
Ruby の型に関する活動をやっている話 / Activities related to Ruby types
euglena1215
3
280
そろそろ理解する includes / Understanding includes
euglena1215
1
850
習うより慣れる Ruby AST / Ruby AST is better to get used to than to learn.
euglena1215
2
440
Railsでエンドポイントごとのテストカバレッジを測定する / Measuring Test Coverage per Endpoint in Rails
euglena1215
1
430
初めてrails/railsにバグレポートを出してみた
euglena1215
0
210
XXXSerializer#to_json を地道に置き換えている話
euglena1215
0
150
Other Decks in Technology
See All in Technology
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
250
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
160
宇宙ベンチャーにおける最近の情シス取り組みについて
axelmizu
0
110
DevOps視点でAWS re:invent2024の新サービス・アプデを振り返ってみた
oshanqq
0
180
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
300
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
0
280
権威ドキュメントで振り返る2024 #年忘れセキュリティ2024
hirotomotaguchi
2
730
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
130
生成AIをより賢く エンジニアのための RAG入門 - Oracle AI Jam Session #20
kutsushitaneko
4
220
Postman と API セキュリティ / Postman and API Security
yokawasa
0
200
podman_update_2024-12
orimanabu
1
260
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
The Pragmatic Product Professional
lauravandoore
32
6.3k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Optimising Largest Contentful Paint
csswizardry
33
3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
97
How to Ace a Technical Interview
jacobian
276
23k
Building Your Own Lightsaber
phodgson
103
6.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Transcript
©2019 Wantedly, Inc. Ruby gRPC Λͬͯ ʮͪΌΜͱʯαʔϏεΛ࡞Δ Scramble Tech ৽ଔLT
Dec 18, 2019 - Teppei Shintani
©2019 Wantedly, Inc. About me Teppei Shintani @euglena1215 • ’19
Wantedly new grads • Server side engineer • Wantedly Visit ืूػೳͷϚΠΫϩαʔϏεԽ • Ruby ❤ • ϚΠΫϩαʔϏεԽ͍͖ͬͯ
©2019 Wantedly, Inc. gRPCͱʁ ͱʁ
©2019 Wantedly, Inc. Google ͕࡞ͬͨ ݴޠඇґଘͷ௨৴ϓϩτίϧ gRPCͱʁ
©2019 Wantedly, Inc.
©2019 Wantedly, Inc. gRPC library Google ͕ ϝΠϯͰ։ൃΛߦ͍ͬͯΔ
©2019 Wantedly, Inc. ֤ݴޠͷख़ GoogleͷϞνϕʔγϣϯ࣍ୈ
©2019 Wantedly, Inc. Ruby gRPC ͷख़্͕͕Βͳ͍ Ruby gRPC ͷपลϥΠϒϥϦ͕ू·Βͳ͍
©2019 Wantedly, Inc. ݫ͍͠ڥͷ Ruby gRPC Λͬͯ αʔϏεΛ࡞͍ͬͯͨ͘Ίʹ
©2019 Wantedly, Inc. •൚༻తͳ grpc interceptor •։ൃੜ࢈ੑ্͛ΔϥΠϒϥϦ •Ruby gRPC best
practice ͷࡧ ͍ͬͯΔ͜ͱ
©2019 Wantedly, Inc. grpc interceptorͱʁ ൚༻తͳgrpc interceptor grpc interceptor ͱ௨৴(rpcݺͼ
ग़͠)ͷલޙͰಛఆͷॲཧΛΈࠐΊ Δػߏɻ express, rack middleware ͱ͍ͩ ͍ͨಉ͡ͱ͍͑ΘΔਓΘΔ ͔
©2019 Wantedly, Inc. ࡞ͬͨ grpc interceptor ൚༻తͳgrpc interceptor • ΤϥʔΛࢹαʔϏεʹૹͬͯ͘ΕΔ͘Μ
• Ruby/Rails ґଘͷΤϥʔΛ gRPC Τϥʔʹม͢Δ͘Μ • activerecord ͷ connection Λྑ͍ײ͡ʹ͍ճ͘͢Μ •ΞΫηεϩάΛͱͬͯҙͷproviderૹ৴͢Δ͘Μ by @south37 • newrelic ʹ metrics Λૹ৴ͯ͘͠ΕΔ͘Μ by @south37
©2019 Wantedly, Inc. Protocol Buffersͷੑ࣭ ։ൃੜ࢈ੑ্͛ΔϥΠϒϥϦ • field શͯ optional
• proto2 Ͱ required field ͕ଘࡏ͕ͨ͠ɺproto3Ͱશͯ optional ʹͳͬͨ • required ͳ field Λഇࢭͨ͘͠ͳͬͨͱ͖ʹޙํޓΛҡ࣋͢Δͷ͕͍͠ ΞϓϦέʔγϣϯଆͷϩδοΫͰ null ͔Ͳ͏͔ΛνΣοΫ͢Δඞཁ͕͋Δ ΊͪΌͪ͘Ό໘
©2019 Wantedly, Inc. grpc_required_annotator ։ൃੜ࢈ੑ্͛ΔϥΠϒϥϦ https://github.com/euglena1215/grpc_required_annotator
©2019 Wantedly, Inc. Ruby gRPC best practice ͷࡧ • Rails
ͷݟΛ Ruby gRPC ʹͲ͏ྲྀ༻͢Δ͔ • Rails controller ʹґଘ͍ͯ͠Δ gem Ұ௨Γ͑ͳ͍ • ͲΜͳઃܭʹ͢Δͱ͍͍ͷ͔ʁ • Rails Έ͍ͨʹ DB table ͱ API interface Λີ݁߹ͤͨ͘͞ͳ͍ • MVVM? Ͳ͜·ͰΔʁ
©2019 Wantedly, Inc. Ruby gRPC best practice ͷࡧ • Rails
ͷݟΛ Ruby gRPC ʹͲ͏ྲྀ༻͢Δ͔ • Rails controller ʹґଘ͍ͯ͠Δ gem Ұ௨Γ͑ͳ͍ • ͲΜͳઃܭʹ͢Δͱ͍͍ͷ͔ʁ • Rails Έ͍ͨʹ DB table ͱ API interface Λີ݁߹ͤͨ͘͞ͳ͍ • MVVM? Ͳ͜·ͰΔʁ ͜͜ͷ݁·ͩग़͍ͯͳ͍ɺɺɺ
©2019 Wantedly, Inc. Ruby gRPC ͕ී௨ʹ͑Δ ঢ়ଶʹͳΔ·Ͱ͍͖ͬͯ