grpc-go README

The project's README from github.com/grpc/grpc-go. As one markdown file: README.md.

gRPC-Go

GoDoc GoReportCard codecov

The Go implementation of gRPC: A high performance, open source, general RPC framework that puts mobile and HTTP/2 first. For more information see the Go gRPC docs, or jump directly into the quick start.

Prerequisites

Installation

Simply add the following import to your code, and then go [build|run|test] will automatically fetch the necessary dependencies:

import "google.golang.org/grpc"

Note: If you are trying to access grpc-go from China, see the FAQ below.

Learn more

FAQ

I/O Timeout Errors

The golang.org domain may be blocked from some countries. go get usually produces an error like the following when this happens:

$ go get -u google.golang.org/grpc
package google.golang.org/grpc: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)

To build Go code, there are several options:

Compiling error, undefined: grpc.SupportPackageIsVersion

Please update to the latest version of gRPC-Go using go get google.golang.org/grpc.

How to turn on logging

The default logger is controlled by environment variables. Turn everything on like this:

$ export GRPC_GO_LOG_VERBOSITY_LEVEL=99
$ export GRPC_GO_LOG_SEVERITY_LEVEL=info

The RPC failed with error "code = Unavailable desc = transport is closing"

This error means the connection the RPC is using was closed, and there are many possible reasons, including:

  1. mis-configured transport credentials, connection failed on handshaking
  2. bytes disrupted, possibly by a proxy in between
  3. server shutdown
  4. Keepalive parameters caused connection shutdown, for example if you have configured your server to terminate connections regularly to trigger DNS lookups. If this is the case, you may want to increase your MaxConnectionAgeGrace, to allow longer RPC calls to finish.

It can be tricky to debug this because the error happens on the client side but the root cause of the connection being closed is on the server side. Turn on logging on both client and server, and see if there are any transport errors.

grpc-go (grpc/grpc-go)

Searching Database…

23.1K ·GitHub
Что это такое?Реализация gRPC на Go: высокопроизводительный open source RPC-фреймворк общего назначения, в центре которого мобильные приложения и HTTP/2. С его помощью вы создаёте gRPC-клиенты и серверы на Go.
gRPC-Go — это то, что я разворачиваю, или библиотека для кода?Библиотека, которую вы подключаете к своим программам на Go (в README её называют RPC-фреймворком общего назначения). С её помощью вы пишете и клиентский, и серверный код; отдельного бинарника или запускаемого сервиса здесь нет.
Как добавить её в проект?Добавьте импорт google.golang.org/grpc в свой код — после этого go build, go run и go test автоматически подтянут нужные зависимости.
Какая версия Go должна быть установлена?Любая из двух последних мажорных версий Go.
Есть ли известные проблемы с соединениями?Классическая ловушка — ошибка 'code = Unavailable desc = transport is closing': соединение, через которое шёл RPC, закрылось. Обычно причина — неправильно настроенные transport credentials, байты, искажённые прокси, остановка сервера или параметры keepalive.
Есть ли бенчмарк или примеры кода, с которых стоит начать?Да — в репозитории есть ссылка на бенчмарк производительности и примеры, а также низкоуровневая техническая документация и quick start в документации Go gRPC.
Насколько проект зрелый?Он развивается с декабря 2014 года, набрал около 23 тысяч звёзд на GitHub, а в его CI работают workflows для CodeQL, покрытия, зависимостей и govulncheck.
Он полезен только для микросервисов?Нет — README называет его RPC-фреймворком общего назначения; среди тем на GitHub действительно есть microservices, rpc и proto, но ничто не ограничивает его только этим сценарием.
What are similar projects?grpc-java, grpc-rust, brpc, kratos, flatbuffers, chi, fiber, grpc-gateway
Creator
grpc
Size
45.5 MB
Stars
23.1K
Age
11y
Commits · 90 Days