From cf1f33a261b093a5cdb17406f3bc8e301caf9581 Mon Sep 17 00:00:00 2001 From: Milind Changire Date: Tue, 6 Jun 2017 12:42:40 +0530 Subject: rpc: add options to manage socket keepalive lifespan Problem: Default values for handling socket timeouts for brick responses are insufficient for aggressive applications such as databases. Solution: Add 1:1 gluster options for keepalive, keepalive-idle, keepalive-interval and keepalive-timeout as per the socket level options available as per tcp(7) man page. Default values for options are NOT agressive and continue to be values which result in default timeout when only the keep alive option is turned on. These options are Linux specific and will not be applicable to the *BSDs. mainline: > BUG: 1426059 > Signed-off-by: Milind Changire > Reviewed-on: https://review.gluster.org/16731 > Smoke: Gluster Build System > CentOS-regression: Gluster Build System > NetBSD-regression: NetBSD Build System > Reviewed-by: Raghavendra G (cherry picked from commit 6b8df081b46ac4f485c86a5052fc30472e74bfbb) Change-Id: I2a08ecd949ca8ceb3e090d336ad634341e2dbf14 BUG: 1452038 Signed-off-by: Milind Changire Reviewed-on: https://review.gluster.org/17330 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Raghavendra Talur --- xlators/mgmt/glusterd/src/glusterd-volume-set.c | 56 ++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt/glusterd') diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index bb3e2100901..d5f9fcf00a8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -1681,6 +1681,7 @@ struct volopt_map_entry glusterd_volopt_map[] = { { .key = "network.ping-timeout", .voltype = "protocol/client", .op_version = 1, + .value = "42", .flags = OPT_FLAG_CLIENT_OPT }, { .key = "network.tcp-window-size", @@ -1724,12 +1725,40 @@ struct volopt_map_entry glusterd_volopt_map[] = { .voltype = "protocol/client", .op_version = GD_OP_VERSION_3_7_0, }, + { .key = "client.tcp-user-timeout", + .voltype = "protocol/client", + .option = "transport.tcp-user-timeout", + .op_version = GD_OP_VERSION_3_10_4, + .value = "0", /* 0 - implies "use system default" */ + .flags = OPT_FLAG_CLIENT_OPT + }, + { .key = "client.keepalive-time", + .voltype = "protocol/client", + .option = "transport.socket.keepalive-time", + .op_version = GD_OP_VERSION_3_10_4, + .value = "20", + .flags = OPT_FLAG_CLIENT_OPT + }, + { .key = "client.keepalive-interval", + .voltype = "protocol/client", + .option = "transport.socket.keepalive-interval", + .op_version = GD_OP_VERSION_3_10_4, + .value = "2", + .flags = OPT_FLAG_CLIENT_OPT + }, + { .key = "client.keepalive-count", + .voltype = "protocol/client", + .option = "transport.socket.keepalive-count", + .op_version = GD_OP_VERSION_3_10_4, + .value = "9", + .flags = OPT_FLAG_CLIENT_OPT + }, /* Server xlator options */ { .key = "network.ping-timeout", .voltype = "protocol/server", - .option = "transport.tcp-user-timeout", .op_version = GD_OP_VERSION_3_7_0, + .value = "42", }, { .key = "network.tcp-window-size", .voltype = "protocol/server", @@ -1755,6 +1784,7 @@ struct volopt_map_entry glusterd_volopt_map[] = { .voltype = "protocol/server", .option = "transport.socket.keepalive", .type = NO_DOC, + .value = "1", .op_version = 1 }, { .key = "server.allow-insecure", @@ -1842,6 +1872,30 @@ struct volopt_map_entry glusterd_volopt_map[] = { .voltype = "protocol/server", .op_version = GD_OP_VERSION_3_7_0, }, + { .key = "server.tcp-user-timeout", + .voltype = "protocol/server", + .option = "transport.tcp-user-timeout", + .op_version = GD_OP_VERSION_3_10_4, + .value = "0", /* 0 - implies "use system default" */ + }, + { .key = "server.keepalive-time", + .voltype = "protocol/server", + .option = "transport.socket.keepalive-time", + .op_version = GD_OP_VERSION_3_10_4, + .value = "20", + }, + { .key = "server.keepalive-interval", + .voltype = "protocol/server", + .option = "transport.socket.keepalive-interval", + .op_version = GD_OP_VERSION_3_10_4, + .value = "2", + }, + { .key = "server.keepalive-count", + .voltype = "protocol/server", + .option = "transport.socket.keepalive-count", + .op_version = GD_OP_VERSION_3_10_4, + .value = "9", + }, /* Generic transport options */ { .key = SSL_OWN_CERT_OPT, -- cgit