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