Skip to content

Commit

Permalink
bgpd: Reduce size of ibuf_work ringbuf
Browse files Browse the repository at this point in the history
The ringbuf is 650k in size.  This is obscenely large and
in practical experimentation FRR never even approaches
that size at all.  Let's reduce this to 1.5 max packet sizes.

If a BGP_MAX_PACKET_SIZE packet is ever received having a bit
of extra space ensures that we can read at least 1 packet.

This also will significantly reduce memory usage when the
operator has a lot of peers.

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Jul 24, 2023
1 parent 102bad0 commit fe1c72a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bgpd/bgpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ struct peer *peer_new(struct bgp *bgp)
pthread_mutex_init(&peer->io_mtx, NULL);

peer->ibuf_work =
ringbuf_new(BGP_MAX_PACKET_SIZE * BGP_READ_PACKET_MAX);
ringbuf_new(BGP_MAX_PACKET_SIZE + BGP_MAX_PACKET_SIZE/2);

/* Get service port number. */
sp = getservbyname("bgp", "tcp");
Expand Down

0 comments on commit fe1c72a

Please sign in to comment.