Files
zhuangang/topics/backend/grpc-microservices/index.md
T

44 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: backend.grpc-microservices.index
title: gRPC 与微服务
type: index
domain: backend
stack: [grpc-microservices]
tags: [gRPC, Protobuf, 微服务, 服务治理]
week: [14]
---
# gRPC 与微服务
Go 岗位的 JD 里经常出现“熟悉 gRPC / 微服务架构”。这个专题讲清楚三件事:gRPC 和 Protobuf 怎么用;服务之间调用要做哪些治理(超时、重试、熔断、限流、注册发现、链路追踪);什么时候拆服务、怎么拆。转岗求职阶段的项目不需要真的拆成很多服务,但要能讲清楚取舍。
## 学习路线
| 顺序 | 课程 | 级别 | 预计 |
| --- | --- | --- | --- |
| 1 | [gRPC 和 Protobuf:IDL、四种调用方式、错误码、超时、拦截器](01-grpc-proto.md) | 进阶 | 3 小时 |
| 2 | [服务治理:超时、重试、熔断、限流、注册发现、链路追踪、分布式事务](02-governance.md) | 进阶 | 3 小时 |
## 企业场景
- [单体拆分:从单体到“订单 + 用户”两个服务](scenarios/monolith-split.md)
## 面试题
- [gRPC 与微服务面试题](interview.md)
## 示例代码
- [examples/grpc-user](examples/grpc-user/):Python 从 `user.proto` 生成代码,演示一元调用、服务端流、错误码和超时(需要 `grpcio`、`grpcio-tools`)
- [examples/resilience](examples/resilience/):Go 标准库实现带退避的重试和熔断器,附测试
## 在 16 周计划中
- [第 14 周:后端扩展与部署](../../../plan/week14-backend-extend-deploy.md)
## 官方资料
- gRPC 文档(Go / Python 快速开始):https://grpc.io/docs/
- Protobuf 语言指南:https://protobuf.dev/programming-guides/proto3/
- OpenTelemetry:https://opentelemetry.io/docs/