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
830
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
いつか使える ObjectSpace / Maybe useful ObjectSpace
euglena1215
2
89
rbs-inlineを導入してYARDからRBSに移行する
euglena1215
1
200
Ruby の型に関する活動をやっている話 / Activities related to Ruby types
euglena1215
3
210
そろそろ理解する includes / Understanding includes
euglena1215
1
750
習うより慣れる Ruby AST / Ruby AST is better to get used to than to learn.
euglena1215
2
340
Railsでエンドポイントごとのテストカバレッジを測定する / Measuring Test Coverage per Endpoint in Rails
euglena1215
1
360
初めてrails/railsにバグレポートを出してみた
euglena1215
0
170
XXXSerializer#to_json を地道に置き換えている話
euglena1215
0
140
GitHub Copilot を使って自作ライブラリを作ってみよう/ Let's create your own library using GitHub Copilot!
euglena1215
0
280
Other Decks in Technology
See All in Technology
Building Static Websites with Sculpin
opdavies
0
1.4k
Oracle Exadata Database Service(Dedicated Infrastructure):サービス概要のご紹介
oracle4engineer
PRO
0
9.4k
Practical GenAI with Go - Elastic and Golang Sydney
adriancole
0
130
分野に潜むツールの紹介
pojiro
1
330
脆弱星に導かれて
nishimunea
1
1.5k
Namespace, Now and Then
tagomoris
0
170
すぐに始めるAWSコスト削減。短期でできる改善策と長期的な運用負荷軽減への取り組み方を解説
ncdc
1
260
エンジニア視点で見る、 組織で運用されるデザインシステムにするには
shunya078
1
190
開発者体験を意識した開発チームの生産性向上の取り組み
ham0215
3
660
Staff Engineer / 20240827 Yuichiro Masui
shift_evolve
0
150
Chunk computing
matyo91
0
270
PlaywrightによるE2Eテスト入門 / Introduction to E2E Testing with Playwright
rhumie
3
920
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
53
8.9k
Testing 201, or: Great Expectations
jmmastey
35
6.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
22
580
GraphQLとの向き合い方2022年版
quramy
43
13k
A designer walks into a library…
pauljervisheath
201
24k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
248
20k
The Illustrated Children's Guide to Kubernetes
chrisshort
46
48k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
42
2k
Optimising Largest Contentful Paint
csswizardry
28
2.7k
Embracing the Ebb and Flow
colly
83
4.4k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
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 ͕ී௨ʹ͑Δ ঢ়ଶʹͳΔ·Ͱ͍͖ͬͯ