Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mimic: rgw: Adding tcp_nodelay option to Beast #27367

Merged
merged 1 commit into from May 6, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

rgw: Adding tcp_nodelay option to Beast

beast frontend option to set the TCP_NODELAY socket option to match the tcp_nodelay option in civetweb.

Fixes: https://tracker.ceph.com/issues/34308
Signed-off-by: Or Friedmann <ofriedma@redhat.com>
(cherry picked from commit fb1bff7)
  • Loading branch information...
ofriedma authored and Prashant D committed Mar 16, 2019
commit eec7fe8f4e046a654bc37c259f07f22dc566aa34
@@ -57,6 +57,19 @@ Options
:Type: String
:Default: None

``tcp_nodelay``

:Description: If set the socket option will disable Nagle's algorithm on
the connection which means that packets will be sent as soon
as possible instead of waiting for a full buffer or timeout to occur.

``1`` Disable Nagel's algorithm for all sockets.

``0`` Keep the default: Nagel's algorithm enabled.

:Type: Integer (0 or 1)
:Default: 0


Civetweb
========
@@ -218,6 +218,7 @@ class AsioFrontend {
tcp::acceptor acceptor;
tcp::socket socket;
bool use_ssl = false;
bool use_nodelay = false;

Listener(boost::asio::io_service& service)
: acceptor(service), socket(service) {}
@@ -255,7 +256,7 @@ unsigned short parse_port(const char *input, boost::system::error_code& ec)
}
return port;
}

tcp::endpoint parse_endpoint(boost::asio::string_view input,
unsigned short default_port,
boost::system::error_code& ec)
@@ -358,7 +359,14 @@ int AsioFrontend::init()
listeners.emplace_back(service);
listeners.back().endpoint = endpoint;
}

// parse tcp nodelay
auto nodelay = config.find("tcp_nodelay");
if (nodelay != config.end()) {
for (auto& l : listeners) {
l.use_nodelay = (nodelay->second == "1");
}
}

// start listeners
for (auto& l : listeners) {
l.acceptor.open(l.endpoint.protocol(), ec);
@@ -476,6 +484,8 @@ void AsioFrontend::accept(Listener& l, boost::system::error_code ec)
throw ec;
}
auto socket = std::move(l.socket);
tcp::no_delay options(l.use_nodelay);
socket.set_option(options,ec);
l.acceptor.async_accept(l.socket,
[this, &l] (boost::system::error_code ec) {
accept(l, ec);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.