Autosync based on number of unstable ops to prevent journal stalls

This commit is contained in:
Vitaliy Filippov
2021-10-30 14:26:48 +03:00
parent 24b9b19066
commit cfe8de9b84
9 changed files with 36 additions and 3 deletions
+11
View File
@@ -45,6 +45,12 @@ osd_t::osd_t(const json11::Json & config, ring_loop_t *ringloop)
// FIXME: Create Blockstore from on-disk superblock config and check it against the OSD cluster config
auto bs_cfg = json_to_bs(this->config);
this->bs = new blockstore_t(bs_cfg, ringloop, tfd);
{
// Autosync based on the number of unstable writes to prevent stalls due to insufficient journal space
uint64_t max_autosync = bs->get_journal_size() / bs->get_block_size() / 2;
if (autosync_writes > max_autosync)
autosync_writes = max_autosync;
}
this->tfd->set_timer(print_stats_interval*1000, true, [this](int timer_id)
{
@@ -123,6 +129,11 @@ void osd_t::parse_config(const json11::Json & config)
if (autosync_interval > MAX_AUTOSYNC_INTERVAL)
autosync_interval = DEFAULT_AUTOSYNC_INTERVAL;
}
if (!config["autosync_writes"].is_null())
{
// Allow to set it to 0
autosync_writes = config["autosync_writes"].uint64_value();
}
if (!config["client_queue_depth"].is_null())
{
client_queue_depth = config["client_queue_depth"].uint64_value();