mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 23:15: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
|
||||
// config option that can be used to override the default.
|
||||
|
||||
// tiny small medium large huge
|
||||
{SizedItem::sweepInterval, {{ 10, 30, 60, 90, 120 }}},
|
||||
{SizedItem::treeCacheSize, {{ 128000, 256000, 512000, 768000, 2048000 }}},
|
||||
{SizedItem::treeCacheAge, {{ 30, 60, 90, 120, 900 }}},
|
||||
{SizedItem::ledgerSize, {{ 32, 128, 256, 384, 768 }}},
|
||||
{SizedItem::ledgerAge, {{ 30, 90, 180, 240, 900 }}},
|
||||
{SizedItem::ledgerFetch, {{ 2, 3, 4, 5, 8 }}},
|
||||
{SizedItem::hashNodeDBCache, {{ 4, 12, 24, 64, 128 }}},
|
||||
{SizedItem::txnDBCache, {{ 4, 12, 24, 64, 128 }}},
|
||||
{SizedItem::lgrDBCache, {{ 4, 8, 16, 32, 128 }}},
|
||||
{SizedItem::openFinalLimit, {{ 8, 16, 32, 64, 128 }}},
|
||||
{SizedItem::burstSize, {{ 4, 8, 16, 32, 48 }}},
|
||||
{SizedItem::ramSizeGB, {{ 8, 12, 16, 24, 32 }}},
|
||||
// tiny small medium large huge
|
||||
{SizedItem::sweepInterval, {{ 10, 30, 60, 90, 120 }}},
|
||||
{SizedItem::treeCacheSize, {{ 262144, 524288, 2097152, 4194304, 8388608 }}},
|
||||
{SizedItem::treeCacheAge, {{ 30, 60, 90, 120, 900 }}},
|
||||
{SizedItem::ledgerSize, {{ 32, 128, 256, 384, 768 }}},
|
||||
{SizedItem::ledgerAge, {{ 30, 90, 180, 240, 900 }}},
|
||||
{SizedItem::ledgerFetch, {{ 2, 3, 4, 5, 8 }}},
|
||||
{SizedItem::hashNodeDBCache, {{ 4, 12, 24, 64, 128 }}},
|
||||
{SizedItem::txnDBCache, {{ 4, 12, 24, 64, 128 }}},
|
||||
{SizedItem::lgrDBCache, {{ 4, 8, 16, 32, 128 }}},
|
||||
{SizedItem::openFinalLimit, {{ 8, 16, 32, 64, 128 }}},
|
||||
{SizedItem::burstSize, {{ 4, 8, 16, 32, 48 }}},
|
||||
{SizedItem::ramSizeGB, {{ 8, 12, 16, 24, 32 }}},
|
||||
}};
|
||||
|
||||
// Ensure that the order of entries in the table corresponds to the
|
||||
|
||||
@@ -603,7 +603,7 @@ PeerImp::fail(std::string const& reason)
|
||||
return post(
|
||||
strand_,
|
||||
std::bind(
|
||||
(void(Peer::*)(std::string const&)) & PeerImp::fail,
|
||||
(void (Peer::*)(std::string const&)) & PeerImp::fail,
|
||||
shared_from_this(),
|
||||
reason));
|
||||
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)
|
||||
{
|
||||
overlay_.incJqTransOverflow();
|
||||
JLOG(p_journal_.info()) << "Transaction queue is full";
|
||||
}
|
||||
else if (app_.getLedgerMaster().getValidatedLedgerAge() > 4min)
|
||||
{
|
||||
JLOG(p_journal_.trace())
|
||||
<< "No new transactions until synchronized";
|
||||
}
|
||||
else
|
||||
{
|
||||
app_.getJobQueue().addJob(
|
||||
@@ -2573,6 +2574,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
|
||||
return;
|
||||
|
||||
auto key = sha512Half(makeSlice(m->validation()));
|
||||
|
||||
if (auto [added, relayed] =
|
||||
app_.getHashRouter().addSuppressionPeerWithStatus(key, id_);
|
||||
!added)
|
||||
@@ -2592,22 +2594,36 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
|
||||
if (!isTrusted && (tracking_.load() == Tracking::diverged))
|
||||
{
|
||||
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();
|
||||
app_.getJobQueue().addJob(
|
||||
isTrusted ? jtVALIDATION_t : jtVALIDATION_ut,
|
||||
"recvValidation->checkValidation",
|
||||
[weak, val, m]() {
|
||||
name,
|
||||
[weak, val, m, key]() {
|
||||
if (auto peer = weak.lock())
|
||||
peer->checkValidation(val, m);
|
||||
peer->checkValidation(val, key, m);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
JLOG(p_journal_.debug()) << "Validation: Dropping UNTRUSTED (load)";
|
||||
JLOG(p_journal_.debug())
|
||||
<< "Dropping untrusted validation for load";
|
||||
}
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
@@ -3152,12 +3168,13 @@ PeerImp::checkPropose(
|
||||
void
|
||||
PeerImp::checkValidation(
|
||||
std::shared_ptr<STValidation> const& val,
|
||||
uint256 const& key,
|
||||
std::shared_ptr<protocol::TMValidation> const& packet)
|
||||
{
|
||||
if (!cluster() && !val->isValid())
|
||||
if (!val->isValid())
|
||||
{
|
||||
JLOG(p_journal_.debug()) << "Validation forwarded by peer is invalid";
|
||||
charge(Resource::feeInvalidRequest);
|
||||
charge(Resource::feeInvalidSignature);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3167,18 +3184,16 @@ PeerImp::checkValidation(
|
||||
if (app_.getOPs().recvValidation(val, std::to_string(id())) ||
|
||||
cluster())
|
||||
{
|
||||
auto const suppression =
|
||||
sha512Half(makeSlice(val->getSerialized()));
|
||||
// haveMessage contains peers, which are suppressed; i.e. the peers
|
||||
// are the source of the message, consequently the message should
|
||||
// not be relayed to these peers. But the message must be counted
|
||||
// as part of the squelch logic.
|
||||
auto haveMessage =
|
||||
overlay_.relay(*packet, suppression, val->getSignerPublic());
|
||||
overlay_.relay(*packet, key, val->getSignerPublic());
|
||||
if (reduceRelayReady() && !haveMessage.empty())
|
||||
{
|
||||
overlay_.updateSlotAndSquelch(
|
||||
suppression,
|
||||
key,
|
||||
val->getSignerPublic(),
|
||||
std::move(haveMessage),
|
||||
protocol::mtVALIDATION);
|
||||
|
||||
@@ -626,6 +626,7 @@ private:
|
||||
void
|
||||
checkValidation(
|
||||
std::shared_ptr<STValidation> const& val,
|
||||
uint256 const& key,
|
||||
std::shared_ptr<protocol::TMValidation> const& packet);
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user