Skip to content

Commit

Permalink
set SO_RCVBUF before connect
Browse files Browse the repository at this point in the history
SO_RCVBUF needs to be set before connect otherwise tcp settings will
not be finalized correctly. And since autotuning is not engaged in this
case, the throughput will suffer.
  • Loading branch information
dqminh committed May 13, 2024
1 parent 9532904 commit fef3277
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .bleep
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4f0cf40a46611bbbcdffa99dd81220aa67f82394
6047acc79584d167765d8a3a557df7d4d3ceac88
8 changes: 4 additions & 4 deletions pingora-core/src/connectors/l4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ where
if peer.tcp_fast_open() {
set_tcp_fastopen_connect(socket.as_raw_fd())?;
}
if let Some(recv_buf) = peer.tcp_recv_buf() {
debug!("Setting recv buf size");
set_recv_buf(socket.as_raw_fd(), recv_buf)?;
}
Ok(())
});
let conn_res = match peer.connection_timeout() {
Expand All @@ -61,10 +65,6 @@ where
debug!("Setting tcp keepalive");
set_tcp_keepalive(&socket, ka)?;
}
if let Some(recv_buf) = peer.tcp_recv_buf() {
debug!("Setting recv buf size");
set_recv_buf(socket.as_raw_fd(), recv_buf)?;
}
Ok(socket.into())
}
Err(e) => {
Expand Down

0 comments on commit fef3277

Please sign in to comment.