summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahooinc.com>2022-01-26 10:56:49 +0000
committerTor Brede Vekterli <vekterli@yahooinc.com>2022-01-26 10:56:49 +0000
commit5c727a35f8c824f6d13d3702211a3554e031e1b6 (patch)
tree9fcb88e400cccf91f4bd4eefd06e9c203aadd2aa /storage
parent1ecbb8ced4c2599155a2438625987b78e174bd5a (diff)
Support live reconfig of dynamic persistence throttling
Start moving internal `stor-server` throttling config to use struct config instead of separate fields, as this is more flexible and better matches how we configure throttling elsewhere. For now, let dynamic throttling be enabled via both the new and the old config enum. Config model will be updated to use the new config struct shortly.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
index 03b16e75297..ec7793cdd8d 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
+++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp
@@ -143,17 +143,29 @@ selectSequencer(StorFilestorConfig::ResponseSequencerType sequencerType) {
}
}
+vespalib::SharedOperationThrottler::DynamicThrottleParams
+dynamic_throttle_params_from_config(const StorFilestorConfig& config, size_t num_threads)
+{
+ const auto& cfg_params = config.asyncOperationThrottler;
+ auto win_size_incr = std::max(static_cast<size_t>(std::max(cfg_params.windowSizeIncrement, 1)), num_threads);
+
+ vespalib::SharedOperationThrottler::DynamicThrottleParams params;
+ params.window_size_increment = win_size_incr;
+ params.min_window_size = win_size_incr;
+ params.window_size_decrement_factor = cfg_params.windowSizeDecrementFactor;
+ params.window_size_backoff = cfg_params.windowSizeBackoff;
+ return params;
+}
+
std::unique_ptr<vespalib::SharedOperationThrottler>
make_operation_throttler_from_config(const StorFilestorConfig& config, size_t num_threads)
{
- const bool use_dynamic_throttling = (config.asyncOperationThrottlerType == StorFilestorConfig::AsyncOperationThrottlerType::DYNAMIC);
+ // TODO only use struct config field instead once config model is updated
+ const bool use_dynamic_throttling = ((config.asyncOperationThrottlerType == StorFilestorConfig::AsyncOperationThrottlerType::DYNAMIC) ||
+ (config.asyncOperationThrottler.type == StorFilestorConfig::AsyncOperationThrottler::Type::DYNAMIC));
if (use_dynamic_throttling) {
- auto config_win_size_incr = std::max(config.asyncOperationDynamicThrottlingWindowIncrement, 1);
- auto win_size_increment = std::max(static_cast<size_t>(config_win_size_incr), num_threads);
- vespalib::SharedOperationThrottler::DynamicThrottleParams params;
- params.window_size_increment = win_size_increment;
- params.min_window_size = win_size_increment;
- return vespalib::SharedOperationThrottler::make_dynamic_throttler(params);
+ auto dyn_params = dynamic_throttle_params_from_config(config, num_threads);
+ return vespalib::SharedOperationThrottler::make_dynamic_throttler(dyn_params);
} else {
return vespalib::SharedOperationThrottler::make_unlimited_throttler();
}
@@ -229,6 +241,10 @@ FileStorManager::configure(std::unique_ptr<StorFilestorConfig> config)
*_filestorHandler, i % numStripes, _component));
}
_bucketExecutorRegistration = _provider->register_executor(std::make_shared<BucketExecutorWrapper>(*this));
+ } else {
+ assert(_filestorHandler);
+ auto updated_dyn_throttle_params = dynamic_throttle_params_from_config(*config, _threads.size());
+ _filestorHandler->operation_throttler().reconfigure_dynamic_throttling(updated_dyn_throttle_params);
}
}