mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Adjust default number of threads for JobQueue:
The existing calculation would limit the maximum number of threads that would be created by default to at most 6; this may have been reasonable a few years ago, but given both the load on the network as of today and the increase in the number of CPU cores, the value should be revisited. This commit, if merged, changes the default calculation for nodes that are configured as `large` or `huge` to allow for up to twelve threads.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
namespace ripple {
|
||||
|
||||
JobQueue::JobQueue(
|
||||
int threadCount,
|
||||
beast::insight::Collector::ptr const& collector,
|
||||
beast::Journal journal,
|
||||
Logs& logs,
|
||||
@@ -33,11 +34,13 @@ JobQueue::JobQueue(
|
||||
, m_lastJob(0)
|
||||
, m_invalidJobData(JobTypes::instance().getInvalid(), collector, logs)
|
||||
, m_processCount(0)
|
||||
, m_workers(*this, &perfLog, "JobQueue", 0)
|
||||
, m_workers(*this, &perfLog, "JobQueue", threadCount)
|
||||
, m_cancelCallback(std::bind(&JobQueue::isStopping, this))
|
||||
, perfLog_(perfLog)
|
||||
, m_collector(collector)
|
||||
{
|
||||
JLOG(m_journal.info()) << "Using " << threadCount << " threads";
|
||||
|
||||
hook = m_collector->make_hook(std::bind(&JobQueue::collect, this));
|
||||
job_count = m_collector->make_gauge("job_count");
|
||||
|
||||
@@ -139,29 +142,6 @@ JobQueue::getJobCountGE(JobType t) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
JobQueue::setThreadCount(int c, bool const standaloneMode)
|
||||
{
|
||||
if (standaloneMode)
|
||||
{
|
||||
c = 1;
|
||||
}
|
||||
else if (c == 0)
|
||||
{
|
||||
c = static_cast<int>(std::thread::hardware_concurrency());
|
||||
c = 2 + std::min(c, 4); // I/O will bottleneck
|
||||
JLOG(m_journal.info()) << "Auto-tuning to " << c
|
||||
<< " validation/transaction/proposal threads.";
|
||||
}
|
||||
else
|
||||
{
|
||||
JLOG(m_journal.info()) << "Configured " << c
|
||||
<< " validation/transaction/proposal threads.";
|
||||
}
|
||||
|
||||
m_workers.setNumberOfThreads(c);
|
||||
}
|
||||
|
||||
std::unique_ptr<LoadEvent>
|
||||
JobQueue::makeLoadEvent(JobType t, std::string const& name)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user