Skip to content
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

Do not preserve MPReachNLRI attribute the way we receive it from wire #2863

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

Conversation

myaut
Copy link

@myaut myaut commented Dec 25, 2024

Right now table.ProcessMessage() rebuilds attribute list, but preserves
MPReachNLRI attribute as is. This causes trouble if GoBGP has a neighbor
that merges multiple NLRIs having same nexthop in a single BGP update
message and if GoBGP has a watcher. Thus watcher receives up to n^2
nlris (n paths each containing n NLRIs) causing enormous memory
consumption (since serialization/deserialization removes deduplication).

Since having all NLRIs in each path is useless in most cases, the
behavior is changed so only relevant NLRI is present in BGP path, but
for backward compatibility old behavior can be reenabled using config
option:

    bgp-update-processing:
      config:
        preserve-nlris: true

In our tests memory consumption of such watcher had reduced from 19 Gb
to 2Gb (with around 300K routes in RIB).

Sergey Klyaus added 2 commits December 25, 2024 12:28
Right now table.ProcessMessage() rebuilds attribute list, but preserves
MPReachNLRI attribute as is. This causes trouble if GoBGP has a neighbor
that merges multiple NLRIs having same nexthop in a single BGP update
message and if GoBGP has a watcher. Thus watcher receives up to n^2
nlris (n paths each containing n NLRIs) causing enormous memory
consumption (since serialization/deserialization removes deduplication).

Since having all NLRIs in each path is useless in most cases, the
behavior is changed so only relevant NLRI is present in BGP path, but
for backward compatibility old behavior can be reenabled using config
option:
    bgp-update-processing:
      config:
        preserve-nlris: false

In our tests memory consumption of such watcher had reduced from 19 Gb
to 2Gb (with around 300K routes in RIB).
@@ -3175,9 +3215,6 @@ type NeighborConfig struct {
// original -> bgp:peer-group
// The peer-group with which this neighbor is associated.
PeerGroup string `mapstructure:"peer-group" json:"peer-group,omitempty"`
// original -> gobgp:send-software-version
// gobgp:send-software-version's original type is boolean.
SendSoftwareVersion bool `mapstructure:"send-software-version" json:"send-software-version,omitempty"`
Copy link
Author

Choose a reason for hiding this comment

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

Honestly, I do not know why this didn't surface up earlier.
neighbor-interface is defined at line 919 https://github.com/osrg/gobgp/blob/master/tools/pyang_plugins/gobgp.yang#L919
send-software-version at 1010: https://github.com/osrg/gobgp/blob/master/tools/pyang_plugins/gobgp.yang#L1010
It is logical that it goes after it.

Changing order of field broke test, though, so I fixed overrideConfig() in a separate commit

@fujita
Copy link
Member

fujita commented Dec 25, 2024

I can't recall why but we preserve that attribute for bmp/mrt?

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.

2 participants