0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 15:00:51 +01:00

ircd::db: Improve request pool initialization and size determination.

This commit is contained in:
Jason Volk 2020-06-08 17:09:22 -07:00
parent 7a87f2eda9
commit 4a1f04823f
2 changed files with 31 additions and 2 deletions

View file

@ -84,6 +84,7 @@ namespace ircd
/// Database subsystem initialization and destruction /// Database subsystem initialization and destruction
struct ircd::db::init struct ircd::db::init
{ {
static void request_pool();
static void compressions(); static void compressions();
static void directory(); static void directory();
static void test_direct_io(); static void test_direct_io();

View file

@ -66,7 +66,7 @@ ircd::db::request_pool_size
{ {
{ {
{ "name", "ircd.db.request_pool.size" }, { "name", "ircd.db.request_pool.size" },
{ "default", 32L }, { "default", 0L },
}, [] }, []
{ {
request.set(size_t(request_pool_size)); request.set(size_t(request_pool_size));
@ -131,9 +131,9 @@ try
#endif #endif
compressions(); compressions();
directory(); directory();
request_pool();
test_direct_io(); test_direct_io();
test_hw_crc32(); test_hw_crc32();
request.add(request_pool_size);
} }
catch(const std::exception &e) catch(const std::exception &e)
{ {
@ -350,6 +350,34 @@ catch(const std::exception &e)
throw; throw;
} }
void
ircd::db::init::request_pool()
{
char buf[32];
const string_view value
{
conf::get(buf, "ircd.fs.aio.max_events")
};
const size_t aio_max_events
{
lex_castable<size_t>(value)?
lex_cast<size_t>(value):
0UL
};
const size_t new_size
{
size_t(request_pool_size)?
request_pool_size:
aio_max_events?
aio_max_events:
1UL
};
request_pool_size.set(lex_cast(new_size));
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
// database // database