Configurable inactive votes cache size (#2579)

This commit is contained in:
Sergey Kroshnin 2020-02-25 22:08:57 +03:00 committed by GitHub
commit 73b12c30bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 3 deletions

View file

@ -997,7 +997,7 @@ void nano::active_transactions::add_inactive_votes_cache (nano::block_hash const
bool start_bootstrap (inactive_votes_bootstrap_check (representative_vector, hash_a, confirmed));
auto & inactive_by_arrival (inactive_votes_cache.get<tag_arrival> ());
inactive_by_arrival.emplace (nano::inactive_cache_information{ std::chrono::steady_clock::now (), hash_a, representative_vector, start_bootstrap, confirmed });
if (inactive_votes_cache.size () > inactive_votes_cache_max)
if (inactive_votes_cache.size () > node.flags.inactive_votes_cache_size)
{
inactive_by_arrival.erase (inactive_by_arrival.begin ());
}

View file

@ -202,7 +202,6 @@ private:
mi::member<nano::inactive_cache_information, nano::block_hash, &nano::inactive_cache_information::hash>>>>;
ordered_cache inactive_votes_cache;
// clang-format on
static size_t constexpr inactive_votes_cache_max{ 16 * 1024 };
bool inactive_votes_bootstrap_check (std::vector<nano::account> const &, nano::block_hash const &, bool &);
static size_t constexpr dropped_elections_cache_max{ 32 * 1024 };
boost::thread thread;

View file

@ -100,7 +100,8 @@ void nano::add_node_flag_options (boost::program_options::options_description &
("batch_size", boost::program_options::value<std::size_t>(), "Increase sideband batch size, default 512")
("block_processor_batch_size", boost::program_options::value<std::size_t>(), "Increase block processor transaction batch write size, default 0 (limited by config block_processor_batch_max_time), 256k for fast_bootstrap")
("block_processor_full_size", boost::program_options::value<std::size_t>(), "Increase block processor allowed blocks queue size before dropping live network packets and holding bootstrap download, default 65536, 1 million for fast_bootstrap")
("block_processor_verification_size", boost::program_options::value<std::size_t>(), "Increase batch signature verification size in block processor, default 0 (limited by config signature_checker_threads), unlimited for fast_bootstrap");
("block_processor_verification_size", boost::program_options::value<std::size_t>(), "Increase batch signature verification size in block processor, default 0 (limited by config signature_checker_threads), unlimited for fast_bootstrap")
("inactive_votes_cache_size", boost::program_options::value<std::size_t>(), "Increase cached votes without active elections size, default 16384");
// clang-format on
}
@ -154,6 +155,11 @@ std::error_code nano::update_flags (nano::node_flags & flags_a, boost::program_o
{
flags_a.block_processor_verification_size = block_processor_verification_size_it->second.as<size_t> ();
}
auto inactive_votes_cache_size_it = vm.find ("inactive_votes_cache_size");
if (inactive_votes_cache_size_it != vm.end ())
{
flags_a.inactive_votes_cache_size = inactive_votes_cache_size_it->second.as<size_t> ();
}
return ec;
}

View file

@ -136,5 +136,6 @@ public:
size_t block_processor_batch_size{ 0 };
size_t block_processor_full_size{ 65536 };
size_t block_processor_verification_size{ 0 };
size_t inactive_votes_cache_size{ 16 * 1024 };
};
}