Skip to content

[Nexthop][misc] Move request routes through the RIB and free them early - #1907

Draft
deepakgudiseva-nexthop wants to merge 1 commit into
meta:mainfrom
nexthop-ai:agent-move-rib-request-routes
Draft

deepakgudiseva-nexthop wants to merge 1 commit into
meta:mainfrom
nexthop-ai:agent-move-rib-request-routes

Conversation

@deepakgudiseva-nexthop

Copy link
Copy Markdown

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

addUnicastRoutes and syncFib hold every requested route twice until the hardware update returns: the thrift request and the RIB's converted copy. RibRouteTables::update then copies the converted routes once more to resolve named next-hop groups. At high ECMP width each route carries a large next-hop list, so a full-table sync or a large replace peaks at several copies of the table in sw_agent.

This moves the request routes into RouteUpdateWrapper, frees each thrift route once the RIB has converted it, resolves named next-hop groups in place on the owned vector, and frees that vector before updateFib, where the push to the hardware peaks. Existing callers are unchanged: the new addRoute and RoutingInformationBase::update overloads take rvalues, and RibRouteTables::update takes its routes by value.

Independent of #1906 (no shared files).

Test Plan

  • Agent unit tests pass with this change in our fork's CI. Rebased onto main: the only difference is that the in-place resolvedRoutes line now sits in RibRouteTables::update's updated lambda.
  • pre-commit run (clang-format 21.1.2) clean on the modified files.

addUnicastRoutes and syncFib hold every requested route twice until the
hardware update returns: the thrift request and the RIB's converted copy, and
RibRouteTables::update copies the converted routes once more to resolve named
next-hop groups. At high ECMP width each route carries a large next-hop list,
so a full-table sync or a large replace peaks at several copies of the table.

Move the request routes into RouteUpdateWrapper, free each thrift route once
the RIB has converted it, resolve named next-hop groups in place on the owned
vector, and free that vector before updateFib, where the push to the hardware
peaks.
@meta-cla meta-cla Bot added the CLA Signed label Nov 4, 2026
@deepakgudiseva-nexthop deepakgudiseva-nexthop changed the title [Nexthop] Move request routes through the RIB and free them early [Nexthop][misc] Move request routes through the RIB and free them early Nov 4, 2026
@github-actions github-actions Bot added nexthop project:misc FBOSS project: misc labels Nov 4, 2026
@deepakgudiseva-nexthop

Copy link
Copy Markdown
Author

Memory impact (#1906 + #1907)

Setup: 128-way ECMP, 22k routes (~2.8M paths), with enable_nexthop_id_manager, resolve_nexthops_from_id and drop_inline_nexthops_with_id enabled.

fboss_sw_agent memory, GiB:

drop inline only + #1906 + #1907
Peak, route learn 5.8 2.2
Peak, route withdraw 5.6 2.1
Steady state 0.48 0.46

Together the two PRs cut sw_agent's peak during route updates by about 3.6 GiB (~60%). Steady state stays the same.

@deepakgudiseva-nexthop

Copy link
Copy Markdown
Author

/autorebase

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant