You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/10/14 08:00:14 UTC

[GitHub] [incubator-brpc] wwbmmm commented on a diff in pull request #1928: limiting max bytes in stream comsume queue with the same host socket

wwbmmm commented on code in PR #1928:
URL: https://github.com/apache/incubator-brpc/pull/1928#discussion_r995464880


##########
src/brpc/stream.h:
##########
@@ -49,12 +49,18 @@ class StreamInputHandler {
 
 struct StreamOptions {
     StreamOptions()
-        : max_buf_size(2 * 1024 * 1024)
+        : min_buf_size(1024 * 1024)
+        , max_buf_size(2 * 1024 * 1024)
         , idle_timeout_ms(-1)
         , messages_in_batch(128)
         , handler(NULL)
     {}
 
+    // The max size of unconsumed data allowed at remote side. 

Review Comment:
   the comment of min_buf_size is same as max_buf_size



##########
src/brpc/stream.cpp:
##########
@@ -287,18 +295,37 @@ int Stream::AppendIfNotFull(const butil::IOBuf &data) {
     return 0;
 }
 
-void Stream::SetRemoteConsumed(size_t new_remote_consumed) {
-    CHECK(_options.max_buf_size > 0);
+void Stream::SetRemoteConsumed(size_t new_remote_consumed, int64_t remote_stream_buffer_remain) {
+    CHECK(_cur_max_buf_size > 0);
     bthread_id_list_t tmplist;
     bthread_id_list_init(&tmplist, 0, 0);
     bthread_mutex_lock(&_congestion_control_mutex);
     if (_remote_consumed >= new_remote_consumed) {
         bthread_mutex_unlock(&_congestion_control_mutex);
         return;
     }
-    const bool was_full = _produced >= _remote_consumed + (size_t)_options.max_buf_size;
+    const bool was_full = _produced >= _remote_consumed + (size_t)_cur_max_buf_size;
+
+    if (FLAGS_socket_max_streams_unconsumed_bytes > 0)
+    {

Review Comment:
   { don't need a new line



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org