mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 09:00:55 +00:00
bgpd: Add an ability to control default-originate route-map timer
By default it's 5 seconds. That means, every 5 second it iterates over the whole BGP table and checks if a route-map is kicked in (if route-map is defined). Having a full feed with many of neighbors, this is a huge CPU-killer, and takes a lot of time. Thread statistics for bgpd: Showing statistics for pthread default -------------------------------------- CPU (user+system): Real (wall-clock): Active Runtime(ms) Invoked Avg uSec Max uSecs Avg uSec Max uSecs CPU_Warn Wall_Warn Starv_Warn Type Thread 0 0.487 10 48 84 49 85 0 0 0 T (bgp_connect_timer) 0 0.000 1 0 0 1 1 0 0 0 T bgp_startup_timer_expire 2 3.991 276 14 1032 14 1031 0 0 0 R zclient_read 0 0.010 4 2 6 3 6 0 0 0 E _bfd_sess_send 0 0.057 11 5 26 6 26 0 0 0 W vtysh_write 0 65.054 136 478 28907 484 28914 0 0 0 E bgp_event 0 11233.040 24 468043 2772209 1341293 7781145 0 3 0 T subgroup_coalesce_timer 2 3.649 33 110 394 111 395 0 0 0 R bgp_accept 0 468.837 5 93767 178929 93799 178960 0 0 0 T (bgp_graceful_stale_timer_expire) 0 0.462 9 51 77 51 78 0 0 0 T (bgp_start_timer) 1 415.825 14200 29 414 29 415 0 0 0 R vtysh_accept 0 0.052 3 17 47 18 49 0 0 1 T bgp_config_finish 0 0.011 1 11 11 12 12 0 0 0 E frr_config_read_in 0 0.022 4 5 8 6 9 0 0 0 E bgp_nht_ifp_initial 0 0.121 44 2 64 3 65 0 0 0 T (bgp_routeadv_timer) 0 34194.454 3 11398151 21874014 27937411 52641827 2 0 1 T bgp_route_map_update_timer 0 13246.820 8 1655852 3065476 4589606 8454782 0 4 1 T bgp_announce_route_timer_expired 0 0.035 2 17 26 18 27 0 0 0 E zclient_connect 0 279624.026 318778 877 571779 2808 1639624 0 0 5 T work_queue_run 0 0.097 32 3 21 3 23 0 0 0 RW bgp_connect_check 2 6005.738 43560 137 680012 138 680446 0 0 0 R vtysh_read 0 1605.840 1116298 1 1331 2 10152 0 0 133 T (bgp_generate_updgrp_packets) 0 1073.162 17 63127 222065 63175 222087 0 0 0 E bgp_packet_process_error 1 16744058.262 10691 1566182 1807248 1566900 1808301 0 0 5 T update_group_refresh_default_originate_route_map 0 0.000 11 0 0 0 1 0 0 0 T update_subgroup_merge_check_thread_cb 0 94544.034 1898726 49 225054 69 225156 0 0 0 E bgp_process_packet Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org> Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
610af81ae4
commit
d49700dd2f
@ -3292,7 +3292,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest,
|
||||
event_add_timer(
|
||||
bm->master,
|
||||
update_group_refresh_default_originate_route_map,
|
||||
bgp, RMAP_DEFAULT_ORIGINATE_EVAL_TIMER,
|
||||
bgp, bgp->rmap_def_originate_eval_timer,
|
||||
&bgp->t_rmap_def_originate_eval);
|
||||
}
|
||||
|
||||
|
@ -7959,6 +7959,26 @@ DEFPY (bgp_condadv_period,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFPY (bgp_def_originate_eval,
|
||||
bgp_def_originate_eval_cmd,
|
||||
"[no$no] bgp default-originate timer (0-3600)$timer",
|
||||
NO_STR
|
||||
BGP_STR
|
||||
"Control default-originate\n"
|
||||
"Set period to rescan BGP table to check if default-originate condition is met\n"
|
||||
"Period between BGP table scans, in seconds; default 5\n")
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||
|
||||
bgp->rmap_def_originate_eval_timer =
|
||||
no ? RMAP_DEFAULT_ORIGINATE_EVAL_TIMER : timer;
|
||||
|
||||
if (bgp->t_rmap_def_originate_eval)
|
||||
EVENT_OFF(bgp->t_rmap_def_originate_eval);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFPY (neighbor_advertise_map,
|
||||
neighbor_advertise_map_cmd,
|
||||
"[no$no] neighbor <A.B.C.D|X:X::X:X|WORD>$neighbor advertise-map RMAP_NAME$advertise_str <exist-map|non-exist-map>$exist RMAP_NAME$condition_str",
|
||||
@ -18620,6 +18640,12 @@ int bgp_config_write(struct vty *vty)
|
||||
" bgp conditional-advertisement timer %u\n",
|
||||
bgp->condition_check_period);
|
||||
|
||||
/* default-originate timer configuration */
|
||||
if (bgp->rmap_def_originate_eval_timer !=
|
||||
RMAP_DEFAULT_ORIGINATE_EVAL_TIMER)
|
||||
vty_out(vty, " bgp default-originate timer %u\n",
|
||||
bgp->rmap_def_originate_eval_timer);
|
||||
|
||||
/* peer-group */
|
||||
for (ALL_LIST_ELEMENTS(bgp->group, node, nnode, group)) {
|
||||
bgp_config_write_peer_global(vty, bgp, group->conf);
|
||||
@ -20248,6 +20274,9 @@ void bgp_vty_init(void)
|
||||
install_element(BGP_VPNV4_NODE, &neighbor_advertise_map_cmd);
|
||||
install_element(BGP_VPNV6_NODE, &neighbor_advertise_map_cmd);
|
||||
|
||||
/* bgp default-originate timer */
|
||||
install_element(BGP_NODE, &bgp_def_originate_eval_cmd);
|
||||
|
||||
/* neighbor maximum-prefix-out commands. */
|
||||
install_element(BGP_NODE, &neighbor_maximum_prefix_out_cmd);
|
||||
install_element(BGP_NODE, &no_neighbor_maximum_prefix_out_cmd);
|
||||
|
@ -3330,6 +3330,7 @@ static struct bgp *bgp_create(as_t *as, const char *name,
|
||||
bgp_addpath_init_bgp_data(&bgp->tx_addpath);
|
||||
bgp->fast_convergence = false;
|
||||
bgp->llgr_stale_time = BGP_DEFAULT_LLGR_STALE_TIME;
|
||||
bgp->rmap_def_originate_eval_timer = RMAP_DEFAULT_ORIGINATE_EVAL_TIMER;
|
||||
|
||||
#ifdef ENABLE_BGP_VNC
|
||||
if (inst_type != BGP_INSTANCE_TYPE_VRF) {
|
||||
|
@ -601,6 +601,7 @@ struct bgp {
|
||||
|
||||
/* timer to re-evaluate neighbor default-originate route-maps */
|
||||
struct event *t_rmap_def_originate_eval;
|
||||
uint16_t rmap_def_originate_eval_timer;
|
||||
#define RMAP_DEFAULT_ORIGINATE_EVAL_TIMER 5
|
||||
|
||||
/* BGP distance configuration. */
|
||||
|
@ -1729,6 +1729,12 @@ Configuring Peers
|
||||
and will not be displayed as part of a `show run`. The no form
|
||||
of the command turns off this ability.
|
||||
|
||||
.. clicmd:: bgp default-originate timer (0-3600)
|
||||
|
||||
Set the period to rerun the default-originate route-map scanner process. The
|
||||
default is 5 seconds. With a full routing table, it might be useful to increase
|
||||
this setting to avoid scanning the whole BGP table aggressively.
|
||||
|
||||
.. clicmd:: bgp default ipv4-unicast
|
||||
|
||||
This command allows the user to specify that the IPv4 Unicast address
|
||||
|
Loading…
Reference in New Issue
Block a user