FangzuoZhang commented on code in PR #3484:
URL: https://github.com/apache/brpc/pull/3484#discussion_r3860315295


##########
src/brpc/input_messenger.cpp:
##########
@@ -192,6 +233,79 @@ void InputMessageClosure::reset(InputMessageBase* m) {
     _msg = m;
 }
 
+void InputMessenger::QueueInputMessageBatch(
+        Socket* m, std::unique_ptr<InputMessageBatch>* batch,
+        int* num_bthread_created, bool last_msg) {
+    if (!batch->get() || (*batch)->empty()) {
+        return;
+    }
+    m->_transport->QueueMessages(
+        batch->release(), num_bthread_created, last_msg);
+}
+
+void InputMessenger::QueueLastMessageOrBatch(
+        Socket* m, InputMessageClosure& last_msg,
+        std::unique_ptr<InputMessageBatch>* batch,
+        int* num_bthread_created, size_t batch_size) {
+    InputMessageBase* msg = last_msg.release();
+    if (!msg) {
+        return;
+    }
+    if (!batch->get()) {
+        batch->reset(new (std::nothrow) InputMessageBatch(batch_size));
+    }

Review Comment:
   The initial vector reservation is now capped at the adaptive
   maximum batch size. A larger fixed batch size can still grow dynamically, but
   a user-controlled flag can no longer trigger a huge upfront allocation.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to