]> git.proxmox.com Git - mirror_frr.git/commit - ripd/rip_cli.c
northbound: KISS always batch yang config (file read), it's faster
authorChristian Hopps <chopps@gmail.com>
Fri, 28 May 2021 19:16:18 +0000 (19:16 +0000)
committerChristian Hopps <chopps@gmail.com>
Wed, 2 Jun 2021 14:05:26 +0000 (14:05 +0000)
commitfd396924d6fedf0c68707b314fb216b6b7544bcb
tree27abd7dccef7d523be828bcd683eda51d2e2a5fe
parent8c965eaaf41f783a67e880310e338291cac5a965
northbound: KISS always batch yang config (file read), it's faster

The backoff code assumed that yang operations always completed quickly.
It checked for > 100 YANG modeled commands happening in under 1 second
to enable batching. If 100 yang modeled commands always take longer than
1 second batching is never enabled. This is the exact opposite of what
we want to happen since batching speeds the operations up.

Here are the results for libyang2 code without and with batching.

| action        |  1K rts |  2K rts | 1K rts | 2K rts | 20k rts |
|               | nobatch | nobatch |  batch |  batch |   batch |
| Add IPv4      |    .881 |    1.28 |   .703 |   1.04 |    8.16 |
| Add Same IPv4 |    28.7 |     113 |   .590 |   .860 |    6.09 |
| Rem 1/2 IPv4  |    .376 |    .442 |   .379 |   .435 |    1.44 |
| Add Same IPv4 |    28.7 |     113 |   .576 |   .841 |    6.02 |
| Rem All IPv4  |    17.4 |    71.8 |   .559 |   .813 |    5.57 |

(IPv6 numbers are basically the same as iPv4, a couple percent slower)

Clearly we need this. Please note the growth (1K to 2K) w/o batching is
non-linear and 100 times slower than batched.

Notes on code: The use of the new `nb_cli_apply_changes_clear_pending`
is to commit any pending changes (including the current one). This is
done when the code would not correctly handle a single diff that
included the current changes with possible following changes. For
example, a "no" command followed by a new value to replace it would be
merged into a change, and the code would not deal well with that. A good
example of this is BGP neighbor peer-group changing. The other use is
after entering a router level (e.g., "router bgp") where the follow-on
command handlers expect that router object to now exists. The code
eventually needs to be cleaned up to not fail in these cases, but that
is for future NB cleanup.

Signed-off-by: Christian Hopps <chopps@labn.net>
16 files changed:
bgpd/bgp_vty.c
eigrpd/eigrp_cli.c
isisd/isis_cli.c
lib/command.c
lib/if.c
lib/lib_vty.c
lib/northbound.c
lib/northbound.h
lib/northbound_cli.c
lib/northbound_cli.h
lib/vrf.c
lib/vty.c
lib/vty.h
ripd/rip_cli.c
ripngd/ripng_cli.c
tests/bgpd/test_peer_attr.c