Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: delete stream.md && supplement stream description to client #752

Merged
merged 8 commits into from
Sep 7, 2023
2 changes: 1 addition & 1 deletion content/en/docs/hertz/tutorials/basic-feature/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ Since the client has the problem of multiplexing connections, if streaming is us
1. If the user doesn't close the connection, the connection will eventually be closed by the GC without causing a connection leak. However, due to the need to wait for 2 Round-Trip Time to close the connection, in the case of high concurrency, the consequence is that there will be too many open files and creating a new connection will be impossible.

2. Users can recycle the connection by calling the relevant interface. After recycling, the connection will be put into the connection pool for reuse, so as to achieve higher resource utilization and better performance. The following methods will recycle the connection. Warning: Recycling can only be done once.
1. Show call: `protocol.ReleaseResponse(), resp.Reset(), resp.ResetBody()`.
1. Explicit call: `protocol.ReleaseResponse(), resp.Reset(), resp.ResetBody()`.
1. Implicit call: The server side will also recycle the response. Assign the client side response to the server side or pass the server side response to the client (eg: client uses reverse proxy), there is no need to display the method of calling the recovery.
rogerogers marked this conversation as resolved.
Show resolved Hide resolved

Sample Code:
Expand Down
4 changes: 2 additions & 2 deletions content/zh/docs/hertz/tutorials/basic-feature/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,8 @@ client 有复用连接的问题,如果使用了流式,那连接就会交由

1. 如果用户不关闭连接,连接最终会被 GC 关掉,不会造成连接泄漏。但是,由于关闭连接需要等待 2RTT,在高并发情况下可能会出现 fd 被打满导致无法新建连接的情况。
2. 用户可以调用相关接口回收连接,回收后,该连接会放入连接池中复用,资源使用率更好,性能更高。以下几种方式都会回收连接,注意回收只能回收一次。
1. 显示调用 `protocol.ReleaseResponse(), resp.Reset(), resp.ResetBody()`。
2. 非显示调用:server 侧也会有回收 resp 的逻辑。如果将 client 的 response 赋值给 server 或者直接把 server 的 response 传递给 client 的情况下(如:client 作为反向代理)就不需要显示调用回收的方法了。
1. 显式调用 `protocol.ReleaseResponse(), resp.Reset(), resp.ResetBody()`。
2. 非显式调用:server 侧也会有回收 resp 的逻辑。如果将 client 的 response 赋值给 server 或者直接把 server 的 response 传递给 client 的情况下(如:client 作为反向代理)就不需要显示调用回收的方法了。
rogerogers marked this conversation as resolved.
Show resolved Hide resolved

示例代码:

Expand Down