You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/src/main/java/io/grpc/examples/manualflowcontrol/README.md
+5-11Lines changed: 5 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
-
gRPC Manual Flow Control Example
2
-
=====================
1
+
# gRPC Manual Flow Control Example
2
+
3
3
Flow control is relevant for streaming RPC calls.
4
4
5
5
By default, gRPC will handle dealing with flow control. However, for specific
@@ -25,14 +25,7 @@ value.
25
25
26
26
### Outgoing Flow Control
27
27
28
-
The underlying layer (such as Netty) will make the write wait when there is no
29
-
space to write the next message. This causes the request stream to go into
30
-
a not ready state and the outgoing onNext method invocation waits. You can
31
-
explicitly check that the stream is ready for writing before calling onNext to
32
-
avoid blocking. This is done with `CallStreamObserver.isReady()`. You can
33
-
utilize this to start doing reads, which may allow
34
-
the other side of the channel to complete a write and then to do its own reads,
35
-
thereby avoiding deadlock.
28
+
The underlying layer (such as Netty) manages a buffer for outgoing messages. If you write messages faster than they can be sent over the network, this buffer will grow, which can eventually lead to an OutOfMemoryError. The outgoing onNext method invocation does not block when this happens. Therefore, you should explicitly check that the stream is ready for writing via CallStreamObserver.isReady() before calling onNext to avoid buffering excessive amounts of data in memory.
36
29
37
30
### Incoming Manual Flow Control
38
31
@@ -71,6 +64,7 @@ When you are ready to begin processing the next value from the stream call
71
64
`serverCallStreamObserver.request(1)`
72
65
73
66
### Related documents
67
+
74
68
Also see [gRPC Flow Control Users Guide][user guide]
0 commit comments