Control transaction dispatch rate:

Do not process a transaction received from a peer if it has
been processed within the past ten seconds.

Increase the number of transaction handlers that can be in
flight in the job queue and decrease the relative cost for
peers to share transaction and ledger data.

Additionally, make better use of resources by adjusting the
number of threads we initialize, by reverting commit
68b8ffdb63.

Performance counter modifications:
  * Create and display counters to track:
    1) Pending transaction limit overruns.
    2) Total peer disconnections.
    3) Peers disconnections due to resource consumption.

Avoid a potential double-free in Json library.
This commit is contained in:
Mark Travis
2018-01-17 08:34:22 -08:00
committed by Scott Schurr
parent 49b5c42e85
commit 76ad06ef47
10 changed files with 95 additions and 11 deletions

View File

@@ -222,6 +222,7 @@ PeerImp::charge (Resource::Charge const& fee)
usage_.disconnect() && strand_.running_in_this_thread())
{
// Sever the connection
overlay_.incPeerDisconnectCharges();
fail("charge: Resources");
}
}
@@ -414,6 +415,7 @@ PeerImp::close()
error_code ec;
timer_.cancel(ec);
socket_.close(ec);
overlay_.incPeerDisconnect();
if(m_inbound)
{
JLOG(journal_.debug()) << "Closed";
@@ -1054,10 +1056,10 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMTransaction> const& m)
uint256 txID = stx->getTransactionID ();
int flags;
constexpr std::chrono::seconds tx_interval = 10s;
if (! app_.getHashRouter ().shouldProcess (
txID, id_, flags, clock_type::now(), tx_interval))
if (! app_.getHashRouter ().shouldProcess (txID, id_, flags,
tx_interval))
{
// we have seen this transaction recently
if (flags & SF_BAD)
@@ -1094,6 +1096,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMTransaction> const& m)
constexpr int max_transactions = 250;
if (app_.getJobQueue().getJobCount(jtTRANSACTION) > max_transactions)
{
overlay_.incJqTransOverflow();
JLOG(p_journal_.info()) << "Transaction queue is full";
}
else if (app_.getLedgerMaster().getValidatedLedgerAge() > 4min)