From a7f5893c9243c8c563db215352fa7e47f6968e8b Mon Sep 17 00:00:00 2001 From: Shyam Date: Mon, 26 Jan 2015 14:20:31 -0500 Subject: epoll: Adding the ability to configure epoll threads Add the ability to configure the number of event threads for various gluster services. Currently with the multi thread epoll patch, it is possible to have more than one thread waiting on socket activity and processing the same. This thread count is currently static, which this commit makes dynamic. The current services which use IO path, i.e brick processes, any client process (nfs, FUSE, gfapi, heal, rebalance, etc.a), gain 2 set parameters to control the number of threads that are processing events. These settings are, - client.event-threads - server.event-threads The client setting affects the client graph consumers, and the server setting affects the brick processes. These are processed and inited/reconfigured using the client/server protocol xlators. Other services (say glusterd) would need to extend similar configuration settings to take advantage of multi threaded event processing. At present glusterd is not enabled with this commit, as it does not stand to gain from this multi-threading (as I understand it). Change-Id: Id8422fc57a9f95a135158eb6477ccf9d3c9ea4d9 BUG: 1104462 Signed-off-by: Shyam Reviewed-on: http://review.gluster.org/9488 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- libglusterfs/src/event.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'libglusterfs/src/event.c') diff --git a/libglusterfs/src/event.c b/libglusterfs/src/event.c index 6c253df3c1a..4dd0f991700 100644 --- a/libglusterfs/src/event.c +++ b/libglusterfs/src/event.c @@ -29,7 +29,7 @@ struct event_pool * -event_pool_new (int count) +event_pool_new (int count, int eventthreadcount) { struct event_pool *event_pool = NULL; extern struct event_ops event_ops_poll; @@ -37,7 +37,7 @@ event_pool_new (int count) #ifdef HAVE_SYS_EPOLL_H extern struct event_ops event_ops_epoll; - event_pool = event_ops_epoll.new (count); + event_pool = event_ops_epoll.new (count, eventthreadcount); if (event_pool) { event_pool->ops = &event_ops_epoll; @@ -48,7 +48,7 @@ event_pool_new (int count) #endif if (!event_pool) { - event_pool = event_ops_poll.new (count); + event_pool = event_ops_poll.new (count, eventthreadcount); if (event_pool) event_pool->ops = &event_ops_poll; @@ -129,3 +129,18 @@ event_dispatch (struct event_pool *event_pool) out: return ret; } + +int +event_reconfigure_threads (struct event_pool *event_pool, int value) +{ + int ret = -1; + + GF_VALIDATE_OR_GOTO ("event", event_pool, out); + + /* call event refresh function */ + ret = event_pool->ops->event_reconfigure_threads (event_pool, + value); + +out: + return ret; +} -- cgit