Set TCP_NODELAY on our socket. This decreases average NBD read request RTT from 0.3ms to 0.001ms
This commit is contained in:
@@ -15,6 +15,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
|
|
||||||
static const int block_allocation_resolution = 4096;//128<<10;
|
static const int block_allocation_resolution = 4096;//128<<10;
|
||||||
|
|
||||||
static inline void dirty(struct mode_serve_params *serve, off64_t from, int len)
|
static inline void dirty(struct mode_serve_params *serve, off64_t from, int len)
|
||||||
@@ -383,6 +386,11 @@ void serve_open_server_socket(struct mode_serve_params* params)
|
|||||||
"Couldn't set SO_REUSEADDR"
|
"Couldn't set SO_REUSEADDR"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
SERVER_ERROR_ON_FAILURE(
|
||||||
|
setsockopt(params->server, IPPROTO_TCP, TCP_NODELAY, &optval, sizeof(optval)),
|
||||||
|
"Couldn't set TCP_NODELAY"
|
||||||
|
);
|
||||||
|
|
||||||
SERVER_ERROR_ON_FAILURE(
|
SERVER_ERROR_ON_FAILURE(
|
||||||
bind(params->server, ¶ms->bind_to.generic,
|
bind(params->server, ¶ms->bind_to.generic,
|
||||||
sizeof(params->bind_to)),
|
sizeof(params->bind_to)),
|
||||||
|
Reference in New Issue
Block a user