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

[netdata] new feature to optimize published routes when netdata gets full #8395

Closed
wants to merge 2 commits into from

Conversation

abtink
Copy link
Member

@abtink abtink commented Nov 15, 2022

This commit adds a new feature in NetworkData::Publisher to monitor
when Network Data gets full and optimize published external routes
entries and replace them with a set of compact (shorter length)
prefixes.

OPENTHREAD_CONFIG_NETDATA_PUBLISHER_OPTIMIZE_ROUTES_ON_FULL_NETDATA
controls this feature and by default it is enabled when device is
configured as BR (i.e., BORDER_ROUTING/RoutingManager is
enabled).

The compact prefix list is determined using the following algorithm:

  • The initial "compact prefix length" is set to 48.
  • All route prefixes (excluding ::/0) are shortened to the "compact
    prefix length" if they are longer.
  • All repeating prefixes are removed.
  • Any prefix that is contained within another shorter prefix is removed.
  • If the new set can not still fit in Network Data, the "compact prefix
    length" is shortened to 10 and then to 7.

Once in optimized mode, Publisher will periodically check if it can
again go back to normal mode by trying to publish all routes and
checking if network data gets full. The default period is set to 4
hours (with a jitter of 15 minutes).

This commit adds a test-case in test_network_data to validate the
behavior of newly added mechanism.


@size-report
Copy link

size-report bot commented Nov 15, 2022

Size Report of OpenThread

Merging #8395 into main(0759de4).

name branch text data bss total
ot-cli-ftd_1.1 main 465088 776 62388 528252
#8395 465128 776 62388 528292
+/- +40 0 0 +40
ot-cli-mtd_1.1 main 384848 776 52452 438076
#8395 384864 776 52452 438092
+/- +16 0 0 +16
ot-ncp-ftd_1.1 main 444252 776 59144 504172
#8395 444292 776 59144 504212
+/- +40 0 0 +40
ot-ncp-mtd_1.1 main 366756 776 49216 416748
#8395 366772 776 49216 416764
+/- +16 0 0 +16
ot-rcp_1.1 main 58600 564 19964 79128
#8395 58600 564 19964 79128
+/- 0 0 0 0
libopenthread-cli-ftd.a_1.1 main 47515 0 6468 53983
#8395 47515 0 6468 53983
+/- 0 0 0 0
libopenthread-cli-mtd.a_1.1 main 40096 0 6460 46556
#8395 40096 0 6460 46556
+/- 0 0 0 0
libopenthread-ftd.a_1.1 main 243997 16 38478 282491
#8395 244048 16 38478 282542
+/- +51 0 0 +51
libopenthread-mtd.a_1.1 main 177892 16 28550 206458
#8395 177905 16 28550 206471
+/- +13 0 0 +13
libopenthread-ncp-ftd.a_1.1 main 31617 0 5852 37469
#8395 31617 0 5852 37469
+/- 0 0 0 0
libopenthread-ncp-mtd.a_1.1 main 26461 0 5852 32313
#8395 26461 0 5852 32313
+/- 0 0 0 0
libopenthread-rcp.a_1.1 main 8912 0 4988 13900
#8395 8912 0 4988 13900
+/- 0 0 0 0
libopenthread-radio.a_1.1 main 16329 0 174 16503
#8395 16329 0 174 16503
+/- 0 0 0 0
ot-cli-ftd_1.3 main 487624 776 71884 560284
#8395 487664 776 71884 560324
+/- +40 0 0 +40
ot-cli-mtd_1.3 main 399896 776 53676 454348
#8395 399912 776 53676 454364
+/- +16 0 0 +16
ot-ncp-ftd_1.3 main 465692 776 68632 535100
#8395 465732 776 68632 535140
+/- +40 0 0 +40
ot-ncp-mtd_1.3 main 380324 776 50432 431532
#8395 380332 776 50432 431540
+/- +8 0 0 +8
ot-rcp_1.3 main 60932 564 20532 82028
#8395 60932 564 20532 82028
+/- 0 0 0 0
libopenthread-cli-ftd.a_1.3 main 50416 0 6468 56884
#8395 50416 0 6468 56884
+/- 0 0 0 0
libopenthread-cli-mtd.a_1.3 main 42394 0 6460 48854
#8395 42394 0 6460 48854
+/- 0 0 0 0
libopenthread-ftd.a_1.3 main 262650 16 47430 310096
#8395 262701 16 47430 310147
+/- +51 0 0 +51
libopenthread-mtd.a_1.3 main 189449 16 29230 218695
#8395 189462 16 29230 218708
+/- +13 0 0 +13
libopenthread-ncp-ftd.a_1.3 main 33455 0 5852 39307
#8395 33455 0 5852 39307
+/- 0 0 0 0
libopenthread-ncp-mtd.a_1.3 main 27827 0 5852 33679
#8395 27827 0 5852 33679
+/- 0 0 0 0
libopenthread-rcp.a_1.3 main 9078 0 4988 14066
#8395 9078 0 4988 14066
+/- 0 0 0 0
libopenthread-radio.a_1.3 main 17214 0 206 17420
#8395 17214 0 206 17420
+/- 0 0 0 0

@abtink abtink force-pushed the netdata/action-on-full branch 2 times, most recently from af6925f to afaf261 Compare November 15, 2022 18:24
@abtink abtink force-pushed the netdata/action-on-full branch 2 times, most recently from 3e91ffb to 55cf282 Compare November 29, 2022 01:19
@codecov
Copy link

codecov bot commented Nov 29, 2022

Codecov Report

Merging #8395 (0759de4) into main (0759de4) will not change coverage.
The diff coverage is n/a.

❗ Current head 0759de4 differs from pull request most recent head 435310c. Consider uploading reports for the commit 435310c to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8395   +/-   ##
=======================================
  Coverage   85.06%   85.06%           
=======================================
  Files         518      518           
  Lines       72191    72191           
=======================================
  Hits        61410    61410           
  Misses      10781    10781           

This commit adds a new mechanism to detect when Network Data (local
or leader) gets full and signals by invoking a callback which can be
set with a newly added OT API.

New method is added in `NetworkData::Leader` to determine whether
registering local Network Data into the current Leader data can be
successful or if it may lead to Network Data getting full. This is
determined by device emulating the leader behavior and registering
the local Network Data into a clone of the current leader's Network
Data.
…full

This commit adds a new feature in `NetworkData::Publisher` to monitor
when Network Data gets full and optimize published external routes
entries and replace them with a set of compact (shorter length)
prefixes.

`OPENTHREAD_CONFIG_NETDATA_PUBLISHER_OPTIMIZE_ROUTES_ON_FULL_NETDATA`
controls this feature and by default it is enabled when device is
configured as BR (i.e.,  `BORDER_ROUTING`/`RoutingManager` is
enabled).

The compact prefix list is determined using the following algorithm:
- The initial "compact prefix length" is set to 48.
- All route prefixes (excluding `::/0`) are shortened to the "compact
  prefix length" if they are longer.
- All repeating prefixes are removed.
- Any prefix that is contained within another shorter prefix is removed.
- If the new set can not still fit in Network Data, the "compact prefix
  length" is shortened to 10 and then to 7.

Once in optimized mode, `Publisher` will periodically check if it can
again go back to normal mode by trying to publish all routes and
checking if network data gets full. The default period is set to 4
hours (with a jitter of 15 minutes).

This commit adds a test-case in `test_network_data` to validate the
behavior of newly added mechanism.
@abtink
Copy link
Member Author

abtink commented Mar 28, 2023

Closing this PR in favor of new solution in

@abtink abtink closed this Mar 28, 2023
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.

2 participants