solana-with-rpc-optimizations/core
behzad nouri 9b866d79fb
shards crds values based on their hash prefix (#12187)
filter_crds_values checks every crds filter against every hash value:
https://github.com/solana-labs/solana/blob/ee646aa7/core/src/crds_gossip_pull.rs#L432
which can be inefficient if the filter's bit-mask only matches small
portion of the entire crds table.

This commit shards crds values into separate tables based on shard_bits
first bits of their hash prefix. Given a (mask, mask_bits) filter,
filtering crds can be done by inspecting only relevant shards.

If CrdsFilter.mask_bits <= shard_bits, then precisely only the crds
values which match (mask, mask_bits) bit pattern are traversed.
If CrdsFilter.mask_bits > shard_bits, then approximately only
1/2^shard_bits of crds values are inspected.

Benchmarking on a gce cluster of 20 nodes, I see ~10% improvement in
generate_pull_responses metric, but with larger clusters, crds table and
2^mask_bits are both larger, so the impact should be more significant.
2020-09-17 14:05:16 +00:00
..
benches shards crds values based on their hash prefix (#12187) 2020-09-17 14:05:16 +00:00
src shards crds values based on their hash prefix (#12187) 2020-09-17 14:05:16 +00:00
tests Add --gossip-validator argument 2020-09-14 20:18:27 -07:00
.gitignore tmp dirs target to farf (#5079) 2019-07-12 18:28:42 -07:00
Cargo.toml shards crds values based on their hash prefix (#12187) 2020-09-17 14:05:16 +00:00
build.rs Introduce automatic ABI maintenance mechanism (2/2; rollout) (#8012) 2020-07-06 20:22:23 +09:00