Adjust single-hash confirm requests (#2371)
This commit is contained in:
parent
af658048cf
commit
ea81f9cab5
3 changed files with 21 additions and 26 deletions
|
@ -399,7 +399,7 @@ void nano::active_transactions::request_confirm (nano::unique_lock<std::mutex> &
|
|||
}
|
||||
this->condition.notify_all ();
|
||||
},
|
||||
10); // 500ms / (10ms / 1 block) > 30 blocks
|
||||
10); // 10ms/block * 30blocks = 300ms < 500ms
|
||||
}
|
||||
// Batch confirmation request
|
||||
if (!batched_confirm_req_bundle_l.empty ())
|
||||
|
@ -412,7 +412,7 @@ void nano::active_transactions::request_confirm (nano::unique_lock<std::mutex> &
|
|||
}
|
||||
this->condition.notify_all ();
|
||||
},
|
||||
20); // 500ms / (20ms / 5 batch size) > (20*7 = 140) batches
|
||||
15); // 15ms/batch * 20batches = 300ms < 500ms
|
||||
}
|
||||
// Single confirmation requests
|
||||
if (!single_confirm_req_bundle_l.empty ())
|
||||
|
@ -425,7 +425,7 @@ void nano::active_transactions::request_confirm (nano::unique_lock<std::mutex> &
|
|||
}
|
||||
this->condition.notify_all ();
|
||||
},
|
||||
10); // 500ms / (10-20ms / 1 req) > 15 reqs
|
||||
30); // 30~60ms/req * 5 reqs = 150~300ms < 500ms
|
||||
}
|
||||
lock_a.lock ();
|
||||
// Erase inactive elections
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
static size_t constexpr max_block_broadcasts = 30;
|
||||
static size_t constexpr max_confirm_representatives = 30;
|
||||
static size_t constexpr max_confirm_req_batches = 20;
|
||||
static size_t constexpr max_confirm_req = 15;
|
||||
static size_t constexpr max_confirm_req = 5;
|
||||
boost::circular_buffer<double> multipliers_cb;
|
||||
uint64_t trended_active_difficulty;
|
||||
size_t priority_cementable_frontiers_size ();
|
||||
|
|
|
@ -331,35 +331,30 @@ void nano::network::broadcast_confirm_req_base (std::shared_ptr<nano::block> blo
|
|||
|
||||
void nano::network::broadcast_confirm_req_batched_many (std::unordered_map<std::shared_ptr<nano::transport::channel>, std::deque<std::pair<nano::block_hash, nano::root>>> request_bundle_a, std::function<void()> callback_a, unsigned delay_a, bool resumption_a)
|
||||
{
|
||||
const size_t burst_size_l{ 5 };
|
||||
if (!resumption_a && node.config.logging.network_logging ())
|
||||
{
|
||||
node.logger.try_log (boost::str (boost::format ("Broadcasting batch confirm req to %1% representatives") % request_bundle_a.size ()));
|
||||
}
|
||||
|
||||
for (size_t count_l (0); !request_bundle_a.empty () && count_l < burst_size_l; ++count_l)
|
||||
for (auto i (request_bundle_a.begin ()), n (request_bundle_a.end ()); i != n;)
|
||||
{
|
||||
auto j (request_bundle_a.begin ());
|
||||
while (j != request_bundle_a.end ())
|
||||
std::vector<std::pair<nano::block_hash, nano::root>> roots_hashes_l;
|
||||
// Limit max request size hash + root to 7 pairs
|
||||
while (roots_hashes_l.size () < confirm_req_hashes_max && !i->second.empty ())
|
||||
{
|
||||
std::vector<std::pair<nano::block_hash, nano::root>> roots_hashes_l;
|
||||
// Limit max request size hash + root to 7 pairs
|
||||
while (roots_hashes_l.size () < confirm_req_hashes_max && !j->second.empty ())
|
||||
{
|
||||
// expects ordering by priority, descending
|
||||
roots_hashes_l.push_back (j->second.front ());
|
||||
j->second.pop_front ();
|
||||
}
|
||||
nano::confirm_req req (roots_hashes_l);
|
||||
j->first->send (req);
|
||||
if (j->second.empty ())
|
||||
{
|
||||
j = request_bundle_a.erase (j);
|
||||
}
|
||||
else
|
||||
{
|
||||
++j;
|
||||
}
|
||||
// expects ordering by priority, descending
|
||||
roots_hashes_l.push_back (i->second.front ());
|
||||
i->second.pop_front ();
|
||||
}
|
||||
nano::confirm_req req (roots_hashes_l);
|
||||
i->first->send (req);
|
||||
if (i->second.empty ())
|
||||
{
|
||||
i = request_bundle_a.erase (i);
|
||||
}
|
||||
else
|
||||
{
|
||||
++i;
|
||||
}
|
||||
}
|
||||
if (!request_bundle_a.empty ())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue