From 2e72b24707f1886833db0b09e48b3f48b8d68d37 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Tue, 25 Apr 2017 10:43:07 +0530 Subject: program/GF-DUMP: Shield ping processing from traffic to Glusterfs Program Since poller thread bears the brunt of execution till the request is handed over to io-threads, poller thread experiencies lock contention(s) in the control flow till io-threads, which slows it down. This delay invariably affects reading ping requests from network and responding to them, resulting in increased ping latencies, which sometimes results in a ping-timer-expiry on client leading to disconnect of transport. So, this patch aims to free up poller thread from executing code of Glusterfs Program. We do this by making * Glusterfs Program registering itself asking rpcsvc to execute its actors in its own threads. * GF-DUMP Program registering itself asking rpcsvc to _NOT_ execute its actors in its own threads. Otherwise program's ownthreads become bottleneck in processing ping traffic. This means that poller thread reads a ping packet, invokes its actor and hands the response msg to transport queue. Change-Id: I526268c10bdd5ef93f322a4f95385137550a6a49 Signed-off-by: Raghavendra G BUG: 1421938 Reviewed-on: https://review.gluster.org/17105 NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Smoke: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Jeff Darcy --- rpc/rpc-lib/src/rpcsvc.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'rpc/rpc-lib/src/rpcsvc.h') diff --git a/rpc/rpc-lib/src/rpcsvc.h b/rpc/rpc-lib/src/rpcsvc.h index cf3e5906de1..73507b6538b 100644 --- a/rpc/rpc-lib/src/rpcsvc.h +++ b/rpc/rpc-lib/src/rpcsvc.h @@ -233,9 +233,10 @@ struct rpcsvc_request { */ rpcsvc_auth_data_t verf; - /* Execute this request's actor function as a synctask? */ - gf_boolean_t synctask; + /* Execute this request's actor function in ownthread of program?*/ + gf_boolean_t ownthread; + gf_boolean_t synctask; /* Container for a RPC program wanting to store a temp * request-specific item. */ @@ -246,6 +247,9 @@ struct rpcsvc_request { /* pointer to cached reply for use in DRC */ drc_cached_op_t *reply; + + /* request queue in rpcsvc */ + struct list_head request_list; }; #define rpcsvc_request_program(req) ((rpcsvc_program_t *)((req)->prog)) @@ -396,11 +400,18 @@ struct rpcsvc_program { */ int min_auth; - /* Execute actor function as a synctask? */ - gf_boolean_t synctask; + /* Execute actor function in program's own thread? This will reduce */ + /* the workload on poller threads */ + gf_boolean_t ownthread; + gf_boolean_t alive; + gf_boolean_t synctask; /* list member to link to list of registered services with rpcsvc */ struct list_head program; + struct list_head request_queue; + pthread_mutex_t queue_lock; + pthread_cond_t queue_cond; + pthread_t thread; }; typedef struct rpcsvc_cbk_program { -- cgit