Skip to content

flamenco, gossip: two-tiered value table #4800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ravyu-jump
Copy link
Contributor

@ravyu-jump ravyu-jump commented Apr 16, 2025

We now have two data structures that manage our Gossip value table

  1. value_metas: holds the metadata (hash + wallclock) of a processed value. Used in dedup + bloom filter construction.

  2. values: vector that holds the encoded form of the processed value. Used in gossip push + pull resp loops. The loops are now linear scans.

A cleanup policy that exploits this tiered value table will allow us to maintain a much smaller values vector without affecting the metadata map, which will help where only data is needed (push + pullresp). Will come in a future PR.

@ravyu-jump ravyu-jump force-pushed the gossip-two-tiered-value-table branch 2 times, most recently from b273004 to 8a3eff2 Compare April 16, 2025 21:39
@ravyu-jump ravyu-jump force-pushed the gossip-two-tiered-value-table branch from 8a3eff2 to aa09a24 Compare April 16, 2025 21:46
Copy link
Contributor

@cali-jumptrading cali-jumptrading left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super familiar with the gossip implementation, so I did a quick pass. Looks great though!

@ravyu-jump ravyu-jump force-pushed the gossip-two-tiered-value-table branch from aa09a24 to 62e9553 Compare April 17, 2025 18:20
vector as a push queue.
See fd_gossip_cleanup_values for an example */
static ulong
fd_gossip_compact_values( fd_gossip_t * glob ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why preserve ordering in this algorithm? Unordered deletes have lower runtime complexity

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we technically don't need strict ordering, just need a way to make sure values that have been pushed and values that need to be pushed don't get mixed up. I can come up with something lower runtime complexity but that's probably better served in a separate PR

@@ -376,6 +376,8 @@
| gossip_​peer_​counts_​repair | `gauge` | Number of peers of each type (Repair) |
| gossip_​peer_​counts_​voter | `gauge` | Number of peers of each type (Voter) |
| gossip_​shred_​version_​zero | `counter` | Shred version zero |
| gossip_​value_​map_​size | `gauge` | Current size of the CRDS value map |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make it clear this is the value_metas

static void
fd_gossip_cleanup_values( fd_gossip_t * glob,
fd_pending_event_arg_t * arg ) {
(void)arg;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: FD_PARAM_UNUSED

if ( ele->wallclock<value_expire ) {
/* This value has expired, mark it for deletion in the value vector and remove from map */
if( ele->value!=NULL ){
ele->value->del = 1UL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind elaborating in a comment why we need the two-stage deletion?

Comment on lines +2424 to +2426
memmove( &vec[start - num_deleted],
&vec[start + 1],
(next - start - 1) * sizeof(fd_value_t) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we document that the motivation for this is to reduce memory footprint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants