Make I/O and prefetch worker threads configurable

This commit is contained in:
Richard Holland
2021-11-22 13:47:21 +00:00
committed by Nik Bougalis
parent 6746b863b3
commit cf97dcb992
5 changed files with 41 additions and 3 deletions

View File

@@ -655,6 +655,26 @@ Config::loadFromString(std::string const& fileContents)
": must be between 1 and 1024 inclusive.");
}
if (getSingleSection(secConfig, SECTION_IO_WORKERS, strTemp, j_))
{
IO_WORKERS = beast::lexicalCastThrow<int>(strTemp);
if (IO_WORKERS < 1 || IO_WORKERS > 1024)
Throw<std::runtime_error>(
"Invalid " SECTION_IO_WORKERS
": must be between 1 and 1024 inclusive.");
}
if (getSingleSection(secConfig, SECTION_PREFETCH_WORKERS, strTemp, j_))
{
PREFETCH_WORKERS = beast::lexicalCastThrow<int>(strTemp);
if (PREFETCH_WORKERS < 1 || PREFETCH_WORKERS > 1024)
Throw<std::runtime_error>(
"Invalid " SECTION_PREFETCH_WORKERS
": must be between 1 and 1024 inclusive.");
}
if (getSingleSection(secConfig, SECTION_COMPRESSION, strTemp, j_))
COMPRESSION = beast::lexicalCastThrow<bool>(strTemp);