OLD | NEW |
(Empty) | |
| 1 [](h
ttps://grpc-testing.appspot.com/job/gRPC_master) |
| 2 |
| 3 [gRPC - An RPC library and framework](http://github.com/grpc/grpc) |
| 4 =================================== |
| 5 |
| 6 [](https://gitter.im/grpc/grpc?utm_source=badge&utm_medium=badge&utm_camp
aign=pr-badge&utm_content=badge) |
| 7 |
| 8 Copyright 2015-2016 Google Inc. |
| 9 |
| 10 #Documentation |
| 11 |
| 12 You can find more detailed documentation and examples in the [doc](doc) and [exa
mples](examples) directories respectively. |
| 13 |
| 14 #Installation |
| 15 |
| 16 See [INSTALL](INSTALL.md) for installation instructions for various platforms. |
| 17 |
| 18 #Repository Structure & Status |
| 19 |
| 20 This repository contains source code for gRPC libraries for multiple languages w
ritten on top of shared C core library [src/core] (src/core). |
| 21 |
| 22 Libraries in different languages are in different states of development. We are
seeking contributions for all of these libraries. |
| 23 |
| 24 | Language | Source | Status
| |
| 25 |-------------------------|-------------------------------------|---------------
-------------------| |
| 26 | Shared C [core library] | [src/core] (src/core) | Beta - the sur
face API is stable | |
| 27 | C++ | [src/cpp] (src/cpp) | Beta - the sur
face API is stable | |
| 28 | Ruby | [src/ruby] (src/ruby) | Beta - the sur
face API is stable | |
| 29 | NodeJS | [src/node] (src/node) | Beta - the sur
face API is stable | |
| 30 | Python | [src/python] (src/python) | Beta - the sur
face API is stable | |
| 31 | PHP | [src/php] (src/php) | Beta - the sur
face API is stable | |
| 32 | C# | [src/csharp] (src/csharp) | Beta - the sur
face API is stable | |
| 33 | Objective-C | [src/objective-c] (src/objective-c) | Beta - the sur
face API is stable | |
| 34 |
| 35 <small> |
| 36 Java source code is in the [grpc-java] (http://github.com/grpc/grpc-java) reposi
tory. |
| 37 Go source code is in the [grpc-go] (http://github.com/grpc/grpc-go) repository. |
| 38 </small> |
| 39 |
| 40 See [MANIFEST.md](MANIFEST.md) for a listing of top-level items in the |
| 41 repository. |
| 42 |
| 43 #Overview |
| 44 |
| 45 |
| 46 Remote Procedure Calls (RPCs) provide a useful abstraction for building |
| 47 distributed applications and services. The libraries in this repository |
| 48 provide a concrete implementation of the gRPC protocol, layered over HTTP/2. |
| 49 These libraries enable communication between clients and servers using any |
| 50 combination of the supported languages. |
| 51 |
| 52 |
| 53 ##Interface |
| 54 |
| 55 |
| 56 Developers using gRPC typically start with the description of an RPC service |
| 57 (a collection of methods), and generate client and server side interfaces |
| 58 which they use on the client-side and implement on the server side. |
| 59 |
| 60 By default, gRPC uses [Protocol Buffers](https://github.com/google/protobuf) as
the |
| 61 Interface Definition Language (IDL) for describing both the service interface |
| 62 and the structure of the payload messages. It is possible to use other |
| 63 alternatives if desired. |
| 64 |
| 65 ###Surface API |
| 66 Starting from an interface definition in a .proto file, gRPC provides |
| 67 Protocol Compiler plugins that generate Client- and Server-side APIs. |
| 68 gRPC users typically call into these APIs on the Client side and implement |
| 69 the corresponding API on the server side. |
| 70 |
| 71 #### Synchronous vs. asynchronous |
| 72 Synchronous RPC calls, that block until a response arrives from the server, are |
| 73 the closest approximation to the abstraction of a procedure call that RPC |
| 74 aspires to. |
| 75 |
| 76 On the other hand, networks are inherently asynchronous and in many scenarios, |
| 77 it is desirable to have the ability to start RPCs without blocking the current |
| 78 thread. |
| 79 |
| 80 The gRPC programming surface in most languages comes in both synchronous and |
| 81 asynchronous flavors. |
| 82 |
| 83 |
| 84 ## Streaming |
| 85 |
| 86 gRPC supports streaming semantics, where either the client or the server (or bot
h) |
| 87 send a stream of messages on a single RPC call. The most general case is |
| 88 Bidirectional Streaming where a single gRPC call establishes a stream where both |
| 89 the client and the server can send a stream of messages to each other. The strea
med |
| 90 messages are delivered in the order they were sent. |
| 91 |
| 92 |
| 93 #Protocol |
| 94 |
| 95 The [gRPC protocol](doc/PROTOCOL-HTTP2.md) specifies the abstract requirements f
or communication between |
| 96 clients and servers. A concrete embedding over HTTP/2 completes the picture by |
| 97 fleshing out the details of each of the required operations. |
| 98 |
| 99 ## Abstract gRPC protocol |
| 100 A gRPC RPC comprises of a bidirectional stream of messages, initiated by the cli
ent. In the client-to-server direction, this stream begins with a mandatory `Cal
l Header`, followed by optional `Initial-Metadata`, followed by zero or more `Pa
yload Messages`. The server-to-client direction contains an optional `Initial-Me
tadata`, followed by zero or more `Payload Messages` terminated with a mandatory
`Status` and optional `Status-Metadata` (a.k.a.,`Trailing-Metadata`). |
| 101 |
| 102 ## Implementation over HTTP/2 |
| 103 The abstract protocol defined above is implemented over [HTTP/2](https://http2.g
ithub.io/). gRPC bidirectional streams are mapped to HTTP/2 streams. The content
s of `Call Header` and `Initial Metadata` are sent as HTTP/2 headers and subject
to HPACK compression. `Payload Messages` are serialized into a byte stream of l
ength prefixed gRPC frames which are then fragmented into HTTP/2 frames at the s
ender and reassembled at the receiver. `Status` and `Trailing-Metadata` are sent
as HTTP/2 trailing headers (a.k.a., trailers). |
| 104 |
| 105 ## Flow Control |
| 106 gRPC inherits the flow control mechanisms in HTTP/2 and uses them to enable fine
-grained control of the amount of memory used for buffering in-flight messages. |
OLD | NEW |