Skip to content

Commit 9d50d17

Browse files
committed
gossip: update stem burst
1 parent 3f06cf9 commit 9d50d17

File tree

2 files changed

+45
-6
lines changed

2 files changed

+45
-6
lines changed

src/app/firedancer-dev/commands/gossip.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ gossip_cmd_topo( config_t * config ) {
8686
}
8787

8888
fd_topob_wksp( topo, "gossip_net" );
89-
fd_topob_link( topo, "gossip_net", "gossip_net", config->net.ingress_buffer_size, FD_NET_MTU, 1UL );
89+
fd_topob_link( topo, "gossip_net", "gossip_net", 65536*4UL, FD_NET_MTU, 1UL );
9090
fd_topos_tile_in_net( topo, "metric_in", "gossip_net", 0UL, FD_TOPOB_UNRELIABLE, FD_TOPOB_POLLED );
9191
fd_topob_tile_out( topo, "gossip", 0UL, "gossip_net", 0UL );
9292

@@ -115,13 +115,13 @@ gossip_cmd_topo( config_t * config ) {
115115
fd_topob_wksp( topo, "gossip_gossv" );
116116
fd_topob_wksp( topo, "gossip_out" );
117117

118-
fd_topob_link( topo, "gossip_gossv", "gossip_gossv", 4096UL, sizeof(fd_gossip_ping_update_t), 1UL );
118+
fd_topob_link( topo, "gossip_gossv", "gossip_gossv", 65536UL*4, sizeof(fd_gossip_ping_update_t), 1UL );
119119
fd_topob_tile_out( topo, "gossip", 0UL, "gossip_gossv", 0UL );
120120

121-
fd_topob_link( topo, "gossip_out", "gossip_out", 65536UL, sizeof(fd_gossip_update_message_t), 1UL );
121+
fd_topob_link( topo, "gossip_out", "gossip_out", 65536UL*4, sizeof(fd_gossip_update_message_t), 1UL );
122122
fd_topob_tile_out( topo, "gossip", 0UL, "gossip_out", 0UL );
123123
for( ulong i=0UL; i<gossvf_tile_count; i++ ) {
124-
fd_topob_link( topo, "gossvf_gossi", "gossvf_gossi", config->net.ingress_buffer_size, sizeof(fd_gossip_view_t)+FD_NET_MTU, 1UL );
124+
fd_topob_link( topo, "gossvf_gossi", "gossvf_gossi", 65536UL*4, sizeof(fd_gossip_view_t)+FD_NET_MTU, 1UL );
125125
fd_topob_tile_out( topo, "gossvf", i, "gossvf_gossi", i );
126126
fd_topob_tile_in( topo, "gossip", 0UL, "metric_in", "gossvf_gossi", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
127127

src/discof/gossip/fd_gossip_tile.c

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,47 @@ populate_allowed_fds( fd_topo_t const * topo,
493493
return out_cnt;
494494
}
495495

496-
/* TODO: Size for the worst case ... 16k contact info updates + max crds in a pull request or push, all generating a frag */
497-
#define STEM_BURST (1<<5)
496+
/* Account for worst case in fd_gossip_rx and fd_gossip_advance, which
497+
are both called in returnable_frag.
498+
499+
fd_gossip_rx: Gossip updates are sent out via the gossip_out link for
500+
specific CRDS messages received, and when a contact info is dropped.
501+
Worst case is when:
502+
- all incoming CRDS messages are broadcasted as updates, and
503+
- CRDS table is full, and all entries dropped to make way for new
504+
ones are contact infos
505+
506+
Ping tracker track also publishes a status change on the
507+
gossip_gossv link if an incoming pong changes an inactive or
508+
unpinged peer to active. There is only one pong processed per
509+
after_frag loop.
510+
511+
This leaves us with a worst case of FD_GOSSIP_MSG_MAX_CRDS*2 on
512+
gossip_out, and 1 on gossip_gossv.
513+
514+
fd_gossip_advance: two links we need to look at: the gossip_gossv
515+
link that publishes fd_ping_tracker changes and the gossip_out link
516+
for when contact infos are dropped during expiry.
517+
518+
fd_ping_tracker publishes a ping status change message when a peer
519+
becomes inactive. In the worst case, all peers can become inactive
520+
in one loop. So there would be FD_PING_TRACKER_MAX ping status
521+
changes.
522+
523+
During the expire loop, all contact infos might be dropped in one
524+
iteration, which would result in CRDS_MAX_CONTACT_INFO gossip
525+
updates
526+
527+
We find the worst case burst by taking the maximum burst of the two
528+
links in fd_gossip_rx and fd_gossip_advance. That would be:
529+
gossip_out link gossip_gossv link
530+
max( FD_GOSSIP_MSG_CRDS_MAX*2+CRDS_MAX_CONTACT_INFO, 1+FD_PING_TRACKER_MAX)
531+
532+
*/
533+
534+
FD_STATIC_ASSERT( CRDS_MAX_CONTACT_INFO+FD_GOSSIP_MSG_MAX_CRDS*2UL<=FD_PING_TRACKER_MAX+1UL,
535+
"Gossip stem burst needs recalculating" );
536+
#define STEM_BURST ( FD_PING_TRACKER_MAX+1UL )
498537

499538
#define STEM_LAZY (128L*3000L)
500539

0 commit comments

Comments
 (0)