diff options
author | Xavi Hernandez <xhernandez@redhat.com> | 2019-01-24 18:44:06 +0100 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2019-02-18 02:58:24 +0000 |
commit | dddcf52020004d98f688ebef968de51d76cbf9a6 (patch) | |
tree | 01ee4c39a7859a76562e15aa7045c5bd86417a60 /configure.ac | |
parent | ec273a46820ba17f46488c082c65cd1aa6739be3 (diff) |
core: implement a global thread pool
This patch implements a thread pool that is wait-free for adding jobs to
the queue and uses a very small locked region to get jobs. This makes it
possible to decrease contention drastically. It's based on wfcqueue
structure provided by urcu library.
It automatically enables more threads when load demands it, and stops
them when not needed. There's a maximum number of threads that can be
used. This value can be configured.
Depending on the workload, the maximum number of threads plays an
important role. So it needs to be configured for optimal performance.
Currently the thread pool doesn't self adjust the maximum for the
workload, so this configuration needs to be changed manually.
For this reason, the global thread pool has been made optional, so that
volumes can still use the thread pool provided by io-threads.
To enable it for bricks, the following option needs to be set:
config.global-threading = on
This option has no effect if bricks are already running. A restart is
required to activate it. It's recommended to also enable the following
option when running bricks with the global thread pool:
performance.iot-pass-through = on
To enable it for a FUSE mount point, the option '--global-threading'
must be added to the mount command. To change it, an umount and remount
is needed. It's recommended to disable the following option when using
global threading on a mount point:
performance.client-io-threads = off
To enable it for services managed by glusterd, glusterd needs to be
started with option '--global-threading'. In this case all daemons, like
self-heal, will be using the global thread pool.
Currently it can only be enabled for bricks, FUSE mounts and glusterd
services.
The maximum number of threads for clients and bricks can be configured
using the following options:
config.client-threads
config.brick-threads
These options can be applied online and its effect is immediate most of
the times. If one of them is set to 0, the maximum number of threads
will be calcutated as #cores * 2.
Some distributions use a very old userspace-rcu library (version 0.7)
for this reason, some header files from version 0.10 have been copied
into contrib/userspace-rcu and are used if the detected version is 0.7
or older.
An additional change has been made to io-threads to prevent that threads
are started when iot-pass-through is set.
Change-Id: I09d19e246b9e6d53c6247b29dfca6af6ee00a24b
updates: #532
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 8752ca043bf..3aa7f4e77c1 100644 --- a/configure.ac +++ b/configure.ac @@ -1359,10 +1359,12 @@ PKG_CHECK_MODULES([URCU], [liburcu-bp], [], AC_MSG_ERROR([liburcu-bp not found]))]) PKG_CHECK_MODULES([URCU_CDS], [liburcu-cds >= 0.8], [], [PKG_CHECK_MODULES([URCU_CDS], [liburcu-cds >= 0.7], - [AC_DEFINE(URCU_OLD, 1, [Define if liburcu 0.6 or 0.7 is found])], + [AC_DEFINE(URCU_OLD, 1, [Define if liburcu 0.6 or 0.7 is found]) + USE_CONTRIB_URCU='yes'], [AC_CHECK_HEADERS([urcu/cds.h], [AC_DEFINE(URCU_OLD, 1, [Define if liburcu 0.6 or 0.7 is found]) - URCU_CDS_LIBS='-lurcu-cds'], + URCU_CDS_LIBS='-lurcu-cds' + USE_CONTRIB_URCU='yes'], [AC_MSG_ERROR([liburcu-cds not found])])])]) BUILD_UNITTEST="no" @@ -1526,6 +1528,9 @@ AC_SUBST(CONTRIBDIR) GF_CPPDEFINES='-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D$(GF_HOST_OS)' GF_CPPINCLUDES='-include $(top_builddir)/config.h -include $(top_builddir)/site.h -I$(top_srcdir)/libglusterfs/src -I$(top_builddir)/libglusterfs/src' +if test "x${USE_CONTRIB_URCU}" = "xyes"; then + GF_CPPINCLUDES="${GF_CPPINCLUDES} -I\$(CONTRIBDIR)/userspace-rcu" +fi GF_CPPFLAGS="$GF_CPPFLAGS $GF_CPPDEFINES $GF_CPPINCLUDES" AC_SUBST([GF_CPPFLAGS]) |