cb8e9e
From b02af7c959377cb95521f1f8d17e8ac38d2999e5 Mon Sep 17 00:00:00 2001
cb8e9e
From: Krishnan Parthasarathi <kparthas@redhat.com>
cb8e9e
Date: Sat, 11 Jul 2015 09:21:27 +0530
cb8e9e
Subject: [PATCH 312/320] glusterd: use 2 epoll worker threads by default
cb8e9e
cb8e9e
        Backport of http://review.gluster.org/11847
cb8e9e
cb8e9e
The no. of epoll worker threads can be configured
cb8e9e
by adding the following option into glusterd.vol.
cb8e9e
cb8e9e
        option event-threads <NUM-OF-EPOLL_WORKERS>
cb8e9e
cb8e9e
BUG: 1241336
cb8e9e
Change-Id: I2a9e2d81c64beaf54872081f9ce45355cf4dfca7
cb8e9e
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
cb8e9e
Reviewed-on: http://review.gluster.org/11630
cb8e9e
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
cb8e9e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
cb8e9e
Tested-by: Gluster Build System <jenkins@build.gluster.com>
cb8e9e
(cherry picked from commit 6b7bdcb02cf39199d3720c2471121d14df64c8ab)
cb8e9e
Reviewed-on: http://review.gluster.org/11847
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/56625
cb8e9e
Tested-by: Atin Mukherjee <amukherj@redhat.com>
cb8e9e
---
cb8e9e
 xlators/mgmt/glusterd/src/glusterd.c |   21 +++++++++++++++++++++
cb8e9e
 xlators/mgmt/glusterd/src/glusterd.h |    1 +
cb8e9e
 2 files changed, 22 insertions(+), 0 deletions(-)
cb8e9e
cb8e9e
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
cb8e9e
index 2c75545..b83b249 100644
cb8e9e
--- a/xlators/mgmt/glusterd/src/glusterd.c
cb8e9e
+++ b/xlators/mgmt/glusterd/src/glusterd.c
cb8e9e
@@ -28,6 +28,7 @@
cb8e9e
 #include "defaults.h"
cb8e9e
 #include "list.h"
cb8e9e
 #include "dict.h"
cb8e9e
+#include "options.h"
cb8e9e
 #include "compat.h"
cb8e9e
 #include "compat-errno.h"
cb8e9e
 #include "syscall.h"
cb8e9e
@@ -1327,6 +1328,7 @@ init (xlator_t *this)
cb8e9e
         char              *valgrind_str               = NULL;
cb8e9e
         char              *transport_type             = NULL;
cb8e9e
         char               var_run_dir[PATH_MAX]      = {0,};
cb8e9e
+        int32_t            workers                    = 0;
cb8e9e
 
cb8e9e
 #ifndef GF_DARWIN_HOST_OS
cb8e9e
         {
cb8e9e
@@ -1775,6 +1777,15 @@ init (xlator_t *this)
cb8e9e
         if (ret)
cb8e9e
                 goto out;
cb8e9e
 
cb8e9e
+        GF_OPTION_INIT ("event-threads", workers, int32, out);
cb8e9e
+        if (workers > 0 && workers != conf->workers) {
cb8e9e
+                conf->workers = workers;
cb8e9e
+                ret = event_reconfigure_threads (this->ctx->event_pool,
cb8e9e
+                                                 workers);
cb8e9e
+                if (ret)
cb8e9e
+                        goto out;
cb8e9e
+        }
cb8e9e
+
cb8e9e
         ret = 0;
cb8e9e
 out:
cb8e9e
         if (ret < 0) {
cb8e9e
@@ -1953,5 +1964,15 @@ struct volume_options options[] = {
cb8e9e
           .max  = 300,
cb8e9e
           .default_value = TOSTRING(RPC_DEFAULT_PING_TIMEOUT),
cb8e9e
         },
cb8e9e
+        { .key   = {"event-threads"},
cb8e9e
+          .type  = GF_OPTION_TYPE_INT,
cb8e9e
+          .min   = 1,
cb8e9e
+          .max   = 32,
cb8e9e
+          .default_value = "2",
cb8e9e
+          .description = "Specifies the number of event threads to execute "
cb8e9e
+                         "in parallel. Larger values would help process"
cb8e9e
+                         " responses faster, depending on available processing"
cb8e9e
+                         " power. Range 1-32 threads."
cb8e9e
+        },
cb8e9e
         { .key   = {NULL} },
cb8e9e
 };
cb8e9e
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
cb8e9e
index c72c569..b6876f8 100644
cb8e9e
--- a/xlators/mgmt/glusterd/src/glusterd.h
cb8e9e
+++ b/xlators/mgmt/glusterd/src/glusterd.h
cb8e9e
@@ -175,6 +175,7 @@ typedef struct {
cb8e9e
         struct cds_list_head       missed_snaps_list;
cb8e9e
         int                        ping_timeout;
cb8e9e
         uint32_t                   generation;
cb8e9e
+        int32_t                    workers;
cb8e9e
 } glusterd_conf_t;
cb8e9e
 
cb8e9e
 
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e