From e4d517415b45252b6d23c4507e27c5bacf6acd79 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 15 Jul 2022 15:38:15 -0700 Subject: [PATCH] ircd::m::acquire: Add conf items to default some opts; rename and raise submit max. --- include/ircd/m/acquire.h | 9 ++++++--- matrix/acquire.cc | 23 ++++++++++++++++++++++- matrix/fetch.cc | 2 +- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/include/ircd/m/acquire.h b/include/ircd/m/acquire.h index 50735c4db..57c2a5795 100644 --- a/include/ircd/m/acquire.h +++ b/include/ircd/m/acquire.h @@ -23,6 +23,9 @@ struct ircd::m::acquire struct result; static log::log log; + static conf::item fetch_max; + static conf::item submit_max; + static conf::item attempt_max; static uint64_t ids; const uint64_t id {++ids}; @@ -114,14 +117,14 @@ struct ircd::m::acquire::opts size_t rounds {-1UL}; /// Total event limit over all operations. - size_t fetch_max {-1UL}; + size_t fetch_max {acquire::fetch_max}; /// Limit the number of requests in flight at any given time. - size_t fetch_width {128}; + size_t submit_max {acquire::submit_max}; /// Fetch attempt cap passed to m::fetch, because the default there is /// unlimited and that's usually a waste of time in practice. - size_t attempt_max {16}; + size_t attempt_max {acquire::attempt_max}; /// Limit on the depth of leafs pursued by the timeline acquisition. size_t leaf_depth {0}; diff --git a/matrix/acquire.cc b/matrix/acquire.cc index d1897caef..1c77a6283 100644 --- a/matrix/acquire.cc +++ b/matrix/acquire.cc @@ -14,6 +14,27 @@ ircd::m::acquire::log "m.acquire" }; +decltype(ircd::m::acquire::fetch_max) +ircd::m::acquire::fetch_max +{ + { "name", "ircd.m.acquire.fetch.max" }, + { "default", -1L }, +}; + +decltype(ircd::m::acquire::submit_max) +ircd::m::acquire::submit_max +{ + { "name", "ircd.m.acquire.submit.max" }, + { "default", 256 }, +}; + +decltype(ircd::m::acquire::attempt_max) +ircd::m::acquire::attempt_max +{ + { "name", "ircd.m.acquire.attempt.max" }, + { "default", 16 }, +}; + decltype(ircd::m::acquire::ids) ircd::m::acquire::ids; @@ -794,7 +815,7 @@ bool ircd::m::acquire::full() const noexcept { - return fetching.size() >= opts.fetch_width; + return fetching.size() >= opts.submit_max; } // diff --git a/matrix/fetch.cc b/matrix/fetch.cc index 8da486354..84a0da4a3 100644 --- a/matrix/fetch.cc +++ b/matrix/fetch.cc @@ -72,7 +72,7 @@ decltype(ircd::m::fetch::requests_max) ircd::m::fetch::requests_max { { "name", "ircd.m.fetch.requests.max" }, - { "default", 1024L }, + { "default", 2048L }, }; decltype(ircd::m::fetch::backfill_limit_default)