Skip to content

Conversation

@GaladrielZhao
Copy link
Contributor

This change optimizes BGP memory usage
by relocating the multipath (mpath) pointer from bgp_path_info to bgp_dest.

In ECMP scenarios, the number of bgp_path_info entries can be up to MULTIPATH_NUM times that of bgp_dest.
By moving the mpath pointer to bgp_dest, we reduce the total number of mpath pointers allocated,
leading to lower memory consumption in large BGP deployments.

Optimize BGP memory usage by relocating the multipath (mpath) pointer
from bgp_path_info to bgp_dest.
In ECMP scenarios, the number of bgp_path_info entries can be up to
MULTIPATH_NUM times that of bgp_dest. By moving the mpath pointer to
bgp_dest, we reduce the total number of mpath pointers allocated,
leading to lower memory consumption in large BGP deployments.

Signed-off-by: Yuqing Zhao <[email protected]>
Copy link
Member

@ton31337 ton31337 left a comment

Choose a reason for hiding this comment

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

Could you add some performance/optimization results before/after to show what we are talking about?

@donaldsharp
Copy link
Member

So every bgp_dest allocated grows by 8 bytes. While For each path_info received the path_info will shrink by 8 bytes.. With any type of ECMP the savings should be significant for v4 and v6.

@ton31337
Copy link
Member

Yes, that's clear, but interesting if some testings were made at scale.

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Copy link
Member

@riw777 riw777 left a comment

Choose a reason for hiding this comment

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

looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants