From 7d641313f46789ec0a7ba0cc04f504724c780855 Mon Sep 17 00:00:00 2001 From: Milind Changire Date: Mon, 26 Feb 2018 15:14:18 +0530 Subject: rpcsvc: scale rpcsvc_request_handler threads Scale rpcsvc_request_handler threads to match the scaling of event handler threads. Please refer to https://bugzilla.redhat.com/show_bug.cgi?id=1467614#c51 for a discussion about why we need multi-threaded rpcsvc request handlers. Change-Id: Ib6838fb8b928e15602a3d36fd66b7ba08999430b Signed-off-by: Milind Changire --- glusterfsd/src/Makefile.am | 1 + glusterfsd/src/glusterfsd-mgmt.c | 16 +++++++++++++--- glusterfsd/src/glusterfsd.h | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) (limited to 'glusterfsd/src') diff --git a/glusterfsd/src/Makefile.am b/glusterfsd/src/Makefile.am index eb92e66e989..3286e639bcf 100644 --- a/glusterfsd/src/Makefile.am +++ b/glusterfsd/src/Makefile.am @@ -25,6 +25,7 @@ AM_CPPFLAGS = $(GF_CPPFLAGS) \ -I$(top_srcdir)/rpc/xdr/src \ -I$(top_builddir)/rpc/xdr/src \ -I$(top_srcdir)/xlators/nfs/server/src \ + -I$(top_srcdir)/xlators/protocol/server/src \ -I$(top_srcdir)/api/src AM_CFLAGS = -Wall $(GF_CFLAGS) diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index 355b25f8aab..fa824de9996 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -33,6 +33,7 @@ #include "xlator.h" #include "syscall.h" #include "monitoring.h" +#include "server.h" static gf_boolean_t is_mgmt_rpc_reconnect = _gf_false; int need_emancipate = 0; @@ -185,12 +186,15 @@ glusterfs_terminate_response_send (rpcsvc_request_t *req, int op_ret) } void -glusterfs_autoscale_threads (glusterfs_ctx_t *ctx, int incr) +glusterfs_autoscale_threads (glusterfs_ctx_t *ctx, int incr, xlator_t *this) { struct event_pool *pool = ctx->event_pool; + server_conf_t *conf = this->private; + int thread_count = pool->eventthreadcount; pool->auto_thread_count += incr; - (void) event_reconfigure_threads (pool, pool->eventthreadcount+incr); + (void) event_reconfigure_threads (pool, thread_count+incr); + rpcsvc_ownthread_reconf (conf->rpc, pool->eventthreadcount); } int @@ -842,6 +846,7 @@ glusterfs_handle_attach (rpcsvc_request_t *req) xlator_t *nextchild = NULL; glusterfs_graph_t *newgraph = NULL; glusterfs_ctx_t *ctx = NULL; + xlator_t *protocol_server = NULL; GF_ASSERT (req); this = THIS; @@ -879,7 +884,12 @@ glusterfs_handle_attach (rpcsvc_request_t *req) nextchild->name); goto out; } - glusterfs_autoscale_threads (this->ctx, 1); + /* we need a protocol/server xlator as + * nextchild + */ + protocol_server = this->ctx->active->first; + glusterfs_autoscale_threads (this->ctx, 1, + protocol_server); } } else { gf_log (this->name, GF_LOG_WARNING, diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h index 9a0281e78a4..516eef864c0 100644 --- a/glusterfsd/src/glusterfsd.h +++ b/glusterfsd/src/glusterfsd.h @@ -126,7 +126,7 @@ int glusterfs_volume_top_read_perf (uint32_t blk_size, uint32_t blk_count, char *brick_path, double *throughput, double *time); void -glusterfs_autoscale_threads (glusterfs_ctx_t *ctx, int incr); +glusterfs_autoscale_threads (glusterfs_ctx_t *ctx, int incr, xlator_t *this); extern glusterfs_ctx_t *glusterfsd_ctx; #endif /* __GLUSTERFSD_H__ */ -- cgit