From 786bf56c01c6a8757bd9dbde670c3dbd600a600d Mon Sep 17 00:00:00 2001 From: sageweil Date: Wed, 21 Mar 2007 21:20:47 +0000 Subject: [PATCH] * ms_tcp_nodelay git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1278 29311d96-e01e-0410-9327-a35deaab8ce9 --- branches/aleung/security1/ceph/config.cc | 1 + branches/aleung/security1/ceph/config.h | 1 + .../aleung/security1/ceph/msg/SimpleMessenger.cc | 12 +++++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/branches/aleung/security1/ceph/config.cc b/branches/aleung/security1/ceph/config.cc index 4302b3f5c16..3f96ab6961b 100644 --- a/branches/aleung/security1/ceph/config.cc +++ b/branches/aleung/security1/ceph/config.cc @@ -118,6 +118,7 @@ md_config_t g_conf = { ms_overlay_clients: false, ms_die_on_failure: false, + ms_tcp_nodelay: true, /*tcp_skip_rank0: false, tcp_overlay_clients: false, // over osds! diff --git a/branches/aleung/security1/ceph/config.h b/branches/aleung/security1/ceph/config.h index 701085eb61e..ce586d71d55 100644 --- a/branches/aleung/security1/ceph/config.h +++ b/branches/aleung/security1/ceph/config.h @@ -105,6 +105,7 @@ struct md_config_t { bool ms_skip_rank0; bool ms_overlay_clients; bool ms_die_on_failure; + bool ms_tcp_nodelay; // mon int mon_tick_interval; diff --git a/branches/aleung/security1/ceph/msg/SimpleMessenger.cc b/branches/aleung/security1/ceph/msg/SimpleMessenger.cc index 73632fc2f74..6f32b67afa3 100644 --- a/branches/aleung/security1/ceph/msg/SimpleMessenger.cc +++ b/branches/aleung/security1/ceph/msg/SimpleMessenger.cc @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include "config.h" @@ -413,6 +415,14 @@ void Rank::Pipe::writer() } } + // disable Nagle algorithm + if (g_conf.ms_tcp_nodelay) { + int flag = 1; + int r = ::setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof(flag)); + if (r < 0) + dout(0) << "pipe(" << peer_addr << ' ' << this << ").writer couldn't set TCP_NODELAY: " << strerror(errno) << endl; + } + // loop. lock.Lock(); while (!q.empty() || !done) { @@ -621,7 +631,7 @@ int Rank::Pipe::write_message(Message *m) } #else - if (0) { + if (1) { // one big chunk env->nchunks = -blist.length();