SlideShare a Scribd company logo
REST API vs gRPC
Vladimir DejanovićJavaLand
13 March 2018
@VladimirD_42@JavaLandConf
Let’s Meet
@VladimirD_42
Vladimir Dejanović
@JavaLandConf
Let’s Meet
@VladimirD_42
Vladimir Dejanović
@JavaLandConf
Let’s Meet
@VladimirD_42
Vladimir Dejanović
@JavaLandConf
Let’s Meet
@VladimirD_42
Vladimir Dejanović and Others...
@JavaLandConf
Agenda
@VladimirD_42@JavaLandConf
Agenda
@VladimirD_42
REST
@JavaLandConf
Agenda
@VladimirD_42
REST
gRPC
@JavaLandConf
Agenda
@VladimirD_42
REST
gRPC vs REST
gRPC
@JavaLandConf
Agenda
@VladimirD_42
REST
gRPC vs REST
Questions
gRPC
@JavaLandConf
@VladimirD_42
What is REST?
@JavaLandConf
REST
@VladimirD_42@JavaLandConf
REST
@VladimirD_42
http://www.ics.uci.edu/~fielding/pubs
/dissertation/rest_arch_style.htm
@JavaLandConf
REST
@VladimirD_42
Client-Server Architecture
@JavaLandConf
REST
@VladimirD_42
Client-Server Architecture
Statelessness
@JavaLandConf
REST
@VladimirD_42
Client-Server Architecture
Cacheability
Statelessness
@JavaLandConf
REST
@VladimirD_42
Client-Server Architecture
Cacheability
Layered System
Statelessness
@JavaLandConf
REST
@VladimirD_42
Client-Server Architecture
Cacheability
Layered System
Statelessness
Code on Demand (Optional)
@JavaLandConf
REST
@VladimirD_42
Client-Server Architecture
Cacheability
Layered System
Statelessness
Code on Demand (Optional)
Uniform Interface
@JavaLandConf
REST in real life
@VladimirD_42@JavaLandConf
REST in real life
@VladimirD_42@JavaLandConf
REST in real life
@VladimirD_42@JavaLandConf
REST in real life
@VladimirD_42@JavaLandConf
@VladimirD_42
REST in real life
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.repository.query.Param;
import
org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "people",
path = "people")
public interface PersonRepository
extends MongoRepository<Person, String> {
List<Person> findByLastName(@Param("name") String name);
}
@JavaLandConf
@VladimirD_42
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.repository.query.Param;
import
org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "people",
path = "people")
public interface PersonRepository
extends MongoRepository<Person, String> {
List<Person> findByLastName(@Param("name") String name);
}
REST in real life
@JavaLandConf
@VladimirD_42@JavaLandConf
@VladimirD_42
gRPC
@JavaLandConf
@VladimirD_42
What is gRPC?
@JavaLandConf
gRPC
@VladimirD_42
gRPC Remote Procedure Call
@JavaLandConf
Remote Procedure Call
@VladimirD_42@JavaLandConf
Remote Procedure Call
@VladimirD_42
RMI
@JavaLandConf
Remote Procedure Call
@VladimirD_42
RMI
@JavaLandConf
CORBA
@VladimirD_42
https://grpc.io/img/landing-2.svg
@JavaLandConf
@VladimirD_42
https://grpc.io/img/landing-2.svg
@JavaLandConf
@VladimirD_42
https://grpc.io/img/landing-2.svg
@JavaLandConf
@VladimirD_42
https://grpc.io/img/landing-2.svg
@JavaLandConf
@VladimirD_42
https://grpc.io/img/landing-2.svg
@JavaLandConf
gRPC
@VladimirD_42
C++
@JavaLandConf
gRPC
@VladimirD_42
C++ Java
@JavaLandConf
gRPC
@VladimirD_42
C++ Java Python
@JavaLandConf
gRPC
@VladimirD_42
C++ Java Python
Go
@JavaLandConf
gRPC
@VladimirD_42
C++ Java Python
Go Ruby
@JavaLandConf
gRPC
@VladimirD_42
C++ Java Python
Go Ruby C#
@JavaLandConf
gRPC
@VladimirD_42
C++ Java Python
Go
Node.js
Ruby C#
@JavaLandConf
gRPC
@VladimirD_42
C++ Java Python
Go
Node.js
Ruby C#
Android Java
@JavaLandConf
gRPC
@VladimirD_42
C++ Java Python
Go
Node.js
Ruby C#
Objective-CAndroid Java
@JavaLandConf
gRPC
@VladimirD_42
C++ Java Python
Go
Node.js
Ruby C#
Objective-CAndroid Java
PHP
@JavaLandConf
gRPC
@VladimirD_42
C++ Java Python
Go
Node.js
Ruby C#
Objective-CAndroid Java
PHP
@JavaLandConf
@VladimirD_42@JavaLandConf
gRPC vs REST
@VladimirD_42@JavaLandConf
@VladimirD_42@JavaLandConf
gRPC vs REST
Both Language agnostic
@VladimirD_42@JavaLandConf
@VladimirD_42@JavaLandConf
gRPC vs REST
https://grpc.io/
@VladimirD_42@JavaLandConf
gRPC vs REST
https://grpc.io/
https://github.com/grpc/grpc-java
@VladimirD_42
gRPC
@JavaLandConf
@VladimirD_42
gRPC
@JavaLandConf
@VladimirD_42
gRPC
@JavaLandConf
@VladimirD_42
gRPC
@JavaLandConf
@VladimirD_42
gRPC
@JavaLandConf
@VladimirD_42
gRPC
@JavaLandConf
@VladimirD_42
gRPC
@JavaLandConf
@VladimirD_42
gRPC
@JavaLandConf
@VladimirD_42
gRPC
@JavaLandConf
@VladimirD_42@JavaLandConf
gRPC vs REST
REST support more languages
@VladimirD_42@JavaLandConf
gRPC vs REST
REST support more languages
More than 4 types :-)
@VladimirD_42
gRPC
@JavaLandConf
@VladimirD_42
IDL
gRPC
@JavaLandConf
@VladimirD_42@JavaLandConf
gRPC vs REST
Schema is “optional” in REST
@VladimirD_42@JavaLandConf
gRPC vs REST
Schema is “optional” in REST
REST code or schema first
@VladimirD_42@JavaLandConf
gRPC vs REST
Schema is “optional” in REST
REST code or schema first
gRPC is schema first
@VladimirD_42
...
message TransferMoney {
int32 trans_id = 1;
int32 from_account_number = 2;
int32 to_account_number = 3;
double ammount = 4;
string message = 5;
}
service Bank {
rpc Transfer(TransferMoney) returns (TransferConfirmation);
rpc ListenToNotifications(Account) returns (stream AccountNotification);
rpc RequestTransfer(stream RequestMoney) returns (stream RequestStatus);
}
...
@JavaLandConf
@VladimirD_42
...
message TransferMoney {
int32 trans_id = 1;
int32 from_account_number = 2;
int32 to_account_number = 3;
double ammount = 4;
string message = 5;
}
service Bank {
rpc Transfer(TransferMoney) returns (TransferConfirmation);
rpc ListenToNotifications(Account) returns (stream AccountNotification);
rpc RequestTransfer(stream RequestMoney) returns (stream RequestStatus);
}
...
@JavaLandConf
@VladimirD_42
...
message TransferMoney {
int32 trans_id = 1;
int32 from_account_number = 2;
int32 to_account_number = 3;
double ammount = 4;
string message = 5;
}
service Bank {
rpc Transfer(TransferMoney) returns (TransferConfirmation);
rpc ListenToNotifications(Account) returns (stream AccountNotification);
rpc RequestTransfer(stream RequestMoney) returns (stream RequestStatus);
}
...
@JavaLandConf
@VladimirD_42
...
message TransferMoney {
int32 trans_id = 1;
int32 from_account_number = 2;
int32 to_account_number = 3;
double ammount = 4;
string message = 5;
}
service Bank {
rpc Transfer(TransferMoney) returns (TransferConfirmation);
rpc ListenToNotifications(Account) returns (stream AccountNotification);
rpc RequestTransfer(stream RequestMoney) returns (stream RequestStatus);
}
...
@JavaLandConf
@VladimirD_42
...
message TransferMoney {
int32 trans_id = 1;
int32 from_account_number = 2;
int32 to_account_number = 3;
double ammount = 4;
string message = 5;
}
service Bank {
rpc Transfer(TransferMoney) returns (TransferConfirmation);
rpc ListenToNotifications(Account) returns (stream AccountNotification);
rpc RequestTransfer(stream RequestMoney) returns (stream RequestStatus);
}
...
@JavaLandConf
@VladimirD_42
...
message TransferMoney {
int32 trans_id = 1;
int32 from_account_number = 2;
int32 to_account_number = 3;
double ammount = 4;
string message = 5;
}
service Bank {
rpc Transfer(TransferMoney) returns (TransferConfirmation);
rpc ListenToNotifications(Account) returns (stream AccountNotification);
rpc RequestTransfer(stream RequestMoney) returns (stream RequestStatus);
}
...
@JavaLandConf
@VladimirD_42
...
message TransferMoney {
int32 trans_id = 1;
int32 from_account_number = 2;
int32 to_account_number = 3;
double ammount = 4;
string message = 5;
}
service Bank {
rpc Transfer(TransferMoney) returns (TransferConfirmation);
rpc ListenToNotifications(Account) returns (stream AccountNotification);
rpc RequestTransfer(stream RequestMoney) returns (stream RequestStatus);
}
...
@JavaLandConf
@VladimirD_42
IDL
HTTP/2
gRPC
@JavaLandConf
@VladimirD_42@JavaLandConf
gRPC vs REST
HTTP2 backed into gRPC
@VladimirD_42@JavaLandConf
gRPC vs REST
HTTP2 backed into gRPC
Extra work “needed” for REST
@VladimirD_42
IDL
HTTP/2
Protobuf 3
gRPC
@JavaLandConf
@VladimirD_42@JavaLandConf
gRPC vs REST
REST is not JSON over HTTP
@VladimirD_42@JavaLandConf
gRPC vs REST
JSON Proto
@VladimirD_42@JavaLandConf
gRPC vs REST
JSON Proto ProtoJSON
@VladimirD_42@JavaLandConf
gRPC vs REST
JSON Proto
@VladimirD_42@JavaLandConf
gRPC vs REST
JSON Proto ProtoJSON
@VladimirD_42@JavaLandConf
gRPC vs REST
Protocol Buffer with REST
Big Difference
@VladimirD_42@JavaLandConf
Big Difference
@VladimirD_42@JavaLandConf
REST is about
Resources
Big Difference
@VladimirD_42@JavaLandConf
RPC is about
Remote Procedure Calls
Big Difference
@VladimirD_42@JavaLandConf
Big Difference
@VladimirD_42@JavaLandConf
Big Difference
@VladimirD_42@JavaLandConf
Big Difference
@VladimirD_42@JavaLandConf
Big Difference
@VladimirD_42@JavaLandConf
Big Difference
@VladimirD_42@JavaLandConf
Big Difference
@VladimirD_42@JavaLandConf
gRPC Code Example
@VladimirD_42
https://github.com/vladimir-dejanovic/
grpc-bank-example
@JavaLandConf
gRPC vs REST
@VladimirD_42@JavaLandConf
gRPC vs REST
@VladimirD_42@JavaLandConf
gRPC vs REST
@VladimirD_42
WildWest
@JavaLandConf
gRPC vs REST
@VladimirD_42
WildWest
Law&Order
@JavaLandConf
gRPC vs REST
@VladimirD_42
WildWest
Law&Order
REST
@JavaLandConf
gRPC vs REST
@VladimirD_42
WildWest
Law&Order
REST
@JavaLandConf
gRPC vs REST
@VladimirD_42
WildWest
Law&Order
gRPCREST
@JavaLandConf
gRPC vs REST
@VladimirD_42
Some questions to ask
@JavaLandConf
gRPC vs REST
@VladimirD_42
Who will be consumers?
@JavaLandConf
gRPC vs REST
@VladimirD_42
Who will be consumers?
Mobile / Web / Other?
@JavaLandConf
gRPC vs REST
@VladimirD_42
What is the use case?
@JavaLandConf
gRPC vs REST
@VladimirD_42
What is the use case?
CRUD or Other?
@JavaLandConf
gRPC vs REST
@VladimirD_42
What are internal policies and rules?
@JavaLandConf
gRPC vs REST
@VladimirD_42
What are internal policies and rules?
Toward frameworks, protocols and others
@JavaLandConf
gRPC vs REST
@VladimirD_42
What is the problem
that you are solving
@JavaLandConf
@VladimirD_42
Thank You
@JavaLandConf
Questions
@VladimirD_42
@VladimirD_42
vladimir@itshark.xyz
@JavaLandConf

More Related Content

PDF
REST API vs gRPC, which one should you use in breaking a monolith [Kdg.net 2018]
PDF
REST API vs gRPC, which one should you use in breaking a monolith [Dev conf 2...
PDF
Build your next REST API with gRPC
PDF
gRPC vs REST: let the battle begin!
PDF
Usable APIs at Scale
PDF
"Enabling Googley microservices with gRPC" VoxxedDays Minsk edition
PDF
"Enabling Googley microservices with gRPC" Riga DevDays 2018 edition
PDF
gRPC vs REST: let the battle begin!
REST API vs gRPC, which one should you use in breaking a monolith [Kdg.net 2018]
REST API vs gRPC, which one should you use in breaking a monolith [Dev conf 2...
Build your next REST API with gRPC
gRPC vs REST: let the battle begin!
Usable APIs at Scale
"Enabling Googley microservices with gRPC" VoxxedDays Minsk edition
"Enabling Googley microservices with gRPC" Riga DevDays 2018 edition
gRPC vs REST: let the battle begin!

What's hot (12)

PDF
"gRPC-Web: It’s All About Communication": Devoxx Ukraine 2019
PDF
"gRPC-Web: It’s All About Communication": Devoxx Ukraine 2019
PDF
"gRPC-Web: It’s All About Communication": Devoxx Belgium 2019
PDF
OSCON 2019 "Break me if you can: practical guide to building fault-tolerant s...
PDF
"gRPC vs REST: let the battle begin!" OSCON 2018 edition
PDF
Curl with rust
PDF
Proving Security Protocols Correct
PDF
The state of curl 2020
PDF
Break me if you can: practical guide to building fault-tolerant systems (with...
PDF
DevNexus 2020 "Break me if you can: practical guide to building fault-toleran...
PDF
A Modest Introduction to Swift
PDF
common mistakes when using libcurl
"gRPC-Web: It’s All About Communication": Devoxx Ukraine 2019
"gRPC-Web: It’s All About Communication": Devoxx Ukraine 2019
"gRPC-Web: It’s All About Communication": Devoxx Belgium 2019
OSCON 2019 "Break me if you can: practical guide to building fault-tolerant s...
"gRPC vs REST: let the battle begin!" OSCON 2018 edition
Curl with rust
Proving Security Protocols Correct
The state of curl 2020
Break me if you can: practical guide to building fault-tolerant systems (with...
DevNexus 2020 "Break me if you can: practical guide to building fault-toleran...
A Modest Introduction to Swift
common mistakes when using libcurl
Ad

Similar to JavaLand gRPC vs REST API (20)

PDF
gRPC: Beyond REST
PDF
gRPC - czyli jak skutecznie rozmawiać (rg-dev#14)
PDF
gRPC or Rest, why not both?
PPTX
Introduction to gRPC. Advantages and Disadvantages
PDF
From '00s to '20s: from RESTful to gRPC
PPTX
CocoaConf: The Language of Mobile Software is APIs
PDF
Inter-Process Communication in Microservices using gRPC
PPTX
gRPC - Fastest Data Transfer Protocol
PDF
Fast and Reliable Swift APIs with gRPC
PDF
gRPC Design and Implementation
PDF
Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
PPTX
REST vs gRPC: Battle of API's
PDF
gRPC - RPC rebirth?
PPTX
ASP.NET Core 3.0 Deep Dive
PDF
マイクロサービスバックエンドAPIのためのRESTとgRPC
PPTX
Building API Using GRPC And Scala
PPTX
Grpc present
gRPC: Beyond REST
gRPC - czyli jak skutecznie rozmawiać (rg-dev#14)
gRPC or Rest, why not both?
Introduction to gRPC. Advantages and Disadvantages
From '00s to '20s: from RESTful to gRPC
CocoaConf: The Language of Mobile Software is APIs
Inter-Process Communication in Microservices using gRPC
gRPC - Fastest Data Transfer Protocol
Fast and Reliable Swift APIs with gRPC
gRPC Design and Implementation
Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
REST vs gRPC: Battle of API's
gRPC - RPC rebirth?
ASP.NET Core 3.0 Deep Dive
マイクロサービスバックエンドAPIのためのRESTとgRPC
Building API Using GRPC And Scala
Grpc present
Ad

More from Vladimir Dejanovic (19)

PDF
What limitations & problems of REST API can be solved with GraphQL [jPrime 2019]
PDF
Micronaut, Dragon-Slayer (Spring/boot) or just another framework [GeeCON Krak...
PDF
GraphQL in Java World [Workshop RivieraDev 2019]
PDF
GraphQL vs Traditional Rest API [GeeCon Prague 2018]
PDF
What Users Want, A/B testing explained [CodeteCon 2018]
PDF
GeeCON 2018 GraphQL vs Traditional REST API
PDF
Java Day Istanbul 2018 GraphQL vs Traditional REST API
PDF
Devoxx France 2018 GraphQL vs Traditional REST API
PDF
Java land What Users Want, A/B testing explained
PDF
GraphQL vs Traditional Rest API
PDF
Java One Secret of developing high performance website, with no budget
PDF
Voxxed Days Belgrade - Changing wheels on moving car, from monolith to micros...
PDF
What users want [DevoxxPL]
PDF
Secret of developing high performance website, with no budget in small amount...
PDF
Changing wheels on moving car, from monolith to microservices by using api's V2
PDF
Changing wheels on moving car, from monolith to microservices by using api's
PDF
Pain of growing up, and moving to large scale
PDF
Protocol buffers and Microservices
ODP
What users want
What limitations & problems of REST API can be solved with GraphQL [jPrime 2019]
Micronaut, Dragon-Slayer (Spring/boot) or just another framework [GeeCON Krak...
GraphQL in Java World [Workshop RivieraDev 2019]
GraphQL vs Traditional Rest API [GeeCon Prague 2018]
What Users Want, A/B testing explained [CodeteCon 2018]
GeeCON 2018 GraphQL vs Traditional REST API
Java Day Istanbul 2018 GraphQL vs Traditional REST API
Devoxx France 2018 GraphQL vs Traditional REST API
Java land What Users Want, A/B testing explained
GraphQL vs Traditional Rest API
Java One Secret of developing high performance website, with no budget
Voxxed Days Belgrade - Changing wheels on moving car, from monolith to micros...
What users want [DevoxxPL]
Secret of developing high performance website, with no budget in small amount...
Changing wheels on moving car, from monolith to microservices by using api's V2
Changing wheels on moving car, from monolith to microservices by using api's
Pain of growing up, and moving to large scale
Protocol buffers and Microservices
What users want

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPT
Teaching material agriculture food technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Cloud computing and distributed systems.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Empathic Computing: Creating Shared Understanding
Encapsulation theory and applications.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Teaching material agriculture food technology
Encapsulation_ Review paper, used for researhc scholars
Mobile App Security Testing_ A Comprehensive Guide.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
MYSQL Presentation for SQL database connectivity
Review of recent advances in non-invasive hemoglobin estimation
Understanding_Digital_Forensics_Presentation.pptx
sap open course for s4hana steps from ECC to s4
Digital-Transformation-Roadmap-for-Companies.pptx
cuic standard and advanced reporting.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Cloud computing and distributed systems.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Building Integrated photovoltaic BIPV_UPV.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Empathic Computing: Creating Shared Understanding

JavaLand gRPC vs REST API