Skip to content

Commit

Permalink
feat: disable nagle algorithm for upload server
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi committed Nov 27, 2024
1 parent 0d50958 commit 226dd59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions dragonfly-client/src/grpc/dfdaemon_upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ impl DfdaemonUploadServer {
}

let server = server_builder
.tcp_nodelay(true)
.max_frame_size(super::MAX_FRAME_SIZE)
.initial_connection_window_size(super::INITIAL_WINDOW_SIZE)
.initial_stream_window_size(super::INITIAL_WINDOW_SIZE)
Expand Down Expand Up @@ -1110,6 +1111,7 @@ impl DfdaemonUploadClient {
Some(client_tls_config) => {
Channel::from_static(Box::leak(addr.clone().into_boxed_str()))
.tls_config(client_tls_config)?
.tcp_nodelay(true)
.buffer_size(super::BUFFER_SIZE)
.connect_timeout(super::CONNECT_TIMEOUT)
.timeout(super::REQUEST_TIMEOUT)
Expand All @@ -1122,6 +1124,7 @@ impl DfdaemonUploadClient {
.or_err(ErrorType::ConnectError)?
}
None => Channel::from_static(Box::leak(addr.clone().into_boxed_str()))
.tcp_nodelay(true)
.buffer_size(super::BUFFER_SIZE)
.connect_timeout(super::CONNECT_TIMEOUT)
.timeout(super::REQUEST_TIMEOUT)
Expand Down
2 changes: 1 addition & 1 deletion dragonfly-client/src/proxy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ async fn proxy_by_dfdaemon(
{
// Sleep for a while to avoid the out stream is aborted. If the task is small, proxy read the piece
// before the task download is finished. It will cause `user body write aborted` error.
sleep(Duration::from_millis(10)).await;
sleep(Duration::from_millis(1)).await;

// Send the none response to the client, if the first piece is received.
if !initialized {
Expand Down

0 comments on commit 226dd59

Please sign in to comment.