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
880
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
820
いつか使える ObjectSpace / Maybe useful ObjectSpace
euglena1215
2
160
rbs-inlineを導入してYARDからRBSに移行する
euglena1215
1
440
Ruby の型に関する活動をやっている話 / Activities related to Ruby types
euglena1215
3
260
そろそろ理解する includes / Understanding includes
euglena1215
1
830
習うより慣れる Ruby AST / Ruby AST is better to get used to than to learn.
euglena1215
2
420
Railsでエンドポイントごとのテストカバレッジを測定する / Measuring Test Coverage per Endpoint in Rails
euglena1215
1
420
初めてrails/railsにバグレポートを出してみた
euglena1215
0
200
XXXSerializer#to_json を地道に置き換えている話
euglena1215
0
150
Other Decks in Technology
See All in Technology
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
170
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
280
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
200
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
0
110
複雑なState管理からの脱却
sansantech
PRO
1
140
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.1k
Amazon Personalizeのレコメンドシステム構築、実際何するの?〜大体10分で具体的なイメージをつかむ〜
kniino
1
100
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
220
これまでの計測・開発・デプロイ方法全部見せます! / Findy ISUCON 2024-11-14
tohutohu
3
360
Terraform CI/CD パイプラインにおける AWS CodeCommit の代替手段
hiyanger
1
240
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
120
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Docker and Python
trallard
40
3.1k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Writing Fast Ruby
sferik
627
61k
Designing for Performance
lara
604
68k
What's in a price? How to price your products and services
michaelherold
243
12k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
860
Mobile First: as difficult as doing things right
swwweet
222
8.9k
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 ͕ී௨ʹ͑Δ ঢ়ଶʹͳΔ·Ͱ͍͖ͬͯ