Skip to content

Commit fe2c4f3

Browse files
committed
fix grpc readme
1 parent c28ea55 commit fe2c4f3

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

springboot-rpc-grpc-sample/README.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,33 @@
11
# RPC服务框架之gRPC
22

33
### 一.什么是RPC?
4-
54
##### RPC原理简图
6-
7-
<img src="https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/master/ReadmeMaterial/grpc/831608122149_.pic_hd.jpg" width = "580" height = "340" alt="图片名称" align=center />
5+
<img src="https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/master/ReadmeMaterial/grpc/831608122149_.pic_hd.jpg" width = "600" height = "340" alt="图片名称" align=center />
86

97
### 二.什么是gRPC?
10-
118
##### gRPC是一个高性能、通用的开源RPC框架,基于HTTP/2二进制协议标准而设计,基于ProtoBuf(Protocol Buffers)序列化协议开发,且支持众多开发语言。
129

1310
##### ProtoBuf具有了优秀的系列化协议所需的众多典型特性
1411
ProtoBuf是一个存粹的展示层协议,可以和各种传输层协议一起使用
1512
> - 具有标准的IDL和IDL编译器;
16-
>
1713
> - 序列化数据非常简介,紧凑,与XML相比,其序列化之后的数据量约为1/3和1/10;
18-
>
1914
> - 解析速度非常快,比对应的XML快20~100倍速度
2015
2116

2217
#### gRPC服务端创建流程
23-
24-
<img src="https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/master/ReadmeMaterial/grpc/841608122163_.pic_hd.jpg" width = "620" height = "380" alt="图片名称" align=center />
18+
<img src="https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/master/ReadmeMaterial/grpc/841608122163_.pic_hd.jpg" width = "660" height = "395" alt="图片名称" align=center />
2519

2620
> - gRPC服务端基于NettyServer负责监听Socket地址,基于HTTP2协议的写入;
27-
>
2821
> - gPRC服务接口并不是使用反射来实现的,而是通过Proto工具生成的代码,将服务接口注册到gRPC内部的服务上,性能较高;
29-
>
3022
> - ServerImpl负责整个gRPC服务端消息的调度和处理,会初始化:Netty线程池、gRPC的线程池、内部服务注册等;
3123
3224
#### gRPC消息接入流程
33-
34-
<img src="https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/master/ReadmeMaterial/grpc/851608122185_.pic_hd.jpg" width = "620" height = "380" alt="图片名称" align=center />
25+
<img src="https://raw.githubusercontent.com/ipipman/JavaSpringBootSamples/master/ReadmeMaterial/grpc/851608122185_.pic_hd.jpg" width = "700" height = "420" alt="图片名称" align=center />
3526

3627
> - gRPC消息由netty/http2协议负责接入,通过gRPC注册的Http2FrameLister将解码后的Http Header和Http Body后,发送到gRPC的NettyServerHandler,实现Netty Http/2的消息接入;
3728
3829

3930
### 三.gRPC实战
40-
4131
##### 1.编写PB文件,proto语法参考:[https://developers.google.com/protocol-buffers/docs/proto](https://developers.google.com/protocol-buffers/docs/proto "https://developers.google.com/protocol-buffers/docs/proto")
4232
```java
4333
syntax = "proto3";
@@ -61,7 +51,6 @@ message HelloReply {
6151
```
6252

6353
##### 2.编写Server端,通过@GrpcService注解注册gRPC服务
64-
6554
```java
6655
@Slf4j
6756
@GrpcService(GreeterOuterClass.class)
@@ -85,7 +74,6 @@ public class GreeterService extends GreeterGrpc.GreeterImplBase {
8574
```
8675

8776
##### 3.编写Client端,通过@GrpcClient绑定gRPC服务端地址与端口等信息
88-
8977
```java
9078
@Service
9179
public class GrpcClientServiceImpl implements IGrpcClientService {

0 commit comments

Comments
 (0)