diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2016-07-21 14:49:55 -0400 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2016-07-28 07:50:52 -0700 |
commit | 25d1bdc094a8408afc074817ec6d63c812c571f9 (patch) | |
tree | 20cf0fc0ff7089a4f4c66f2ee892ea3ba3b252fa | |
parent | b8e8bfc7e4d3eaf76bb637221bc6392ec10ca54b (diff) |
io-threads: remove least-rate-limit option and code
This will be unnecessary, and mostly in the way, as real fairness
guarantees are implemented.
Change-Id: Ic61ec1c9e9add58385f1a4eafcfe2cc554ceefc8
BUG: 1360402
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/14989
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: Gluster Build System <jenkins@build.gluster.org>
-rwxr-xr-x | tests/bugs/replicate/bug-853680.t | 53 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-set.c | 4 | ||||
-rw-r--r-- | xlators/performance/io-threads/src/io-threads.c | 87 | ||||
-rw-r--r-- | xlators/performance/io-threads/src/io-threads.h | 11 |
4 files changed, 2 insertions, 153 deletions
diff --git a/tests/bugs/replicate/bug-853680.t b/tests/bugs/replicate/bug-853680.t deleted file mode 100755 index 806c3d142a1..00000000000 --- a/tests/bugs/replicate/bug-853680.t +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# -# Bug 853680 -# -# Test that io-threads least-rate-limit throttling functions as expected. Set -# a limit, perform a few operations with a least-priority mount and verify -# said operations take a minimum amount of time according to the limit. - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc - -cleanup; - -TEST glusterd - -TEST $CLI volume create $V0 $H0:$B0/${V0}1 -TEST $CLI volume start $V0 - -#Accept min val -TEST $CLI volume set $V0 performance.least-rate-limit 0 -#Accept some value in between -TEST $CLI volume set $V0 performance.least-rate-limit 1035 -#Accept max val INT_MAX -TEST $CLI volume set $V0 performance.least-rate-limit 2147483647 - -#Reject other values -TEST ! $CLI volume set $V0 performance.least-rate-limit 2147483648 -TEST ! $CLI volume set $V0 performace.least-rate-limit -8 -TEST ! $CLI volume set $V0 performance.least-rate-limit abc -TEST ! $CLI volume set $V0 performance.least-rate-limit 0.0 -TEST ! $CLI volume set $V0 performance.least-rate-limit -10.0 -TEST ! $CLI volume set $V0 performance.least-rate-limit 1% - -# set rate limit to 1 operation/sec -TEST $CLI volume set $V0 performance.least-rate-limit 1 - -# use client-pid=-1 for least priority mount -TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 --client-pid=-1 - -# create a few files and verify this takes more than a few seconds -date1=`date +%s` -TEST touch $M0/file{0..2} -date2=`date +%s` - -optime=$(($date2 - $date1)) -TEST [ $optime -ge 3 ] - -EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 - -TEST $CLI volume stop $V0 -TEST $CLI volume delete $V0 - -cleanup; diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index ca646e4dcce..1cc0d921f4e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -1485,10 +1485,6 @@ struct volopt_map_entry glusterd_volopt_map[] = { .voltype = "performance/io-threads", .op_version = 1 }, - { .key = "performance.least-rate-limit", - .voltype = "performance/io-threads", - .op_version = 2 - }, /* Other perf xlators' options */ { .key = "performance.cache-size", diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index dd2aba3fd0a..c0bcea48e3d 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -49,69 +49,17 @@ struct volume_options options[]; } while (0) call_stub_t * -__iot_dequeue (iot_conf_t *conf, int *pri, struct timespec *sleep) +__iot_dequeue (iot_conf_t *conf, int *pri) { call_stub_t *stub = NULL; int i = 0; - struct timeval curtv = {0,}, difftv = {0,}; *pri = -1; - sleep->tv_sec = 0; - sleep->tv_nsec = 0; for (i = 0; i < IOT_PRI_MAX; i++) { if (list_empty (&conf->reqs[i]) || (conf->ac_iot_count[i] >= conf->ac_iot_limit[i])) continue; - if (i == IOT_PRI_LEAST) { - pthread_mutex_lock(&conf->throttle.lock); - if (!conf->throttle.sample_time.tv_sec) { - /* initialize */ - gettimeofday(&conf->throttle.sample_time, NULL); - } else { - /* - * Maintain a running count of least priority - * operations that are handled over a particular - * time interval. The count is provided via - * state dump and is used as a measure against - * least priority op throttling. - */ - gettimeofday(&curtv, NULL); - timersub(&curtv, &conf->throttle.sample_time, - &difftv); - if (difftv.tv_sec >= IOT_LEAST_THROTTLE_DELAY) { - conf->throttle.cached_rate = - conf->throttle.sample_cnt; - conf->throttle.sample_cnt = 0; - conf->throttle.sample_time = curtv; - } - - /* - * If we're over the configured rate limit, - * provide an absolute time to the caller that - * represents the soonest we're allowed to - * return another least priority request. - */ - if (conf->throttle.rate_limit && - conf->throttle.sample_cnt >= - conf->throttle.rate_limit) { - struct timeval delay; - delay.tv_sec = IOT_LEAST_THROTTLE_DELAY; - delay.tv_usec = 0; - - timeradd(&conf->throttle.sample_time, - &delay, &curtv); - TIMEVAL_TO_TIMESPEC(&curtv, sleep); - - pthread_mutex_unlock( - &conf->throttle.lock); - break; - } - } - conf->throttle.sample_cnt++; - pthread_mutex_unlock(&conf->throttle.lock); - } - stub = list_entry (conf->reqs[i].next, call_stub_t, list); conf->ac_iot_count[i]++; *pri = i; @@ -155,7 +103,6 @@ iot_worker (void *data) int pri = -1; char timeout = 0; char bye = 0; - struct timespec sleep = {0,}; conf = data; this = conf->this; @@ -196,13 +143,7 @@ iot_worker (void *data) } } - stub = __iot_dequeue (conf, &pri, &sleep); - if (!stub && (sleep.tv_sec || sleep.tv_nsec)) { - pthread_cond_timedwait(&conf->cond, - &conf->mutex, &sleep); - pthread_mutex_unlock(&conf->mutex); - continue; - } + stub = __iot_dequeue (conf, &pri); } pthread_mutex_unlock (&conf->mutex); @@ -914,10 +855,6 @@ iot_priv_dump (xlator_t *this) gf_proc_dump_write("least_priority_threads", "%d", conf->ac_iot_limit[IOT_PRI_LEAST]); - gf_proc_dump_write("cached least rate", "%u", - conf->throttle.cached_rate); - gf_proc_dump_write("least rate limit", "%u", conf->throttle.rate_limit); - return 0; } @@ -949,9 +886,6 @@ reconfigure (xlator_t *this, dict_t *options) GF_OPTION_RECONF ("enable-least-priority", conf->least_priority, options, bool, out); - GF_OPTION_RECONF("least-rate-limit", conf->throttle.rate_limit, options, - int32, out); - ret = 0; out: return ret; @@ -1021,15 +955,6 @@ init (xlator_t *this) GF_OPTION_INIT ("enable-least-priority", conf->least_priority, bool, out); - GF_OPTION_INIT("least-rate-limit", conf->throttle.rate_limit, int32, - out); - if ((ret = pthread_mutex_init(&conf->throttle.lock, NULL)) != 0) { - gf_msg (this->name, GF_LOG_ERROR, 0, - IO_THREADS_MSG_INIT_FAILED, - "pthread_mutex_init failed (%d)", ret); - goto out; - } - conf->this = this; for (i = 0; i < IOT_PRI_MAX; i++) { @@ -1179,14 +1104,6 @@ struct volume_options options[] = { .max = 0x7fffffff, .default_value = "120", }, - {.key = {"least-rate-limit"}, - .type = GF_OPTION_TYPE_INT, - .min = 0, - .max = INT_MAX, - .default_value = "0", - .description = "Max number of least priority operations to handle " - "per-second" - }, { .key = {NULL}, }, }; diff --git a/xlators/performance/io-threads/src/io-threads.h b/xlators/performance/io-threads/src/io-threads.h index d8eea2cf77a..6d9ea255909 100644 --- a/xlators/performance/io-threads/src/io-threads.h +++ b/xlators/performance/io-threads/src/io-threads.h @@ -48,15 +48,6 @@ typedef enum { IOT_PRI_MAX, } iot_pri_t; -#define IOT_LEAST_THROTTLE_DELAY 1 /* sample interval in seconds */ -struct iot_least_throttle { - struct timeval sample_time; /* timestamp of current sample */ - uint32_t sample_cnt; /* sample count for active interval */ - uint32_t cached_rate; /* the most recently measured rate */ - int32_t rate_limit; /* user-specified rate limit */ - pthread_mutex_t lock; -}; - struct iot_conf { pthread_mutex_t mutex; pthread_cond_t cond; @@ -78,8 +69,6 @@ struct iot_conf { xlator_t *this; size_t stack_size; - - struct iot_least_throttle throttle; }; typedef struct iot_conf iot_conf_t; |