From: Shiyang Ruan Date: Mon, 22 Oct 2018 05:06:34 +0000 (+0800) Subject: common: fix typos in BackoffThrottle X-Git-Tag: v14.1.0~1128^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=99ce7cf48b5c1b3d6f9b8928a2244eecaaa6ee06;p=ceph.git common: fix typos in BackoffThrottle Signed-off-by: Shiyang Ruan --- diff --git a/doc/dev/osd_internals/osd_throttles.rst b/doc/dev/osd_internals/osd_throttles.rst index ee98d24850c..fbacb078150 100644 --- a/doc/dev/osd_internals/osd_throttles.rst +++ b/doc/dev/osd_internals/osd_throttles.rst @@ -54,7 +54,7 @@ filestore_expected_throughput_bytes filestore_queue_high_delay_multiple filestore_queue_max_delay_multiple -While each throttle is at less than low_threshhold of the max, +While each throttle is at less than low_threshold of the max, no delay happens. Between low and high, the throttle will inject a per-op delay (per op or byte) ramping from 0 at low to high_delay_multiple/expected_throughput at high. From high to diff --git a/src/common/Throttle.cc b/src/common/Throttle.cc index 1ac780c8a85..0d24acc0ee4 100644 --- a/src/common/Throttle.cc +++ b/src/common/Throttle.cc @@ -293,8 +293,8 @@ BackoffThrottle::~BackoffThrottle() } bool BackoffThrottle::set_params( - double _low_threshhold, - double _high_threshhold, + double _low_threshold, + double _high_threshold, double _expected_throughput, double _high_multiple, double _max_multiple, @@ -302,11 +302,11 @@ bool BackoffThrottle::set_params( ostream *errstream) { bool valid = true; - if (_low_threshhold > _high_threshhold) { + if (_low_threshold > _high_threshold) { valid = false; if (errstream) { - *errstream << "low_threshhold (" << _low_threshhold - << ") > high_threshhold (" << _high_threshhold + *errstream << "low_threshold (" << _low_threshold + << ") > high_threshold (" << _high_threshold << ")" << std::endl; } } @@ -320,18 +320,18 @@ bool BackoffThrottle::set_params( } } - if (_low_threshhold > 1 || _low_threshhold < 0) { + if (_low_threshold > 1 || _low_threshold < 0) { valid = false; if (errstream) { - *errstream << "invalid low_threshhold (" << _low_threshhold << ")" + *errstream << "invalid low_threshold (" << _low_threshold << ")" << std::endl; } } - if (_high_threshhold > 1 || _high_threshhold < 0) { + if (_high_threshold > 1 || _high_threshold < 0) { valid = false; if (errstream) { - *errstream << "invalid high_threshhold (" << _high_threshhold << ")" + *errstream << "invalid high_threshold (" << _high_threshold << ")" << std::endl; } } @@ -367,8 +367,8 @@ bool BackoffThrottle::set_params( return false; locker l(lock); - low_threshhold = _low_threshhold; - high_threshhold = _high_threshhold; + low_threshold = _low_threshold; + high_threshold = _high_threshold; high_delay_per_count = _high_multiple / _expected_throughput; max_delay_per_count = _max_multiple / _expected_throughput; max = _throttle_max; @@ -376,18 +376,18 @@ bool BackoffThrottle::set_params( if (logger) logger->set(l_backoff_throttle_max, max); - if (high_threshhold - low_threshhold > 0) { - s0 = high_delay_per_count / (high_threshhold - low_threshhold); + if (high_threshold - low_threshold > 0) { + s0 = high_delay_per_count / (high_threshold - low_threshold); } else { - low_threshhold = high_threshhold; + low_threshold = high_threshold; s0 = 0; } - if (1 - high_threshhold > 0) { + if (1 - high_threshold > 0) { s1 = (max_delay_per_count - high_delay_per_count) - / (1 - high_threshhold); + / (1 - high_threshold); } else { - high_threshhold = 1; + high_threshold = 1; s1 = 0; } @@ -401,14 +401,14 @@ std::chrono::duration BackoffThrottle::_get_delay(uint64_t c) const return std::chrono::duration(0); double r = ((double)current) / ((double)max); - if (r < low_threshhold) { + if (r < low_threshold) { return std::chrono::duration(0); - } else if (r < high_threshhold) { + } else if (r < high_threshold) { return c * std::chrono::duration( - (r - low_threshhold) * s0); + (r - low_threshold) * s0); } else { return c * std::chrono::duration( - high_delay_per_count + ((r - high_threshhold) * s1)); + high_delay_per_count + ((r - high_threshold) * s1)); } } diff --git a/src/common/Throttle.h b/src/common/Throttle.h index 82bf8264b37..89b986ac4e0 100644 --- a/src/common/Throttle.h +++ b/src/common/Throttle.h @@ -131,23 +131,23 @@ public: * BackoffThrottle * * Creates a throttle which gradually induces delays when get() is called - * based on params low_threshhold, high_threshhold, expected_throughput, + * based on params low_threshold, high_threshold, expected_throughput, * high_multiple, and max_multiple. * - * In [0, low_threshhold), we want no delay. + * In [0, low_threshold), we want no delay. * - * In [low_threshhold, high_threshhold), delays should be injected based - * on a line from 0 at low_threshhold to - * high_multiple * (1/expected_throughput) at high_threshhold. + * In [low_threshold, high_threshold), delays should be injected based + * on a line from 0 at low_threshold to + * high_multiple * (1/expected_throughput) at high_threshold. * - * In [high_threshhold, 1), we want delays injected based on a line from - * (high_multiple * (1/expected_throughput)) at high_threshhold to + * In [high_threshold, 1), we want delays injected based on a line from + * (high_multiple * (1/expected_throughput)) at high_threshold to * (high_multiple * (1/expected_throughput)) + * (max_multiple * (1/expected_throughput)) at 1. * - * Let the current throttle ratio (current/max) be r, low_threshhold be l, - * high_threshhold be h, high_delay (high_multiple / expected_throughput) be e, - * and max_delay (max_muliple / expected_throughput) be m. + * Let the current throttle ratio (current/max) be r, low_threshold be l, + * high_threshold be h, high_delay (high_multiple / expected_throughput) be e, + * and max_delay (max_multiple / expected_throughput) be m. * * delay = 0, r \in [0, l) * delay = (r - l) * (e / (h - l)), r \in [l, h) @@ -184,8 +184,8 @@ class BackoffThrottle { } /// see above, values are in [0, 1]. - double low_threshhold = 0; - double high_threshhold = 1; + double low_threshold = 0; + double high_threshold = 1; /// see above, values are in seconds double high_delay_per_count = 0; @@ -210,8 +210,8 @@ public: * explanation. */ bool set_params( - double low_threshhold, - double high_threshhold, + double _low_threshold, + double _high_threshold, double expected_throughput, double high_multiple, double max_multiple, diff --git a/src/doc/dynamic-throttle.txt b/src/doc/dynamic-throttle.txt index e1c4f5892b4..39ce345068f 100644 --- a/src/doc/dynamic-throttle.txt +++ b/src/doc/dynamic-throttle.txt @@ -59,10 +59,10 @@ filestore. journal_throttle_max_multiple This scheme will not be inducing any delay between [0, low_threshold]. -In [low_threshhold, high_threshhold), delays should be injected based on a line -from 0 at low_threshold to high_multiple * (1/expected_throughput) at high_threshhold. -In [high_threshhold, 1), we want delays injected based on a line from -(high_multiple * (1/expected_throughput)) at high_threshhold to +In [low_threshold, high_threshold), delays should be injected based on a line +from 0 at low_threshold to high_multiple * (1/expected_throughput) at high_threshold. +In [high_threshold, 1), we want delays injected based on a line from +(high_multiple * (1/expected_throughput)) at high_threshold to (high_multiple * (1/expected_throughput)) + (max_multiple * (1/expected_throughput)) at 1. Now setting *_high_multiple and *_max_multiple to 0 should give us similar effect