Skip to content

Commit 43c1941

Browse files
doc: sync gRPC Streaming Graceful Shutdown (#1190)
Co-authored-by: yuxuan.wang1 <[email protected]>
1 parent 644fef0 commit 43c1941

File tree

10 files changed

+76
-22
lines changed

10 files changed

+76
-22
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "Streaming"
3+
linkTitle: "Streaming"
4+
weight: 2
5+
date: 2024-01-13
6+
description: >
7+
---
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "gRPC"
3+
linkTitle: "gRPC"
4+
weight: 2
5+
date: 2024-01-13
6+
description: >
7+
---
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "gRPC Streaming Graceful Shutdown"
3+
date: 2025-01-13
4+
weight: 4
5+
keywords: ["gRPC Streaming Graceful Shutdown"]
6+
description: "This article describes how to use Graceful Shutdown over gRPC"
7+
---
8+
9+
## Background
10+
11+
To effectively solve the problem of upstream error reporting caused by service upgrade/migration, Kitex supports the graceful shutdown function of gRPC Streaming in the new version (v0.12.0).
12+
13+
By setting a reasonable window time, the streams with a lifetime shorter than this window can continue to work until the end, while the streams with a lifetime longer than this window will be forcibly closed.
14+
15+
## Usage
16+
17+
### Confirm the window time
18+
19+
Before starting the configuration, please obtain the duration distribution of the streams in the current service based on business statistics, and thereby establish a reasonable window time, denoted as **graceTime**, for example:
20+
21+
- All streams can be completed within 5 minutes, and 5 minutes is an acceptable service upgrade time, then **graceTime** is 5 minutes.
22+
- Most streams can be completed within 5 minutes, and very few streams will last for 30 minutes, then **graceTime** can still be set to 5 minutes, and the flows exceeding graceTime will be forcibly closed.
23+
24+
### Configuration
25+
26+
When creating the Server, pass `server.WithExitWaitTime(graceTime)`.
27+
28+
If not configured, the default is **5 s**.
29+
30+
```go
31+
import (
32+
"github.com/cloudwego/kitex/server"
33+
)
34+
35+
const (
36+
graceTime = 600 * time.Second
37+
)
38+
39+
svr := testservice.NewServer(hdl, server.WithExitWaitTime(graceTime))
40+
```

content/en/docs/kitex/Tutorials/basic-feature/protocol/transport-streaming/thrift_streaming.md renamed to content/en/docs/kitex/Tutorials/basic-feature/protocol/streaming/gRPC/thrift_streaming.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: "Thrift Streaming"
2+
title: "Thrift Streaming over gRPC"
33
date: 2024-03-09
4-
weight: 2
5-
keywords: ["Kitex", "Streaming", "Thrift"]
6-
description: This article describes how to define and use the Streaming API in Thrift IDL.
4+
weight: 3
5+
keywords: ["Kitex", "Streaming", "Thrift", "gRPC"]
6+
description: This article describes how to define and use the Streaming API in Thrift IDL over gRPC.
77
---
88

99
## Introduction

content/en/docs/kitex/Tutorials/basic-feature/protocol/transport-streaming/_index.md

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "Streaming"
3+
linkTitle: "Streaming"
4+
weight: 2
5+
date: 2024-03-06
6+
description: >
7+
---
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "gRPC"
3+
linkTitle: "gRPC"
4+
weight: 2
5+
date: 2025-01-13
6+
description: >
7+
---
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "gRPC Streaming 优雅退出"
33
date: 2025-01-10
4-
weight: 3
4+
weight: 4
55
keywords: ["优雅退出"]
66
description: "本文介绍如何使用 gRPC Streaming 优雅突出"
77
---

content/zh/docs/kitex/Tutorials/basic-feature/protocol/transport-streaming/thrift_streaming.md renamed to content/zh/docs/kitex/Tutorials/basic-feature/protocol/streaming/gRPC/thrift_streaming.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: "Thrift Streaming"
2+
title: "Thrift Streaming over gRPC"
33
date: 2024-03-06
4-
weight: 2
5-
keywords: ["Kitex", "Streaming", "Thrift"]
4+
weight: 3
5+
keywords: ["Kitex", "Streaming", "Thrift", "gRPC"]
66
description: 本文介绍如何在 Thrift IDL 里定义并使用 Streaming API。
77
---
88

content/zh/docs/kitex/Tutorials/basic-feature/protocol/transport-streaming/_index.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)