SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Presented By: Shivraj Singh
Software Consultant
Knoldus Inc.
Building API using
GRPC and Scala
1. History.
2. gRPC: Introduction.
3. gRPC: Workflow.
4. Why gRPC.
5. Scenarios.
6. Core Features
7. Using an HTTP/1.1 transport and its limitations.
8. Difference b/w gRPC and REST.
9. gPRC helps Microservices.
10.gRPC: Powered by.
11.Why not jut use XML.
Our Agenda
History
● Google has been using a RPC infrastructure called Stubby to
connect the large number of microservices running within and
across their data centers for over a decade.
● RPC backbone behind every Google service that we use today.
gRPC: Introduction
● gRPC is a modern open source high performance RPC
framework that can run in any environment.
● It can efficiently connect services in and across data centers
with pluggable support for load balancing, tracing, health
checking and authentication.
● It is also applicable in last mile of distributed computing to
connect devices, mobile applications and browsers to backend
services.
Why gRPC?
● With gRPC we can define our service once in a .proto file and
implement clients and servers in any of gRPC’s supported
languages.
● gRPC is roughly 7 times faster than REST when receiving data
● It is 10 times faster than REST when sending data for this
specific payload.
Scenarios
● Efficiently connecting polyglot services in microservices style
architecture
● Connecting mobile devices, browser clients to backend services.
● Low latency(process a very high volume of data messages with
minimal delay).
● Highly scalable(it can handle a large increase in users, workload
or transactions without undue strain)
Core Features
● Idiomatic client libraries in 10 languages
● Highly efficient on wire and simple service definition framework
● Bi-directional streaming with http/2 based transport
● Pluggable auth(Use:Secure Socket Layer), tracing(opentracing),
load balancing and health checking(package grpc.health.v1;)
Microservices
Using HTTP/1.1 Limitations
● Request-Response protocol
○ Each connection supports pipelining... but not parallelism
(in-order only)
○ Content may be compressed... but headers are text format.
● Naturally supports single-direction streaming ... but not
bidirectional
HTTP/2 Advantages
● For HTTP/1.1 and HTTP/2 protocol with a slight difference.
Imagine that waiters are TCP connections and you want to order
your meal and a bottle of water. For HTTP/1.1 that would mean
that you ask one waiter for your meal and another one for
water, hence you would allocate two TCP connections.
● Request → Stream
○ Streams are multiplexed using framing
● Header compression
● Directly supports bidirectional streaming
HTTP/1 vs HTTP/2
Diff b/w gRPC and REST
Problems in Microservices
gRPC Help Microservices
● Distributed logging, tracing
● Ready to honor backward and forward compatibility, even
if you're the same person consuming this service on the
other side
● Provide Quality of service(QoS) - request deadline even if
it's propagated to many different services
● Provide request propagations/cancellations - stop
cascading failures
Use of Protocol Buffers
Protocol buffer data is structured as messages, where each
message is a small logical record of information containing a series
of name-value pairs called fields.
For example:
syntax = “proto3”;
message Person {
string name = 1;
int32 id = 2;
string email = 3;
}
Example of XML and Protobuf
In XML:
<person>
<name>John Doe</name>
<email>jdoe@example.com</email>
</person>
In Protobuf:
person {
name: "John Doe"
email: "jdoe@example.com"
}
Why not just use XML
Protocol buffers have many advantages over XML for serializing
structured data. Protocol buffers:
● are simpler
● are 3 to 10 times smaller
● are 20 to 100 times faster
● are less ambiguous
● generate data access classes that are easier to use
programmatically
gRPC : Powered by
● https://grpc.io/docs/guides/
● https://grpc.io/docs/tutorials/basic/java/#client
● https://grpc.io/docs/talks/
● https://grpc.io/about/
● https://grpc.io/blog/
References
Thank You!
@Knolspeak
/KnoldusSoftware

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (18)

Generating Unified APIs with Protocol Buffers and gRPC
Generating Unified APIs with Protocol Buffers and gRPCGenerating Unified APIs with Protocol Buffers and gRPC
Generating Unified APIs with Protocol Buffers and gRPC
 
gRPC - RPC rebirth?
gRPC - RPC rebirth?gRPC - RPC rebirth?
gRPC - RPC rebirth?
 
gRPC and Microservices
gRPC and MicroservicesgRPC and Microservices
gRPC and Microservices
 
gRPC Design and Implementation
gRPC Design and ImplementationgRPC Design and Implementation
gRPC Design and Implementation
 
Building your First gRPC Service
Building your First gRPC ServiceBuilding your First gRPC Service
Building your First gRPC Service
 
Hyper Text Transfer Protocol
Hyper Text Transfer ProtocolHyper Text Transfer Protocol
Hyper Text Transfer Protocol
 
GRPC 101 - DevFest Belgium 2016
GRPC 101 - DevFest Belgium 2016GRPC 101 - DevFest Belgium 2016
GRPC 101 - DevFest Belgium 2016
 
JUG louvain websockets
JUG louvain websocketsJUG louvain websockets
JUG louvain websockets
 
Distributed tracing using open tracing &amp; jaeger 2
Distributed tracing using open tracing &amp; jaeger 2Distributed tracing using open tracing &amp; jaeger 2
Distributed tracing using open tracing &amp; jaeger 2
 
Reactive micro services using RSocket
Reactive micro services using RSocketReactive micro services using RSocket
Reactive micro services using RSocket
 
RSocket — new Reactive cross-network Protocol? Олег Докука и Игорь Лозинский
RSocket — new Reactive cross-network Protocol? Олег Докука и Игорь Лозинский RSocket — new Reactive cross-network Protocol? Олег Докука и Игорь Лозинский
RSocket — new Reactive cross-network Protocol? Олег Докука и Игорь Лозинский
 
QUIC
QUICQUIC
QUIC
 
Communicating on the web
Communicating on the webCommunicating on the web
Communicating on the web
 
Http/2 lightning
Http/2   lightningHttp/2   lightning
Http/2 lightning
 
Grpc load balancing
Grpc load balancingGrpc load balancing
Grpc load balancing
 
gRPC or Rest, why not both?
gRPC or Rest, why not both?gRPC or Rest, why not both?
gRPC or Rest, why not both?
 
Welcome to the Reactive Revolution:RSocket and Spring Cloud Gateway - Spencer...
Welcome to the Reactive Revolution:RSocket and Spring Cloud Gateway - Spencer...Welcome to the Reactive Revolution:RSocket and Spring Cloud Gateway - Spencer...
Welcome to the Reactive Revolution:RSocket and Spring Cloud Gateway - Spencer...
 
Jax rstalk
Jax rstalkJax rstalk
Jax rstalk
 

Ähnlich wie Building API Using GRPC And Scala

Ähnlich wie Building API Using GRPC And Scala (20)

The new (is it really ) api stack
The new (is it really ) api stackThe new (is it really ) api stack
The new (is it really ) api stack
 
GRPC.pptx
GRPC.pptxGRPC.pptx
GRPC.pptx
 
Microservices summit talk 1/31
Microservices summit talk   1/31Microservices summit talk   1/31
Microservices summit talk 1/31
 
gRPC - Fastest Data Transfer Protocol
gRPC - Fastest Data Transfer ProtocolgRPC - Fastest Data Transfer Protocol
gRPC - Fastest Data Transfer Protocol
 
Introduction to gRPC (Application) Presentation
Introduction to gRPC (Application) PresentationIntroduction to gRPC (Application) Presentation
Introduction to gRPC (Application) Presentation
 
Building microservices with grpc
Building microservices with grpcBuilding microservices with grpc
Building microservices with grpc
 
What is gRPC introduction gRPC Explained
What is gRPC introduction gRPC ExplainedWhat is gRPC introduction gRPC Explained
What is gRPC introduction gRPC Explained
 
KrakenD API Gateway
KrakenD API GatewayKrakenD API Gateway
KrakenD API Gateway
 
Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017
 
Http/2
Http/2Http/2
Http/2
 
Http/2
Http/2Http/2
Http/2
 
REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC! REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC!
 
gRPC with java
gRPC with javagRPC with java
gRPC with java
 
HTTP
HTTPHTTP
HTTP
 
Cloud Native API Design and Management
Cloud Native API Design and ManagementCloud Native API Design and Management
Cloud Native API Design and Management
 
Introduction to HTTP2
Introduction to HTTP2Introduction to HTTP2
Introduction to HTTP2
 
HTTP In-depth
HTTP In-depthHTTP In-depth
HTTP In-depth
 
APIs at the Edge
APIs at the EdgeAPIs at the Edge
APIs at the Edge
 
Apa itu gRPC_.pptx
Apa itu gRPC_.pptxApa itu gRPC_.pptx
Apa itu gRPC_.pptx
 
Next generation web protocols
Next generation web protocolsNext generation web protocols
Next generation web protocols
 

Mehr von Knoldus Inc.

Mehr von Knoldus Inc. (20)

Supply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptxSupply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptx
 
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingMastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
 
Akka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionAkka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On Introduction
 
Entity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxEntity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptx
 
Introduction to Redis and its features.pptx
Introduction to Redis and its features.pptxIntroduction to Redis and its features.pptx
Introduction to Redis and its features.pptx
 
GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdf
 
NuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxNuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptx
 
Data Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingData Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable Testing
 
K8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesK8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose Kubernetes
 
Introduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptxIntroduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptx
 
Robusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxRobusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptx
 
Optimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxOptimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptx
 
Azure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxAzure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptx
 
CQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxCQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptx
 
ETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake Presentation
 
Scripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationScripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics Presentation
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIs
 
Introduction To Rust part II Presentation
Introduction To Rust part II PresentationIntroduction To Rust part II Presentation
Introduction To Rust part II Presentation
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Configuring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAConfiguring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRA
 

Kürzlich hochgeladen

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Kürzlich hochgeladen (20)

Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 

Building API Using GRPC And Scala

  • 1. Presented By: Shivraj Singh Software Consultant Knoldus Inc. Building API using GRPC and Scala
  • 2. 1. History. 2. gRPC: Introduction. 3. gRPC: Workflow. 4. Why gRPC. 5. Scenarios. 6. Core Features 7. Using an HTTP/1.1 transport and its limitations. 8. Difference b/w gRPC and REST. 9. gPRC helps Microservices. 10.gRPC: Powered by. 11.Why not jut use XML. Our Agenda
  • 3. History ● Google has been using a RPC infrastructure called Stubby to connect the large number of microservices running within and across their data centers for over a decade. ● RPC backbone behind every Google service that we use today.
  • 4. gRPC: Introduction ● gRPC is a modern open source high performance RPC framework that can run in any environment. ● It can efficiently connect services in and across data centers with pluggable support for load balancing, tracing, health checking and authentication. ● It is also applicable in last mile of distributed computing to connect devices, mobile applications and browsers to backend services.
  • 5.
  • 6. Why gRPC? ● With gRPC we can define our service once in a .proto file and implement clients and servers in any of gRPC’s supported languages. ● gRPC is roughly 7 times faster than REST when receiving data ● It is 10 times faster than REST when sending data for this specific payload.
  • 7. Scenarios ● Efficiently connecting polyglot services in microservices style architecture ● Connecting mobile devices, browser clients to backend services. ● Low latency(process a very high volume of data messages with minimal delay). ● Highly scalable(it can handle a large increase in users, workload or transactions without undue strain)
  • 8. Core Features ● Idiomatic client libraries in 10 languages ● Highly efficient on wire and simple service definition framework ● Bi-directional streaming with http/2 based transport ● Pluggable auth(Use:Secure Socket Layer), tracing(opentracing), load balancing and health checking(package grpc.health.v1;)
  • 10. Using HTTP/1.1 Limitations ● Request-Response protocol ○ Each connection supports pipelining... but not parallelism (in-order only) ○ Content may be compressed... but headers are text format. ● Naturally supports single-direction streaming ... but not bidirectional
  • 11. HTTP/2 Advantages ● For HTTP/1.1 and HTTP/2 protocol with a slight difference. Imagine that waiters are TCP connections and you want to order your meal and a bottle of water. For HTTP/1.1 that would mean that you ask one waiter for your meal and another one for water, hence you would allocate two TCP connections. ● Request → Stream ○ Streams are multiplexed using framing ● Header compression ● Directly supports bidirectional streaming
  • 13. Diff b/w gRPC and REST
  • 15. gRPC Help Microservices ● Distributed logging, tracing ● Ready to honor backward and forward compatibility, even if you're the same person consuming this service on the other side ● Provide Quality of service(QoS) - request deadline even if it's propagated to many different services ● Provide request propagations/cancellations - stop cascading failures
  • 16. Use of Protocol Buffers Protocol buffer data is structured as messages, where each message is a small logical record of information containing a series of name-value pairs called fields. For example: syntax = “proto3”; message Person { string name = 1; int32 id = 2; string email = 3; }
  • 17. Example of XML and Protobuf In XML: <person> <name>John Doe</name> <email>jdoe@example.com</email> </person> In Protobuf: person { name: "John Doe" email: "jdoe@example.com" }
  • 18. Why not just use XML Protocol buffers have many advantages over XML for serializing structured data. Protocol buffers: ● are simpler ● are 3 to 10 times smaller ● are 20 to 100 times faster ● are less ambiguous ● generate data access classes that are easier to use programmatically
  • 20. ● https://grpc.io/docs/guides/ ● https://grpc.io/docs/tutorials/basic/java/#client ● https://grpc.io/docs/talks/ ● https://grpc.io/about/ ● https://grpc.io/blog/ References