Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
「ウチも、gRPC使えますか?」
Search
uhzz
October 10, 2021
Programming
360
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
「ウチも、gRPC使えますか?」
uhzz
October 10, 2021
More Decks by uhzz
See All by uhzz
DI コンテナ自動生成ツールを実装してみた / intro-autodi
uhzz
0
1k
Goで実現するGraceful Shutdown ~実運用での課題と解決策~ / Go Conference 2025
uhzz
2
2.1k
MCP調べてみました! / Exploring MCP
uhzz
2
4.2k
自動生成されたhttpエンドポイントごとにカスタムミドルウェアを挿入したい話
uhzz
1
3.1k
Enablement Bootcampを終えて -Enablement Bootcamp for Gopherizing 〜業務で使えるGoを学ぼう〜
uhzz
0
380
安全にQAを行える環境が整いました!- Kyash TechTalk #6 - Kyashの開発をチラ見せ
uhzz
0
910
Goのローカル開発をWorkspacesではじめよう
uhzz
1
1.2k
【Go:パッケージ管理】DepからGo Modulesへ
uhzz
0
1.2k
コードレビューで泣かないためのintSize = 32 << (^uint(0) >> 63)
uhzz
0
290
Other Decks in Programming
See All in Programming
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
2
290
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
120
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
160
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
2.2k
[DroidKnights 2026] Workflow AX: From Auto-Documented Policies to E2E Testing
raeminkang
0
540
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
4
3.7k
オーケストレーション記述言語 Katari
yukikurage
0
240
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
330
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
300
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
620
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
920
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
360
Featured
See All Featured
Technical Leadership for Architectural Decision Making
baasie
3
640
Design in an AI World
tapps
1
380
Between Models and Reality
mayunak
4
560
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.4k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
570
It's Worth the Effort
3n
188
29k
How GitHub (no longer) Works
holman
316
150k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.7k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.9k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
600
Transcript
「ウチも、gRPC使えますか?」 『dev合宿@トスラブ箱根 和奏林』 2021/10/08 - 09 @_uhzz_
whoami🤔 Reo Uehara / 株式会社フクロウラボ twitter: @_uhzz_ github: uh-zz 箱根は静岡だと思ってました🤔
箱根、楽しんでいますか〜 ここに道中撮った写真を貼る
今日話すこと - gRPC is 何? - gRPCの何が嬉しいの? - サンプル実演会(Rails ×
Go) - まとめ
gRPC is 何?
こんなお悩みはないだろうか 実装言語ごとに、似たような関数を新しく作ってるけど、、、うーん🤔 # メッセージを暗号化 def hash(message) return crypt(message) end //
メッセージを暗号化 func hash(message string) string { return crypt(message) }
こんなお悩みはないだろうか 実装言語ごとに、似たような関数を新しく作ってるけど、、、うーん🤔 # メッセージを暗号化 def hash(message) return crypt(message) end //
メッセージを暗号化 func hash(message string) string { return crypt(message) } そのお悩み、解決できるかもしれません
RPC -Remote Procedure Call- // メッセージを暗号化 func hash(message string) string
{ return crypt(message) } サーバーを超えた、リモートでの関数(手続き)呼び出しのこと! 近年ではHTTP/HTTPSベースかつXML/JSON形式でやりとりするWeb API hash関数を呼び出し
gRPC -GoogleによるRPC- 特定の言語やプラットフォームに依存しない、 サーバー/クライアントのコードを自動生成するフレームワーク https://grpc.io/docs/what-is-grpc/introduction/
RESTなAPIとの違い どちらもWeb APIの一種です! gRPCには、 プロトコル内部でHTTP/2を使って通信するけれど、実装する開発者には HTTPの存在を意識させない 特徴があり、一方RESTには、 「URL+HTTPメソッド」という制約がありつつも、gRPCよりも汎用的に使える ので外部/内部システム問わずに使える という特徴があってどちらも優劣をつけられるものではありません!
gRPCの何が嬉しいの?
gRPCの特徴 - サーバー/クライアントのコードを端末間で分散できる →マイクロサービスに適している - APIの仕様をProtocol BuffersというIDLで作成 →各言語やプラットフォーム向けのコードをIDLから自動生成 - HTTP/2上で動作するため、高い通信効率を発揮
また、通信経路上のコンポーネントすべてがHTTP/2である必要がある →システム内部(マイクロサービス)のAPIに最適
マイクロサービス モジュール同士をAPI経由で組み合わせるアーキテクチャ https://www.ibm.com/blogs/solutions/jp-ja/what-is-microservices/
Protocol Buffers Google社内で10年以上使われている構造化されたデータの独自シリアル方式 言語やプラットフォームに依存しないデータのやり取りができる!! https://grpc.io/docs/what-is-grpc/introduction/
コードの自動生成 protoファイルのアウトプットをProtocol Buffers*でカスタム message Person { required string name =
1; required int32 id = 2; optional string email = 3; } .proto Person john = Person.newBuilder() .setId(1234) .setName("John Doe") .setEmail("
[email protected]
") .build(); output = new FileOutputStream(args[0]); john.writeTo(output); .java Protocol Buffers*による自動生成 ※生成されたコードからロジックを組み立て * `protoc`というProtocol Buffersコンパイラのこと https://developers.google.com/protocol-buffers
HTTP/2 ストリームを多重化させることで、従来のHTTP/1.1よりも高速 https://blog.redbox.ne.jp/http2-cdn.html
サンプル実演会(Rails × Go)
サンプルを用意しました! スマートキャンプさん、ありがとう📛 https://tech.smartcamp.co.jp/entry/2019/03/28/175137
ピンときて、ポン /pingというパスにアクセス pongとレスポンスを返す RailsからGoをgRPC経由で 呼び出します
grpc-sample https://github.com/uh-zz/grpc-sample
まとめ
gRPC、、どうでしたか - RESTの撤廃ではなく、相乗りできる未来がある - protoファイルでAPI定義を一元化できるのは魅力的 - マイクロサービス化にはもってこい - 言語の選択肢をなくさないソリューション なんかよさそう🤔
参考 [OpenStindia](https://openstandia.jp/oss_info/grpc/) [Introduction to gRPC](https://grpc.io/docs/what-is-grpc/introduction/) [Protocol Buffers](https://developers.google.com/protocol-buffers) [HTTP/2の特徴HTTP/1.1との違いについて](https://blog.redbox.ne.jp/http2-cdn.html) [サービス間通信のための新技術「gRPC」入門](https://knowledge.sakura.ad.jp/24059/) [API設計:gRPC、OpenAPI、RESTの概要と、それらを使用するタイミングを理解す
る](https://cloud.google.com/blog/ja/products/api-management/understanding-grpc-openapi-and-rest-and-when-to-use-them) [初めてのgRPC/ Starting gRPC](https://speakerdeck.com/line_developers/starting-grpc) [コピペでできるGoでgRPCサーバ立ててRailsからアクセスする方法](https://tech.smartcamp.co.jp/entry/2019/03/28/175137) [マイクロサービスとは何か -IBM Cloud Blog](https://www.ibm.com/blogs/solutions/jp-ja/what-is-microservices/)