Talking Between Services with gRPC

Slides:



Advertisements
Similar presentations
IIS7: Building New Core Server Modules Michael Volodarsky COM406 Program Manager Microsoft Corporation.
Advertisements

Client-server interactions in Mobile Applications.
Getting Started with Windows Communication Foundation 4.5 Ed Jones, MCT, MCPD, MCTS Consultant RBA Inc.
Building Data Driven Applications Using WinRT and XAML Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant Level: Intermediate.
Intro to WCF From the beginning and uses Steve AppRochester.
Web Services based e-Commerce System Sandy Liu Jodrey School of Computer Science Acadia University July, 2002.
Web Services. ASP.NET Web Services  Goals of ASP.NET Web services:  To enable cross-platform, cross- business computing  Great for “service” based.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Web Services. Abstract  Web Services is a technology applicable for computationally distributed problems, including access to large databases What other.
Web Services Using Visual.NET By Kevin Tse. Agenda What are Web Services and Why are they Useful ? SOAP vs CORBA Goals of the Web Service Project Proposed.
Amazon Web Services. Amazon Web Services (AWS) - robust, scalable and affordable infrastructure for cloud computing. This session is about:
Why Learn Android? Largest installation base of any operating system Over 20,000 Android devices exist Businesses will likely move more to device-based.
The Mechanics of HTTP Requests and Responses and network connections.
What is it all about? .NET MeetUp in Prague, CZ (2017/7/19)
The Holmes Platform and Applications
Java Web Services Orca Knowledge Center – Web Service key concepts.
Windows Communication Foundation and Web Services
DevOps with ASP.NET Core and Entity Framework Core
Introducing the Microsoft® .NET Framework
Modernizing your. NET applications with. NET Standard,
Build and Learn ASP.NET Workshop.
Introduction to Xamarin C# Everywhere
Data Virtualization Demoette… ODBC Clients
Introduction to .NET Florin Olariu
Introduction to ASP.NET Core
By: Raza Usmani SaaS, PaaS & TaaS By: Raza Usmani
Abstract Factory Pattern
Getting started with .NET Core
Business Directory REST API
GENIVI – W3C Collaboration October 10, 2017 | AMM Seoul
Containers: The new network endpoint
Data Virtualization Demoette… ADO.NET Client
Google Web Toolkit Tutorial
WEB SERVICES.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
6/11/2018 8:14 AM THR2175 Building and deploying existing ASP.NET applications using VSTS and Docker on Windows Marcel de Vries CTO, Xpirit © Microsoft.
Introduction to .NET Core
CORBA Alegria Baquero.
Did your feature got in, out or planned?
Building Innovative Apps using the Microsoft Developer Platform
Ruby, Rails, GUIs, and More
Windows Communication Foundation and Web Services
Abstract Factory Pattern
DNN Connect 2017 Microsoft Keynote
API Documentation Guidelines
Building real-time web apps with WebSockets using IIS, ASP.NET and WCF
MVC in ASP.NET Core: The new kid on the block
Object Oriented Practices
Reactive microservice end to end from RxJava to the wire with gRPC
Learn. Imagine. Build. .NET Conf
Should I Transition to .NET Core? Will it hurt?
SPA Revolution with WebAssembly and Blazor Rainer Stropek | software
CORBA Alegria Baquero.
The future of distributed systems architecture
Post WG LC NMDA datastore architecture draft
#GCDigital Design System
What’s new in ASP.NET Core and Entity Framework 2.2 (Preview 3)
Agile testing for web API with Postman
TechEd /22/2019 9:22 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
From Development to Production: Optimizing for Continuous Delivery
Student: Popa Andrei-Sebastian
Building production-ready APIs with ASP.NET Core 2.2
From Development to Production: Optimizing for Continuous Delivery
COMPONENTS – WHY? Object-oriented source-level re-use of code requires same source code language. Object-oriented source-level re-use may require understanding.
Server Management and Automation Windows Server 2012 R2
WCF Data Services and Silverlight
Windows Forms in Visual Studio 2005: An in-depth look at key features
Windows Forms in Visual Studio 2005: An Overview
The Future is Now with ASP.NET Core 3.0
Chengyu Sun California State University, Los Angeles
Presentation transcript:

Talking Between Services with gRPC Marc Gravell marc.gravell@gmail.com @marcgravell

Talking Between Services with gRPC Marc Gravell, @marcgravell, marc.gravell@gmail.com Architecture Team, Stack Overflow Microsoft MVP network focus, meta-programming focus protobuf-net Dapper StackExchange.Redis FastMember (etc) 00:00 – 00:30

Agenda What is gRPC and why would I want to use it? How would I use gRPC, today? What are the strengths and weaknesses? What is new in gRPC and .NET Core 3 (part 1)? What is new in gRPC and .NET Core 3 (part 2)? Summary . 0:30-2:30

The world of services 2:30-3:30

What is gRPC and why would I want to use it? RPC stack developed and used by Google Open sourced in Feb 2015 Platform independent High performance Based on “protocol buffers” (“protobuf”) and HTTP/2 Necessary if talking to external services that are gRPC (e.g. Google) A good choice for your own systems if you want efficient, robust, well- designed/implemented/tested, cross-platform RPC! Usually, gRPC is used with protobuf, so to understand gRPC, we first need to understand protobuf . 3:30-5:30

What is protocol buffers and why would I want to use it? Binary serialization protocol designed and used by Google (JSON variant added later, but doesn’t apply to gRPC) Open sourced in July 2008 Platform independent High performance Low CPU to process Low bandwidth to transmit Version tolerant . 5:30-7:30

How would I use gRPC, today? DEMO 7:30-17:30

How would I use it, today? We should have seen: Setting up a basic project with protobuf support Creating a .proto schema The generated code for data contracts, service clients, and service implementations How to implement and host a service How to create a client A working client and server! (?) Getting hold of metadata Cancellations (not covering security/auth, but those things exist etc) . 17:30-19:30

Today (generated code) Grpc.Core.Api Grpc.Core 19:30-20:30 chttp2

What are the strengths and weaknesses? + DSL is strong for cross-platform; same contract can be used from many languages / frameworks - having to create and maintain the schema in .proto can be a nuisance for simple work - awkward setup and tooling +/- API is “idiomatic protobuf/gRPC, in C#” rather than “idiomatic .NET, doing protobuf/gRPC” - code-gen is C#-only (for .NET-land) - code-gen is proto3-only (for .NET-land) - gRPC stack is native/unmanaged and doesn’t play nicely with Kestrel, HttpClient, etc - generated code with full implementation is verbose and restrictive - the streaming API is … just weird! . 20:30-23:30

What is new in gRPC and .NET Core 3? (part 1) Microsoft writing new libraries that work with the existing generated code for gRPC (HTTP/2) in managed code New client bindings that use HttpClient New server bindings that use Kestrel (ASP.NET Core server) . 23:30-25:30

Today (generated code) Grpc.Core.Api Grpc.Core 25:30 chttp2

(generated code) Grpc.Core.Api Grpc.Net.Client Grpc.Core HttpClient .NET Core 3 Today (generated code) Grpc.Core.Api Grpc.Net.Client Grpc.Core 25:30-26:00 HttpClient chttp2

Grpc.AspNetCore.Server Today .NET Core 3 (generated code) Grpc.Core.Api Grpc.Net.Client Grpc.Core Grpc.AspNetCore.Server 26:00-26:30 HttpClient chttp2 ASP.NET Core

What is new in gRPC and .NET Core 3? (part 1) DEMO 26:30-31:30

What is new in gRPC and .NET Core 3? (part 1) We should have seen: Creating a server in Kestrel Creating a client with HttpClient That other than actual setup of the client and server, everything else stays the same – just now: less unmanaged… …which means we still have all the other pain points . 31:30-33:30

.proto schema (generated code) Google.Protobuf Grpc.Core.Api Today via Grpc “contract-first” .proto schema (generated code) 33:30-34:30 Google.Protobuf Grpc.Core.Api

What is new in gRPC and .NET Core 3? (part 2) New protobuf-net tooling (protobuf-net.Grpc) Works against either the old unmanaged bindings or the new managed bindings, for both client and server Defaults to protobuf-net (put configurable) Re-imagines the API surface of services Fully supports both code-first and contract-first styles of code Supports both “proto2” and “proto3” Isn’t limited to C# …does anyone remember WCF? (…I mean the good bits of WCF, not everything) . 34:30-35:30

.proto schema (generated code) Google.Protobuf Grpc.Core.Api Today via Grpc “contract-first” .proto schema (generated code) 35:30 Google.Protobuf Grpc.Core.Api

.proto schema .NET types (generated code) (meta-programming) Today via Grpc protobuf-net.Grpc (preview) “contract-first” “code-first” .proto schema .NET types (generated code) (meta-programming) 35:30-37:30 Google.Protobuf protobuf-net (…+?) Grpc.Core.Api

What is new in gRPC and .NET Core 3? (part 2) DEMO 37:30-42:30

What is new in gRPC and .NET Core 3? (part 2) We should have seen: Defining our data and services in code as simple classes and interfaces Creating a server (with either Grpc.Core or Kestrel) Creating a client (with either Grpc.Core or HttpClient) Creating nice clean code from a .proto schema Using other languages Idiomatic .NET code Streaming made simple via asynchronous streams Avoiding Grpc.Core means : no native libraries! . 42:30-43:30

Summary gRPC is a great tool for general purpose calls between services By default, it takes a little bit of effort; it may be more effort than simpler tools The unmanaged implementation makes deployment awkward With .NET Core 3, Microsoft are fixing half of the problems… …and tools like protobuf-net.Grpc can be used to fix the other half (other similar tools exist; MagicOnion, etc) Mostly pre-preview – “here be dragons”; maybe wait for preview7? Please feel free to come and find me to discuss in more depth! . 43:30-44:30

THANKS! (and questions?) https://github.com/grpc/grpc https://github.com/grpc/grpc-dotnet https://github.com/protobuf-net/protobuf-net.Grpc THANKS! (and questions?) Marc Gravell marc.gravell@gmail.com @marcgravell