SlideShare a Scribd company logo
Demystifying gRPC
By John Staveley MVP
23/05/2023
https://uk.linkedin.com/in/johnstaveley/
@johnstaveley
Overview
 Who uses it?
 What is it?
 Why use it?
 Basic gRPC method calls in C#
 Tooling in VS
 Streaming
 Using over the web
Who uses gRPC?
created in 2015
What is gRPC?
 Http2
 Protocol buffers
 Binary formatting
 TLS
 Support for cross cutting concerns such as authentication and error handling
 Good language support: C# / .NET, C++, Dart, Go, Java, Kotlin, Node,
Objective-C, PHP, Python, Ruby, JavaScript
Why? gRPC vs
 Both cross platform
 gRPC 7 to 10 times faster than REST
 REST has native browser support, gRPC has support via gRPC-Web
 REST has loose contracts, gRPC has strict contracts
 Json is human readable
 REST is better for massive payloads
Both: gRPC and
 Released 2015/2016
 Advantages over Rest
 Interface Definition Language
 Open source
 Publish Single Endpoint
Why? gRPC vs
 Transport Agnostic (Mostly http)
 Uses Json
 Can get all data together (easier
to combine method calls)
 Weaker coupling
 One-way streaming
 Caching of Get requests does not
work by default
 Used over Http/2
 Uses Protobuf (Smaller packet
size, faster serialisation)
 Single method at a time
 Stronger coupling
 Two-way streaming
How? Getting started with C#
 NuGet packages
 Default project (ASP.NET Core gRPC service)
 Setting up your service project
 The .proto file
 Startup
DEMO 1: Hello world Server
 Basic gRPC project
 Greeter service
 Call using postman or grpccurl
Protocol buffers
 Interface Definition Language
 Types: bool, string, bytes, float, double, int32, int64, uint32, uint64, sint32,
sint64. Full list here: https://protobuf.dev/programming-
guides/proto3/#scalar
 Other types: import "myproject/other_protos.proto";
 E.g. Timestamp
 Field numbers must be unique!
DEMO 2: Client
 Console project
 Install packages
 Add a service reference of type gRPC
 Add client code
 DEMO: Calling new method from client code
Extending the basic service
 Timestamp
 Enum
 Reserve keyword
 Optional keyword
 Empty type
 Streaming (1 way / 2 way)
 Authentication
 https://protobuf.dev/reference/csharp/api-docs/
Cloud gRPC support
 EC2 and Application Load Balancer
 Azure App Service
 Http = 2.0
 Http 2.0 Proxy = On/gRPC Only
 End to End Encryption = On
 Both support unary and streaming modes
Calling from the web
 Server uses grpc-web proxy
 Install-Package grpc.aspnetcore.web
 Web client
 Install Npm packages
 Talk through and execute Generate.ps1
 Talk through send.js
In Summary
 gRPC: High speed, well supported
 Good for streaming and polyglot services
 Used on the web via grpc-web proxy
 Well supported with tooling in VS, Postman etc
Resources
 https://stackoverflow.blog/2022/11/28/when-to-use-grpc-vs-graphql/
 https://app.pluralsight.com/library/courses/aspdotnet-core-6-using-grpc/
 https://grpc.io/docs/
 Source code: https://github.com/johnstaveley/DataLogger
 Slides: https://www.slideshare.net/johnstaveley/
Any Questions?
@johnstaveley
Demo code: https://github.com/johnstaveley/DataLogger/
Slides: https://www.slideshare.net/johnstaveley/
Connect: https://uk.linkedin.com/in/johnstaveley/

More Related Content

Similar to Demystifying gRPC in .Net by John Staveley

Aplicações realtime com gRPC
Aplicações realtime com gRPCAplicações realtime com gRPC
Aplicações realtime com gRPC
Leandro Lugaresi
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
Preston Flossy
 
Cloud native IPC for Microservices Workshop @ Containerdays 2022
Cloud native IPC for Microservices Workshop @ Containerdays 2022Cloud native IPC for Microservices Workshop @ Containerdays 2022
Cloud native IPC for Microservices Workshop @ Containerdays 2022
QAware GmbH
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIs
Tim Burks
 
gRPC
gRPC gRPC
APIs at the Edge
APIs at the EdgeAPIs at the Edge
APIs at the Edge
Red Hat
 
APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...
APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...
APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...
apidays
 
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, GoogleBringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
Ambassador Labs
 
Microservices summit talk 1/31
Microservices summit talk   1/31Microservices summit talk   1/31
Microservices summit talk 1/31
Varun Talwar
 
gRPC with java
gRPC with javagRPC with java
gRPC with java
Knoldus Inc.
 
Cloud Native API Design and Management
Cloud Native API Design and ManagementCloud Native API Design and Management
Cloud Native API Design and Management
AllBits BVBA (freelancer)
 
.NET Core Today and Tomorrow
.NET Core Today and Tomorrow.NET Core Today and Tomorrow
.NET Core Today and Tomorrow
Jon Galloway
 
What is gRPC introduction gRPC Explained
What is gRPC introduction gRPC ExplainedWhat is gRPC introduction gRPC Explained
What is gRPC introduction gRPC Explained
jeetendra mandal
 
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Codemotion
 
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
Red Hat
 
What I learned about APIs in my first year at Google
What I learned about APIs in my first year at GoogleWhat I learned about APIs in my first year at Google
What I learned about APIs in my first year at Google
Tim Burks
 
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
Codemotion
 
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Md. Sadhan Sarker
 
gRPC services testing
gRPC services testinggRPC services testing
gRPC services testing
Thivya Lakshmi
 
REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC! REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC!
QAware GmbH
 

Similar to Demystifying gRPC in .Net by John Staveley (20)

Aplicações realtime com gRPC
Aplicações realtime com gRPCAplicações realtime com gRPC
Aplicações realtime com gRPC
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
 
Cloud native IPC for Microservices Workshop @ Containerdays 2022
Cloud native IPC for Microservices Workshop @ Containerdays 2022Cloud native IPC for Microservices Workshop @ Containerdays 2022
Cloud native IPC for Microservices Workshop @ Containerdays 2022
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIs
 
gRPC
gRPC gRPC
gRPC
 
APIs at the Edge
APIs at the EdgeAPIs at the Edge
APIs at the Edge
 
APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...
APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...
APIdays Helsinki 2019 - gRPC: Lightning Fast, Self-Documenting APIs with Moha...
 
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, GoogleBringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
Bringing Learnings from Googley Microservices with gRPC - Varun Talwar, Google
 
Microservices summit talk 1/31
Microservices summit talk   1/31Microservices summit talk   1/31
Microservices summit talk 1/31
 
gRPC with java
gRPC with javagRPC with java
gRPC with java
 
Cloud Native API Design and Management
Cloud Native API Design and ManagementCloud Native API Design and Management
Cloud Native API Design and Management
 
.NET Core Today and Tomorrow
.NET Core Today and Tomorrow.NET Core Today and Tomorrow
.NET Core Today and Tomorrow
 
What is gRPC introduction gRPC Explained
What is gRPC introduction gRPC ExplainedWhat is gRPC introduction gRPC Explained
What is gRPC introduction gRPC Explained
 
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
Introduction to gRPC: A general RPC framework that puts mobile and HTTP/2 fir...
 
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
 
What I learned about APIs in my first year at Google
What I learned about APIs in my first year at GoogleWhat I learned about APIs in my first year at Google
What I learned about APIs in my first year at Google
 
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
 
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
Up and Running with gRPC & Cloud Career [GDG-Cloud-Dhaka-IO/2022}
 
gRPC services testing
gRPC services testinggRPC services testing
gRPC services testing
 
REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC! REST in Peace. Long live gRPC!
REST in Peace. Long live gRPC!
 

More from John Staveley

Image and Audio Detection using Edge Impulse
Image and Audio Detection using Edge ImpulseImage and Audio Detection using Edge Impulse
Image and Audio Detection using Edge Impulse
John Staveley
 
Product and Customer Development
Product and Customer DevelopmentProduct and Customer Development
Product and Customer Development
John Staveley
 
Getting started with satellite IoT
Getting started with satellite IoTGetting started with satellite IoT
Getting started with satellite IoT
John Staveley
 
IoT on Raspberry PI v1.2
IoT on Raspberry PI v1.2IoT on Raspberry PI v1.2
IoT on Raspberry PI v1.2
John Staveley
 
IoT on Raspberry Pi
IoT on Raspberry PiIoT on Raspberry Pi
IoT on Raspberry Pi
John Staveley
 
Birdwatching using a Raspberry pi, Azure IoT Hub and Cognitive services
Birdwatching using a Raspberry pi, Azure IoT Hub and Cognitive servicesBirdwatching using a Raspberry pi, Azure IoT Hub and Cognitive services
Birdwatching using a Raspberry pi, Azure IoT Hub and Cognitive services
John Staveley
 
DevSecOps - automating security
DevSecOps - automating securityDevSecOps - automating security
DevSecOps - automating security
John Staveley
 
Azure functions and container instances
Azure functions and container instancesAzure functions and container instances
Azure functions and container instances
John Staveley
 
Non nullable reference types in C#8
Non nullable reference types in C#8Non nullable reference types in C#8
Non nullable reference types in C#8
John Staveley
 
Graph databases and SQL Server 2017
Graph databases and SQL Server 2017Graph databases and SQL Server 2017
Graph databases and SQL Server 2017
John Staveley
 
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure FunctionsMessaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
John Staveley
 
Why you should use Type script and EcmaScript 6
Why you should use Type script and EcmaScript 6Why you should use Type script and EcmaScript 6
Why you should use Type script and EcmaScript 6
John Staveley
 
Updated Mvc Web security updated presentation
Updated Mvc Web security updated presentationUpdated Mvc Web security updated presentation
Updated Mvc Web security updated presentation
John Staveley
 
Web security leeds sharp dot netnotts
Web security leeds sharp dot netnottsWeb security leeds sharp dot netnotts
Web security leeds sharp dot netnotts
John Staveley
 
Design Patterns - LFM and POM
Design Patterns - LFM and POMDesign Patterns - LFM and POM
Design Patterns - LFM and POM
John Staveley
 
Web security presentation
Web security presentationWeb security presentation
Web security presentation
John Staveley
 
Single Page Application presentation
Single Page Application presentationSingle Page Application presentation
Single Page Application presentation
John Staveley
 

More from John Staveley (17)

Image and Audio Detection using Edge Impulse
Image and Audio Detection using Edge ImpulseImage and Audio Detection using Edge Impulse
Image and Audio Detection using Edge Impulse
 
Product and Customer Development
Product and Customer DevelopmentProduct and Customer Development
Product and Customer Development
 
Getting started with satellite IoT
Getting started with satellite IoTGetting started with satellite IoT
Getting started with satellite IoT
 
IoT on Raspberry PI v1.2
IoT on Raspberry PI v1.2IoT on Raspberry PI v1.2
IoT on Raspberry PI v1.2
 
IoT on Raspberry Pi
IoT on Raspberry PiIoT on Raspberry Pi
IoT on Raspberry Pi
 
Birdwatching using a Raspberry pi, Azure IoT Hub and Cognitive services
Birdwatching using a Raspberry pi, Azure IoT Hub and Cognitive servicesBirdwatching using a Raspberry pi, Azure IoT Hub and Cognitive services
Birdwatching using a Raspberry pi, Azure IoT Hub and Cognitive services
 
DevSecOps - automating security
DevSecOps - automating securityDevSecOps - automating security
DevSecOps - automating security
 
Azure functions and container instances
Azure functions and container instancesAzure functions and container instances
Azure functions and container instances
 
Non nullable reference types in C#8
Non nullable reference types in C#8Non nullable reference types in C#8
Non nullable reference types in C#8
 
Graph databases and SQL Server 2017
Graph databases and SQL Server 2017Graph databases and SQL Server 2017
Graph databases and SQL Server 2017
 
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure FunctionsMessaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
 
Why you should use Type script and EcmaScript 6
Why you should use Type script and EcmaScript 6Why you should use Type script and EcmaScript 6
Why you should use Type script and EcmaScript 6
 
Updated Mvc Web security updated presentation
Updated Mvc Web security updated presentationUpdated Mvc Web security updated presentation
Updated Mvc Web security updated presentation
 
Web security leeds sharp dot netnotts
Web security leeds sharp dot netnottsWeb security leeds sharp dot netnotts
Web security leeds sharp dot netnotts
 
Design Patterns - LFM and POM
Design Patterns - LFM and POMDesign Patterns - LFM and POM
Design Patterns - LFM and POM
 
Web security presentation
Web security presentationWeb security presentation
Web security presentation
 
Single Page Application presentation
Single Page Application presentationSingle Page Application presentation
Single Page Application presentation
 

Recently uploaded

AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
Sunil Jagani
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
Ortus Solutions, Corp
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
Tobias Schneck
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfLee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
leebarnesutopia
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
ScyllaDB
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - MydbopsMySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
Mydbops
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
HarpalGohil4
 

Recently uploaded (20)

AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfLee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - MydbopsMySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
 

Demystifying gRPC in .Net by John Staveley

  • 1. Demystifying gRPC By John Staveley MVP 23/05/2023 https://uk.linkedin.com/in/johnstaveley/ @johnstaveley
  • 2. Overview  Who uses it?  What is it?  Why use it?  Basic gRPC method calls in C#  Tooling in VS  Streaming  Using over the web
  • 4. What is gRPC?  Http2  Protocol buffers  Binary formatting  TLS  Support for cross cutting concerns such as authentication and error handling  Good language support: C# / .NET, C++, Dart, Go, Java, Kotlin, Node, Objective-C, PHP, Python, Ruby, JavaScript
  • 5. Why? gRPC vs  Both cross platform  gRPC 7 to 10 times faster than REST  REST has native browser support, gRPC has support via gRPC-Web  REST has loose contracts, gRPC has strict contracts  Json is human readable  REST is better for massive payloads
  • 6. Both: gRPC and  Released 2015/2016  Advantages over Rest  Interface Definition Language  Open source  Publish Single Endpoint
  • 7. Why? gRPC vs  Transport Agnostic (Mostly http)  Uses Json  Can get all data together (easier to combine method calls)  Weaker coupling  One-way streaming  Caching of Get requests does not work by default  Used over Http/2  Uses Protobuf (Smaller packet size, faster serialisation)  Single method at a time  Stronger coupling  Two-way streaming
  • 8. How? Getting started with C#  NuGet packages  Default project (ASP.NET Core gRPC service)  Setting up your service project  The .proto file  Startup
  • 9. DEMO 1: Hello world Server  Basic gRPC project  Greeter service  Call using postman or grpccurl
  • 10. Protocol buffers  Interface Definition Language  Types: bool, string, bytes, float, double, int32, int64, uint32, uint64, sint32, sint64. Full list here: https://protobuf.dev/programming- guides/proto3/#scalar  Other types: import "myproject/other_protos.proto";  E.g. Timestamp  Field numbers must be unique!
  • 11. DEMO 2: Client  Console project  Install packages  Add a service reference of type gRPC  Add client code  DEMO: Calling new method from client code
  • 12. Extending the basic service  Timestamp  Enum  Reserve keyword  Optional keyword  Empty type  Streaming (1 way / 2 way)  Authentication  https://protobuf.dev/reference/csharp/api-docs/
  • 13. Cloud gRPC support  EC2 and Application Load Balancer  Azure App Service  Http = 2.0  Http 2.0 Proxy = On/gRPC Only  End to End Encryption = On  Both support unary and streaming modes
  • 14. Calling from the web  Server uses grpc-web proxy  Install-Package grpc.aspnetcore.web  Web client  Install Npm packages  Talk through and execute Generate.ps1  Talk through send.js
  • 15. In Summary  gRPC: High speed, well supported  Good for streaming and polyglot services  Used on the web via grpc-web proxy  Well supported with tooling in VS, Postman etc
  • 16. Resources  https://stackoverflow.blog/2022/11/28/when-to-use-grpc-vs-graphql/  https://app.pluralsight.com/library/courses/aspdotnet-core-6-using-grpc/  https://grpc.io/docs/  Source code: https://github.com/johnstaveley/DataLogger  Slides: https://www.slideshare.net/johnstaveley/
  • 17. Any Questions? @johnstaveley Demo code: https://github.com/johnstaveley/DataLogger/ Slides: https://www.slideshare.net/johnstaveley/ Connect: https://uk.linkedin.com/in/johnstaveley/