summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShreyas Siravara <sshreyas@fb.com>2016-03-30 15:35:15 -0700
committerJeff Darcy <jeff@pl.atyp.us>2017-09-12 15:28:24 +0000
commit4e880ed12b989b36387ea79179b5f14d8cee9491 (patch)
tree46315bedb250d1b360a1102cc8319239ffa05adf
parent14e24da1eb59a85fe99c22bafd8641ca2b75a923 (diff)
nfs: Enable multi-core epoll support in gNFSd
Summary: - Enables multi-core epoll support in the nfs daemon. - Option can be turned on using: gluster volume set <volname> nfs.event-threads <numthreads> Test Plan: Prove test! Reviewers: kvigor, rwareing Reviewed By: rwareing Subscribers: dld, moox, dph Differential Revision: https://phabricator.fb.com/D3117966 Change-Id: Ie8a7b1ba04b0e83f5ec7a09f9d181fe59be479ca Signed-off-by: Jeff Darcy <jdarcy@fb.com> Reviewed-on: https://review.gluster.org/18266 Reviewed-by: Jeff Darcy <jeff@pl.atyp.us> Tested-by: Jeff Darcy <jeff@pl.atyp.us> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r--tests/basic/nfs-multicore-epoll.t40
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c6
-rw-r--r--xlators/nfs/server/src/nfs.c17
-rw-r--r--xlators/nfs/server/src/nfs.h2
4 files changed, 65 insertions, 0 deletions
diff --git a/tests/basic/nfs-multicore-epoll.t b/tests/basic/nfs-multicore-epoll.t
new file mode 100644
index 00000000000..28f341521f9
--- /dev/null
+++ b/tests/basic/nfs-multicore-epoll.t
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+. $(dirname $0)/../nfs.rc
+
+cleanup;
+
+>/var/log/glusterfs/nfs.log;
+
+function check_event_thread_log ()
+{
+ local nlines
+
+ nlines=$(grep "$1" /var/log/glusterfs/nfs.log | grep -v G_LOG | wc -l)
+ if [ "$nlines" != "0" ]; then
+ echo "Y"
+ else
+ echo "N"
+ fi;
+}
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2}
+TEST $CLI volume set $V0 nfs.disable off
+TEST $CLI volume start $V0
+
+EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available;
+
+# Make sure its not enabled without the option
+EXPECT_WITHIN 10 "N" check_event_thread_log "Started thread with index 3";
+
+# Turn it on and check that we spawned the threads
+TEST $CLI volume set $V0 nfs.disable on
+TEST $CLI volume set $V0 nfs.event-threads 4
+TEST $CLI volume set $V0 nfs.disable off
+EXPECT_WITHIN 10 "Y" check_event_thread_log "Started thread with index 4";
+
+cleanup;
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index a1fa19c3207..d8c81900b6f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -2521,6 +2521,12 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.type = NO_DOC,
.op_version = 2
},
+ { .key = "nfs.event-threads",
+ .voltype = "nfs/server",
+ .option = "nfs.event-threads",
+ .type = NO_DOC,
+ .op_version = 2
+ },
/* Other options which don't fit any place above */
{ .key = "features.read-only",
.voltype = "features/read-only",
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c
index 5329194bf1d..b2f8a9eea25 100644
--- a/xlators/nfs/server/src/nfs.c
+++ b/xlators/nfs/server/src/nfs.c
@@ -1232,6 +1232,9 @@ nfs_init_state (xlator_t *this)
(int)nfs->close_idle_clients,
nfs->idle_conn_check_interval);
+ GF_OPTION_INIT ("nfs.event-threads", nfs->event_threads, uint32, free_foppool);
+ event_reconfigure_threads (this->ctx->event_pool, nfs->event_threads);
+
this->private = (void *)nfs;
INIT_LIST_HEAD (&nfs->versions);
nfs->generation = 1965;
@@ -1484,6 +1487,10 @@ nfs_reconfigure_state (xlator_t *this, dict_t *options)
(int)nfs->close_idle_clients,
nfs->idle_conn_check_interval);
+
+ GF_OPTION_RECONF ("nfs.event-threads", nfs->event_threads, options, uint32, out);
+ event_reconfigure_threads (this->ctx->event_pool, nfs->event_threads);
+
ret = 0;
out:
return ret;
@@ -2257,5 +2264,15 @@ struct volume_options options[] = {
" A value of \"off\" means that we won't close idle connections."
" A value of \"on\" means that idle connections will be closed."
},
+ { .key = {"nfs.event-threads"},
+ .type = GF_OPTION_TYPE_SIZET,
+ .min = 1,
+ .max = 32,
+ .default_value = "1",
+ .description = "Specifies the number of event threads to execute in"
+ "in parallel. Larger values would help process"
+ " responses faster, depending on available processing"
+ " power. Range 1-32 threads."
+ },
{ .key = {NULL} },
};
diff --git a/xlators/nfs/server/src/nfs.h b/xlators/nfs/server/src/nfs.h
index 6a02ae14d24..2d8e4dde016 100644
--- a/xlators/nfs/server/src/nfs.h
+++ b/xlators/nfs/server/src/nfs.h
@@ -106,6 +106,8 @@ struct nfs_state {
unsigned int client_max_idle_seconds;
unsigned int idle_conn_check_interval;
gf_boolean_t close_idle_clients;
+
+ uint32_t event_threads;
};
struct nfs_inode_ctx {