From 4537604238fd2fef8a96f2afd78935b2a72175f5 Mon Sep 17 00:00:00 2001 From: Carl Mastrangelo Date: Thu, 29 Nov 2018 17:23:37 -0800 Subject: [PATCH 1/5] blog post about grpc stacks --- _posts/2018-11-30-grpc-stacks.md | 40 ++++++++++++++++++++++++++++++++ img/grpc-core-stack.svg | 1 + img/grpc-go-stack.svg | 1 + img/grpc-java-stack.svg | 1 + 4 files changed, 43 insertions(+) create mode 100644 _posts/2018-11-30-grpc-stacks.md create mode 100644 img/grpc-core-stack.svg create mode 100644 img/grpc-go-stack.svg create mode 100644 img/grpc-java-stack.svg diff --git a/_posts/2018-11-30-grpc-stacks.md b/_posts/2018-11-30-grpc-stacks.md new file mode 100644 index 00000000..63f5eb0d --- /dev/null +++ b/_posts/2018-11-30-grpc-stacks.md @@ -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. + + + + +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: + +

gRPC Core Stack

+ +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. + +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: + +

gRPC Go Stack

+ +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: + +

gRPC Java Stack

+ +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. diff --git a/img/grpc-core-stack.svg b/img/grpc-core-stack.svg new file mode 100644 index 00000000..951dceb8 --- /dev/null +++ b/img/grpc-core-stack.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/grpc-go-stack.svg b/img/grpc-go-stack.svg new file mode 100644 index 00000000..7ff50b3a --- /dev/null +++ b/img/grpc-go-stack.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/img/grpc-java-stack.svg b/img/grpc-java-stack.svg new file mode 100644 index 00000000..6c2e4eff --- /dev/null +++ b/img/grpc-java-stack.svg @@ -0,0 +1 @@ + \ No newline at end of file From d16a9927190c5356aef32c8164eb6c60799aef82 Mon Sep 17 00:00:00 2001 From: Carl Mastrangelo Date: Fri, 30 Nov 2018 11:29:46 -0800 Subject: [PATCH 2/5] update comments --- _posts/2018-11-30-grpc-stacks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_posts/2018-11-30-grpc-stacks.md b/_posts/2018-11-30-grpc-stacks.md index 63f5eb0d..1a2278ce 100644 --- a/_posts/2018-11-30-grpc-stacks.md +++ b/_posts/2018-11-30-grpc-stacks.md @@ -14,11 +14,11 @@ Here is a high level overview of the gRPC Stacks. Each of the **10** default la -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: +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/master/src/core) gRPC core library:

gRPC Core Stack

-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. +For example, a Python application calls into the generated Python stubs. These calls 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 write it to the network. 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. From 9598f45c34da552bfc9cd24e4f54d253a49ef82d Mon Sep 17 00:00:00 2001 From: Carl Mastrangelo Date: Fri, 30 Nov 2018 15:07:46 -0800 Subject: [PATCH 3/5] update pics --- img/grpc-core-stack.svg | 2 +- img/grpc-java-stack.svg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/img/grpc-core-stack.svg b/img/grpc-core-stack.svg index 951dceb8..17919687 100644 --- a/img/grpc-core-stack.svg +++ b/img/grpc-core-stack.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/img/grpc-java-stack.svg b/img/grpc-java-stack.svg index 6c2e4eff..e08f66e1 100644 --- a/img/grpc-java-stack.svg +++ b/img/grpc-java-stack.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file From 8a79c4c20041f6d11c9a9bf28e0508b0e6056451 Mon Sep 17 00:00:00 2001 From: Carl Mastrangelo Date: Fri, 30 Nov 2018 16:04:58 -0800 Subject: [PATCH 4/5] more fixes --- _posts/2018-11-30-grpc-stacks.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/_posts/2018-11-30-grpc-stacks.md b/_posts/2018-11-30-grpc-stacks.md index 1a2278ce..45f8d801 100644 --- a/_posts/2018-11-30-grpc-stacks.md +++ b/_posts/2018-11-30-grpc-stacks.md @@ -1,6 +1,6 @@ --- layout: post -title: gRPC Language Stacks +title: Visualizing gRPC Language Stacks published: false permalink: blog/grpc-stacks author: Carl Mastrangelo @@ -13,22 +13,25 @@ Here is a high level overview of the gRPC Stacks. Each of the **10** default la - 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/master/src/core) gRPC core library: +### Wrapped Languages: +

gRPC Core Stack

-For example, a Python application calls into the generated Python stubs. These calls 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 write it to the network. +For example, a Python application calls into the generated Python stubs. These calls pass through interceptors, and into the wrapping library where the calls are translated into C calls. The gRPC C-core will encode the RPC as HTTP/2, optionally encrypt the data with TLS, and then write it to the network. 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. +For each of the wrapped languages, the default HTTP/2 implementation is built into the C-core library, so there is no need to include an outside one. However, as you can see, it is possible to bring your own (such as with Cronet, the Chrome networking library). + ### 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:

gRPC Go Stack

-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. +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. Unlike wrapped languages, gRPC Go can use either its own HTTP/2 implementation, or the Go `net/http` package. ### Java @@ -37,4 +40,4 @@ Here is a high level overview of the [gRPC-Java](https://github.com/grpc/grpc-ja

gRPC Java Stack

-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. +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. Also unlike wrapped languages, gRPC Java separates the HTTP/2 implementation into pluggable libraries (such as Netty, OkHttp, or Cronet). From d29589bd1a359f432e95f01769607eadf16cf039 Mon Sep 17 00:00:00 2001 From: Carl Mastrangelo Date: Tue, 11 Dec 2018 11:51:13 -0800 Subject: [PATCH 5/5] publish! --- _posts/{2018-11-30-grpc-stacks.md => 2018-12-11-grpc-stacks.md} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename _posts/{2018-11-30-grpc-stacks.md => 2018-12-11-grpc-stacks.md} (99%) diff --git a/_posts/2018-11-30-grpc-stacks.md b/_posts/2018-12-11-grpc-stacks.md similarity index 99% rename from _posts/2018-11-30-grpc-stacks.md rename to _posts/2018-12-11-grpc-stacks.md index 45f8d801..2292ba9e 100644 --- a/_posts/2018-11-30-grpc-stacks.md +++ b/_posts/2018-12-11-grpc-stacks.md @@ -1,7 +1,7 @@ --- layout: post title: Visualizing gRPC Language Stacks -published: false +published: true permalink: blog/grpc-stacks author: Carl Mastrangelo author-link: https://carlmastrangelo.com