Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

blog post about grpc stacks #781

Merged
merged 5 commits into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions _posts/2018-11-30-grpc-stacks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
layout: post
title: gRPC Language Stacks
published: false
permalink: blog/grpc-stacks
author: Carl Mastrangelo
author-link: https://carlmastrangelo.com
company: Google
company-link: https://www.google.com
---

Here is a high level overview of the gRPC Stacks. Each of the **10** default languages supported by gRPC has multiple layers, allowing you to customize what pieces you want in your application.

<!--more-->


There are three main stacks in gRPC: C-core, Go, and Java. Most of the languages are thin wrappers on top of the [C-based](https://github.com/grpc/grpc/tree/v1.16.1/src/core) gRPC core library:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link to master branch as 1.16.1 will be old soon.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had picked a tag because links tend to break over time (re-orging code). Done, though.


<p><img src="https://grpc.io/img/grpc-core-stack.svg" alt="gRPC Core Stack" style="max-width: 800px" /></p>

For example, a Python application calls into the generated Python stubs. These call pass through interceptors, and into the wrapping library where the call is translated into C calls. The gRPC C-core will encode the RPC as HTTP/2, optionally encrypt the data with TLS, and then pass write it to the network.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These calls ...
...where the calls are ...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then pass write

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


One of the cool things about gRPC is that you can swap these pieces out. For example, you could use C# instead, and use an In-Process transport. This would save you from having to go all the way down to the OS network layer. Another example is trying out the QUIC protocol, which allows you to open new connections quickly. Being able to run over a variety of transports based on the environment makes gRPC really flexible.

### Go

In [gRPC-Go](https://github.com/grpc/grpc-go), the stack is much simpler, due to not having to support so many configurations. Here is a high level overview of the Go stack:

<p><img src="https://grpc.io/img/grpc-go-stack.svg" alt="gRPC Go Stack" style="max-width: 800px" /></p>

The structure is a little different here. Since there is only one language, the flow from the top of the stack to the bottom is more linear.


### Java

Here is a high level overview of the [gRPC-Java](https://github.com/grpc/grpc-java) stack:

<p><img src="https://grpc.io/img/grpc-java-stack.svg" alt="gRPC Java Stack" style="max-width: 800px" /></p>

Again, the structure is a little different. Java supports HTTP/2, QUIC, and In Process like the C-core. Unlike the C-Core though, applications commonly can bypass the generated stubs and interceptors, and speak directly to the Java Core library. Each structure is slightly different based on the needs of each language implementation of gRPC.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is QUIC supported directly or is it via Cronet? If Cronet then the diagram needs to change a include TCP under Cronet.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From talking to @ncteisen I thought there was built in support not from Cronet.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vjpai as far as I am aware we do not have a non cronet QUIC transport.. IIUC We do not have server side support of quic either, but rely on a translating proxy in between...

1 change: 1 addition & 0 deletions img/grpc-core-stack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/grpc-go-stack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/grpc-java-stack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.