Skip to content

Commit 2077620

Browse files
authored
[ISSUE #3523]⚡️Increase buffer size to 8 KB in Connection implementation (#3524)
1 parent 1567bdf commit 2077620

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rocketmq-remoting/src/connection.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,14 @@ impl Connection {
9999
/// A new `Connection` instance.
100100
pub fn new(tcp_stream: TcpStream) -> Connection {
101101
const CAPACITY: usize = 1024 * 1024; // 1 MB
102+
const BUFFER_SIZE: usize = 8 * 1024; // 8 KB
102103
let framed = Framed::with_capacity(tcp_stream, CompositeCodec::new(), CAPACITY);
103104
let (writer, reader) = framed.split();
104105
Self {
105106
writer,
106107
reader,
107108
ok: true,
108-
buf: BytesMut::with_capacity(4096),
109+
buf: BytesMut::with_capacity(BUFFER_SIZE),
109110
}
110111
}
111112

0 commit comments

Comments
 (0)