mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Miscellaneous Improvements:
- Adjust default tree cache sizing - Various micro-optimizations
This commit is contained in:
committed by
manojsdoshi
parent
18235067af
commit
d66d960d59
@@ -115,19 +115,19 @@ sizedItems
|
|||||||
// what they control and whether there exists an explicit
|
// what they control and whether there exists an explicit
|
||||||
// config option that can be used to override the default.
|
// config option that can be used to override the default.
|
||||||
|
|
||||||
// tiny small medium large huge
|
// tiny small medium large huge
|
||||||
{SizedItem::sweepInterval, {{ 10, 30, 60, 90, 120 }}},
|
{SizedItem::sweepInterval, {{ 10, 30, 60, 90, 120 }}},
|
||||||
{SizedItem::treeCacheSize, {{ 128000, 256000, 512000, 768000, 2048000 }}},
|
{SizedItem::treeCacheSize, {{ 262144, 524288, 2097152, 4194304, 8388608 }}},
|
||||||
{SizedItem::treeCacheAge, {{ 30, 60, 90, 120, 900 }}},
|
{SizedItem::treeCacheAge, {{ 30, 60, 90, 120, 900 }}},
|
||||||
{SizedItem::ledgerSize, {{ 32, 128, 256, 384, 768 }}},
|
{SizedItem::ledgerSize, {{ 32, 128, 256, 384, 768 }}},
|
||||||
{SizedItem::ledgerAge, {{ 30, 90, 180, 240, 900 }}},
|
{SizedItem::ledgerAge, {{ 30, 90, 180, 240, 900 }}},
|
||||||
{SizedItem::ledgerFetch, {{ 2, 3, 4, 5, 8 }}},
|
{SizedItem::ledgerFetch, {{ 2, 3, 4, 5, 8 }}},
|
||||||
{SizedItem::hashNodeDBCache, {{ 4, 12, 24, 64, 128 }}},
|
{SizedItem::hashNodeDBCache, {{ 4, 12, 24, 64, 128 }}},
|
||||||
{SizedItem::txnDBCache, {{ 4, 12, 24, 64, 128 }}},
|
{SizedItem::txnDBCache, {{ 4, 12, 24, 64, 128 }}},
|
||||||
{SizedItem::lgrDBCache, {{ 4, 8, 16, 32, 128 }}},
|
{SizedItem::lgrDBCache, {{ 4, 8, 16, 32, 128 }}},
|
||||||
{SizedItem::openFinalLimit, {{ 8, 16, 32, 64, 128 }}},
|
{SizedItem::openFinalLimit, {{ 8, 16, 32, 64, 128 }}},
|
||||||
{SizedItem::burstSize, {{ 4, 8, 16, 32, 48 }}},
|
{SizedItem::burstSize, {{ 4, 8, 16, 32, 48 }}},
|
||||||
{SizedItem::ramSizeGB, {{ 8, 12, 16, 24, 32 }}},
|
{SizedItem::ramSizeGB, {{ 8, 12, 16, 24, 32 }}},
|
||||||
}};
|
}};
|
||||||
|
|
||||||
// Ensure that the order of entries in the table corresponds to the
|
// Ensure that the order of entries in the table corresponds to the
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ PeerImp::fail(std::string const& reason)
|
|||||||
return post(
|
return post(
|
||||||
strand_,
|
strand_,
|
||||||
std::bind(
|
std::bind(
|
||||||
(void(Peer::*)(std::string const&)) & PeerImp::fail,
|
(void (Peer::*)(std::string const&)) & PeerImp::fail,
|
||||||
shared_from_this(),
|
shared_from_this(),
|
||||||
reason));
|
reason));
|
||||||
if (journal_.active(beast::severities::kWarning) && socket_.is_open())
|
if (journal_.active(beast::severities::kWarning) && socket_.is_open())
|
||||||
@@ -1587,17 +1587,18 @@ PeerImp::handleTransaction(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app_.getJobQueue().getJobCount(jtTRANSACTION) >
|
if (app_.getLedgerMaster().getValidatedLedgerAge() > 4min)
|
||||||
|
{
|
||||||
|
JLOG(p_journal_.trace())
|
||||||
|
<< "No new transactions until synchronized";
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
app_.getJobQueue().getJobCount(jtTRANSACTION) >
|
||||||
app_.config().MAX_TRANSACTIONS)
|
app_.config().MAX_TRANSACTIONS)
|
||||||
{
|
{
|
||||||
overlay_.incJqTransOverflow();
|
overlay_.incJqTransOverflow();
|
||||||
JLOG(p_journal_.info()) << "Transaction queue is full";
|
JLOG(p_journal_.info()) << "Transaction queue is full";
|
||||||
}
|
}
|
||||||
else if (app_.getLedgerMaster().getValidatedLedgerAge() > 4min)
|
|
||||||
{
|
|
||||||
JLOG(p_journal_.trace())
|
|
||||||
<< "No new transactions until synchronized";
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
app_.getJobQueue().addJob(
|
app_.getJobQueue().addJob(
|
||||||
@@ -2573,6 +2574,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto key = sha512Half(makeSlice(m->validation()));
|
auto key = sha512Half(makeSlice(m->validation()));
|
||||||
|
|
||||||
if (auto [added, relayed] =
|
if (auto [added, relayed] =
|
||||||
app_.getHashRouter().addSuppressionPeerWithStatus(key, id_);
|
app_.getHashRouter().addSuppressionPeerWithStatus(key, id_);
|
||||||
!added)
|
!added)
|
||||||
@@ -2592,22 +2594,36 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
|
|||||||
if (!isTrusted && (tracking_.load() == Tracking::diverged))
|
if (!isTrusted && (tracking_.load() == Tracking::diverged))
|
||||||
{
|
{
|
||||||
JLOG(p_journal_.debug())
|
JLOG(p_journal_.debug())
|
||||||
<< "Validation: dropping untrusted from diverged peer";
|
<< "Dropping untrusted validation from diverged peer";
|
||||||
}
|
}
|
||||||
if (isTrusted || cluster() || !app_.getFeeTrack().isLoadedLocal())
|
else if (isTrusted || !app_.getFeeTrack().isLoadedLocal())
|
||||||
{
|
{
|
||||||
|
std::string const name = [isTrusted, val]() {
|
||||||
|
std::string ret =
|
||||||
|
isTrusted ? "Trusted validation" : "Untrusted validation";
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
ret += " " +
|
||||||
|
std::to_string(val->getFieldU32(sfLedgerSequence)) + ": " +
|
||||||
|
to_string(val->getNodeID());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}();
|
||||||
|
|
||||||
std::weak_ptr<PeerImp> weak = shared_from_this();
|
std::weak_ptr<PeerImp> weak = shared_from_this();
|
||||||
app_.getJobQueue().addJob(
|
app_.getJobQueue().addJob(
|
||||||
isTrusted ? jtVALIDATION_t : jtVALIDATION_ut,
|
isTrusted ? jtVALIDATION_t : jtVALIDATION_ut,
|
||||||
"recvValidation->checkValidation",
|
name,
|
||||||
[weak, val, m]() {
|
[weak, val, m, key]() {
|
||||||
if (auto peer = weak.lock())
|
if (auto peer = weak.lock())
|
||||||
peer->checkValidation(val, m);
|
peer->checkValidation(val, key, m);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
JLOG(p_journal_.debug()) << "Validation: Dropping UNTRUSTED (load)";
|
JLOG(p_journal_.debug())
|
||||||
|
<< "Dropping untrusted validation for load";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception const& e)
|
catch (std::exception const& e)
|
||||||
@@ -3152,12 +3168,13 @@ PeerImp::checkPropose(
|
|||||||
void
|
void
|
||||||
PeerImp::checkValidation(
|
PeerImp::checkValidation(
|
||||||
std::shared_ptr<STValidation> const& val,
|
std::shared_ptr<STValidation> const& val,
|
||||||
|
uint256 const& key,
|
||||||
std::shared_ptr<protocol::TMValidation> const& packet)
|
std::shared_ptr<protocol::TMValidation> const& packet)
|
||||||
{
|
{
|
||||||
if (!cluster() && !val->isValid())
|
if (!val->isValid())
|
||||||
{
|
{
|
||||||
JLOG(p_journal_.debug()) << "Validation forwarded by peer is invalid";
|
JLOG(p_journal_.debug()) << "Validation forwarded by peer is invalid";
|
||||||
charge(Resource::feeInvalidRequest);
|
charge(Resource::feeInvalidSignature);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3167,18 +3184,16 @@ PeerImp::checkValidation(
|
|||||||
if (app_.getOPs().recvValidation(val, std::to_string(id())) ||
|
if (app_.getOPs().recvValidation(val, std::to_string(id())) ||
|
||||||
cluster())
|
cluster())
|
||||||
{
|
{
|
||||||
auto const suppression =
|
|
||||||
sha512Half(makeSlice(val->getSerialized()));
|
|
||||||
// haveMessage contains peers, which are suppressed; i.e. the peers
|
// haveMessage contains peers, which are suppressed; i.e. the peers
|
||||||
// are the source of the message, consequently the message should
|
// are the source of the message, consequently the message should
|
||||||
// not be relayed to these peers. But the message must be counted
|
// not be relayed to these peers. But the message must be counted
|
||||||
// as part of the squelch logic.
|
// as part of the squelch logic.
|
||||||
auto haveMessage =
|
auto haveMessage =
|
||||||
overlay_.relay(*packet, suppression, val->getSignerPublic());
|
overlay_.relay(*packet, key, val->getSignerPublic());
|
||||||
if (reduceRelayReady() && !haveMessage.empty())
|
if (reduceRelayReady() && !haveMessage.empty())
|
||||||
{
|
{
|
||||||
overlay_.updateSlotAndSquelch(
|
overlay_.updateSlotAndSquelch(
|
||||||
suppression,
|
key,
|
||||||
val->getSignerPublic(),
|
val->getSignerPublic(),
|
||||||
std::move(haveMessage),
|
std::move(haveMessage),
|
||||||
protocol::mtVALIDATION);
|
protocol::mtVALIDATION);
|
||||||
|
|||||||
@@ -626,6 +626,7 @@ private:
|
|||||||
void
|
void
|
||||||
checkValidation(
|
checkValidation(
|
||||||
std::shared_ptr<STValidation> const& val,
|
std::shared_ptr<STValidation> const& val,
|
||||||
|
uint256 const& key,
|
||||||
std::shared_ptr<protocol::TMValidation> const& packet);
|
std::shared_ptr<protocol::TMValidation> const& packet);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user