OSPF SPF Throttling is a feature that allows scheduling SPF runs in order to prevent abusing the router’s CPU in case there are frequent network topology changes or instabilities. The delay of the next SPF execution depends on the fact that there was a network topology change or not within the period of time, called the wait interval, between the last two consecutive SPF executions.

OSPF executes the SPF algorithm each time there is a change in the routing domain’s topology. If the network is unstable, meaning there may be one or more flapping links, a huge number of LSAs may get generated within a short timeframe causing OSPF to run SPF frequently and thus consuming a massive amount of CPU cycles and possibly disrupting other router functions or traffic in the network.

OSPF SPF throttling helps to get rid of this issue by controlling the delay between SPF runs. In fact, postponing SPF runs would reduce the impact of network instabilities and run SPF after receiving a couple of LSAs instead of executing it each time an LSA gets updated.

In this tutorial, I will be using the following network topology to demonstrate the OSPF SPF throttling feature.

Here are the initial router configurations.

Router R1 Router R2 Router R3

 

Note that OSPF supports other features that enhance network convergence such as OSPF LSA retransmission pacing, OSPF LSA flood pacing, OSPF LSA group pacingOSPF LSA throttling, and OSPF incremental SPF.

What is OSPF SPF Throttling?

OSPF Shortest Path First Throttling allows to schedule SPF runs in order to prevent abusing the router’s CPU in case there are frequent network instabilities. The delay between two consecutive SPF executions varies based on the existence of network topology changes/instabilities within a particular period of time called the wait interval.

OSPF SPF throttling uses three time-based parameters to postpone SPF runs; in other words, to configure the wait interval, which is the amount of time OSPF waits between two consecutive SPF runs. These parameters are:

  • SPF start interval: represents the initial wait interval before the first SPF execution occurs after the OSPF process gets started or the routing domain’s topology has been untouched for a long period of time greater than the SPF hold or SPF maximum wait interval.
  • SPF hold interval: the minimum amount of time that must elapse between two successive SPF executions.
  • SPF maximum wait interval: the maximum amount of time OSPF waits between two subsequent SPF executions.

How Does OSPF SPF Throttling Work?

Here are the rules that control OSPF SPF throttling:

Rule #1: When OSPF receives an updated LSA and no SPF execution is planned, OSPF adds the LSA to the OSPF database and schedules SPF so that the delay (wait interval) between the next and previous SPF runs is equal to the current SPF hold interval. For example, if the last SPF run was at 20:10:01 and the current SPF hold interval is 40sec, the next SPF run would be at 20:10:41.

Rule #2: When OSPF receives an updated LSA and an SPF execution is planned, OSPF adds the LSA to the OSPF database and waits for the SPF algorithm to be executed.

Rule #3: When SPF runs, OSPF sets the wait interval to SPF-start if the wait time is not already defined like when SPF gets executed for the first time or if OSPF did not receive LSA updates between two consecutive SPF runs or for a time period greater than the maximum wait interval. Otherwise, the wait interval is set to the current SPF hold time.

Rule #4: When SPF runs for the first time or OSPF did not receive LSA updates for a period greater than the maximum wait interval, the SPF hold parameter is set to its default value. Additionally, if OSPF did not receive LSA updates between two consecutive SPF runs, the SPF hold value does not change. Otherwise, the SPF hold interval doubles upon each SPF run.

In the next paragraphs, I demonstrate how SPF scheduling works through throttling. To achieve that, we enable OSPF debugging on router R1, and change the OSPF cost of R3’s loopback 0 interface several times at instants t, t+7, t+20, t+60, t+100, t+345, and t+720 seconds, where t is 07:25:37.952 (seven twenty-five thirty-seven seconds nine hundred fifty-two milliseconds).

The SPF start, SPF hold, and SPF max wait parameters are set to 10 sec, 20 sec, and 300 sec, respectively. Besides, OSPF SPF monitoring debugging has been enabled using the debug ip ospf monitor command in enable mode.

R1# debug ip ospf monitor
OSPF SPF monitoring debugging is on

R1#

Moreover, the first updated LSA has been received by R1 after the network topology was unchanged for more than 300 seconds, the maximum wait interval.

  • At time t (07:25:37.952), R1 receives an R3’s updated LSA, updates its LSDB with the data in the LSA, sets the wait time to the current SPF start value (10 sec), and then schedules the SPF algorithm to run at instant t + the SPF start delay (t + 10s).
*Dec 19 07:25:37.952: OSPF-1 MON  : Schedule Full SPF without microloop avoidance in area 0, change in LSA R/3.3.3.3/3.3.3.3 
*Dec 19 07:25:37.953: OSPF-1 MON  : reset throttling to 10000ms next wait-interval 20000ms
*Dec 19 07:25:37.953: OSPF-1 MON  : Schedule SPF in 10000ms: spf_time 00:44:33.305, wait_interval 10000ms
  • At time t + 7 sec (07:25:45.686), R1 receives an R3’s updated LSA and then updates the OSPF database. R3 won’t re-schedule an SPF execution because it is already planned.
*Dec 19 07:25:45.686: OSPF-1 MON  : Schedule Full SPF without microloop avoidance in area 0, change in LSA R/3.3.3.3/3.3.3.3
  • At time t + 10 sec (07:25:47.954), R1 executes SPF. The current value of the SPF hold interval is the default value, the configured one, which is 20 seconds in this case.
*Dec 19 07:25:47.954: OSPF-1 MON  : Begin SPF at 7827.454ms, process time 8411ms 
*Dec 19 07:25:47.954: OSPF-1 MON  : Last spf_time 00:44:33.305, wait_interval 10000ms 
*Dec 19 07:25:47.958: OSPF-1 MON  : Setting next wait-interval to 20000ms 
*Dec 19 07:25:47.958: OSPF-1 MON  : End SPF at 7827.458ms, Total elapsed time 4ms 
*Dec 19 07:25:47.959: OSPF-1 MON  :  Schedule time 02:10:27.458, Next wait_interval 20000ms 
  • At time t + 20 sec (07:25:58.451), R1 receives an R3’s updated LSA, updates the LSDB with the data in the LSA, and then schedules the SPF algorithm to run with a delay/wait-time of 20 sec (the current SPF hold interval) after the last SPF run. Therefore, SPF will compute the SPF tree for area 0 at instant t + 10 sec (last SPF run’s time) + current SPF hold time (20 sec), around t + 30 sec.
*Dec 19 07:25:58.451: OSPF-1 MON  : Schedule Full SPF without microloop avoidance in area 0, change in LSA R/3.3.3.3/3.3.3.3 
*Dec 19 07:25:58.452: OSPF-1 MON  : Schedule SPF in 10000ms: spf_time 02:10:27.459, wait_interval 20000ms 
  • At time t + 30 sec (07:26:08.453), R1 executes SPF and sets the SPF hold interval to 40 seconds, which is twice its previous value.
*Dec 19 07:26:08.453: OSPF-1 MON  : Begin SPF at 7847.953ms, process time 8448ms 
*Dec 19 07:26:08.454: OSPF-1 MON  : Last spf_time 02:10:27.459, wait_interval 20000ms 
*Dec 19 07:26:08.459: OSPF-1 MON  : Setting next wait-interval to 40000ms 
*Dec 19 07:26:08.459: OSPF-1 MON  : End SPF at 7847.959ms, Total elapsed time 6ms 
*Dec 19 07:26:08.460: OSPF-1 MON  :  Schedule time 02:10:47.959, Next wait_interval 40000ms 
  • At time t + 60 sec (07:26:38.614), R1 receives an R3’s updated LSA, updates the LSDB with the data in the LSA, and then schedules the SPF algorithm to run with a delay/wait-time of 40 sec (the current SPF hold interval) after the last SPF run. Therefore, SPF will compute the SPF tree for area 0 at instant t + 30 sec (last SPF run’s time) + current SPF hold time (40 sec), around t + 70 sec.
*Dec 19 07:26:38.614: OSPF-1 MON  : Schedule Full SPF without microloop avoidance in area 0, change in LSA R/3.3.3.3/3.3.3.3 
*Dec 19 07:26:38.614: OSPF-1 MON  : Schedule SPF in 10000ms: spf_time 02:10:47.961, wait_interval 40000ms 
  • At time t + 70 sec (07:26:48.615), R1 executes SPF and sets the SPF hold interval to 80 seconds, which is twice its previous value.
*Dec 19 07:26:48.615: OSPF-1 MON  : Begin SPF at 7888.115ms, process time 8515ms 
*Dec 19 07:26:48.615: OSPF-1 MON  : Last spf_time 02:10:47.961, wait_interval 40000ms 
*Dec 19 07:26:48.619: OSPF-1 MON  : Setting next wait-interval to 80000ms 
*Dec 19 07:26:48.619: OSPF-1 MON  : End SPF at 7888.119ms, Total elapsed time 4ms 
*Dec 19 07:26:48.620: OSPF-1 MON  :  Schedule time 02:11:28.119, Next wait_interval 80000ms 
  • At time t + 100 sec (07:27:18.367), R1 receives an R3’s updated LSA, updates the LSDB with the data in the LSA, and then schedules the SPF algorithm to run with a delay/wait-time of 80 sec (the current SPF hold interval) after the last SPF run. Therefore, SPF will compute the SPF tree for area 0 at instant t + 70 sec (last SPF run’s time) + current SPF hold time (80 sec), around t + 150 sec.
*Dec 19 07:27:18.367: OSPF-1 MON  : Schedule Full SPF without microloop avoidance in area 0, change in LSA R/3.3.3.3/3.3.3.3 
*Dec 19 07:27:18.369: OSPF-1 MON  : Schedule SPF in 50252ms: spf_time 02:11:28.120, wait_interval 80000ms 
  • At time t + 150 sec (07:28:08.621), R1 executes SPF and sets the SPF hold interval to 160 seconds, which is twice its previous value.
*Dec 19 07:28:08.621: OSPF-1 MON  : Begin SPF at 7968.121ms, process time 8636ms 
*Dec 19 07:28:08.621: OSPF-1 MON  : Last spf_time 02:11:28.120, wait_interval 80000ms 
*Dec 19 07:28:08.625: OSPF-1 MON  : Setting next wait-interval to 160000ms 
*Dec 19 07:28:08.625: OSPF-1 MON  : End SPF at 7968.125ms, Total elapsed time 4ms 
*Dec 19 07:28:08.626: OSPF-1 MON  :  Schedule time 02:12:48.125, Next wait_interval 160000ms 

  • At time t + 345 sec (07:31:23.194), R1 receives an R3’s updated LSA and updates the LSDB with the data in the LSA. The amount of time elapsed between instants t+150 sec (the last SPF run) and t+345 sec (the time of receiving the current R3’s LSA update) is 195 sec, which is greater than the current SPF hold interval (160 seconds) and less than the maximum wait interval (300 sec).

During this timeframe, R1 did not receive any updated LSA, thus R1 sets the wait time to the SPF start interval (10 sec) and then schedules the SPF algorithm to run with a delay of 10 sec (the current SPF start interval) after receiving the last LSA, which occurred at t + 345 sec. Therefore, SPF will compute the SPF tree for area 0 at instant t + 345 sec + current wait time, around t + 355 sec.

*Dec 19 07:31:23.194: OSPF-1 MON  : Schedule Full SPF without microloop avoidance in area 0, change in LSA R/3.3.3.3/3.3.3.3 
*Dec 19 07:31:23.195: OSPF-1 MON  : Delay throttle trigger by 10000ms next wait-interval 160000ms
*Dec 19 07:31:23.195: OSPF-1 MON  : Schedule SPF in 10000ms: spf_time 02:12:48.126, wait_interval 10000ms 
  • At time t + 355 sec (07:31:33.196), R1 executes SPF and doesn’t change the current SPF hold interval, which is equal to 160 seconds because R1 did not receive an updated LSA for a time period greater than the SPF hold interval and less than the SPF max wait interval.
*Dec 19 07:31:33.196: OSPF-1 MON  : Begin SPF at 8172.696ms, process time 8907ms 
*Dec 19 07:31:33.196: OSPF-1 MON  : Last spf_time 02:12:48.126, wait_interval 10000ms 
*Dec 19 07:31:33.200: OSPF-1 MON  : Setting next wait-interval to 160000ms 
*Dec 19 07:31:33.200: OSPF-1 MON  : End SPF at 8172.700ms, Total elapsed time 4ms 
*Dec 19 07:31:33.200: OSPF-1 MON  :  Schedule time 02:16:12.700, Next wait_interval 160000ms 
  • At time t + 720 sec (07:37:38.467), R1 receives an R3’s updated LSA and updates the LSDB with the data in the LSA. The amount of time elapsed between instants t+355 sec (the last SPF run) and t+720 sec (the time of receiving the current updated LSA) is 365 sec, which is greater than the SPF max-wait interval (300 seconds).

During this time period, R1 did not receive any updated LSA, thus R1 sets the wait time to the SPF start interval (10 sec), and then schedules the SPF algorithm to run with a delay of 10 sec (the current SPF start interval) after receiving the last LSA, which occurred at t + 720 sec. Therefore, SPF will compute the SPF tree for area 0 at instant t + 720 sec + current wait time, around t + 730 sec.

*Dec 19 07:37:38.467: OSPF-1 MON  : Schedule Full SPF without microloop avoidance in area 0, change in LSA R/3.3.3.3/3.3.3.3 
*Dec 19 07:37:38.468: OSPF-1 MON  : reset throttling to 10000ms next wait-interval 20000ms
*Dec 19 07:37:38.468: OSPF-1 MON  : Schedule SPF in 10000ms: spf_time 02:16:12.701, wait_interval 10000ms 
  • At time t + 730 sec (07:37:48.469), R1 executes SPF. The current value of the SPF hold interval is the default value (20 sec) because R1 did not receive an updated LSA for a time period greater than the SPF max wait interval.
*Dec 19 07:37:48.469: OSPF-1 MON  : Begin SPF at 8547.969ms, process time 9390ms 
*Dec 19 07:37:48.470: OSPF-1 MON  : Last spf_time 02:16:12.701, wait_interval 10000ms 
*Dec 19 07:37:48.474: OSPF-1 MON  : Setting next wait-interval to 20000ms 
*Dec 19 07:37:48.474: OSPF-1 MON  : End SPF at 8547.974ms, Total elapsed time 5ms 
*Dec 19 07:37:48.475: OSPF-1 MON  :  Schedule time 02:22:27.974, Next wait_interval 20000ms 

How Does OSPF SPF Throttling Behave by Default on Cisco IOS?

The default values for the SPF start, SPF hold, and SPF max-wait parameters on Cisco IOS are 5, 10, and 10 seconds, respectively, as indicated in the following show ip ospf command output.

R3# show ip ospf
 Routing Process "ospf 1" with ID 3.3.3.3
 Start time: 00:16:12.423, Time elapsed: 03:13:59.376
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Supports Link-local Signaling (LLS)
 Supports area transit capability
 Supports NSSA (compatible with RFC 3101)
 Supports Database Exchange Summary List Optimization (RFC 5243)
 Event-log enabled, Maximum number of events: 1000, Mode: cyclic
 Router is not originating router-LSAs with maximum metric
 Initial SPF schedule delay 5000 msecs
 Minimum hold time between two consecutive SPFs 10000 msecs
 Maximum wait time between two consecutive SPFs 10000 msecs
 


omitted output

Therefore, the wait time between two consecutive SPF computations is at most 10 seconds.

Configuring OSPF SPF Throttling on Cisco IOS

The timers throttle spf command, issued in the router configuration mode, enables the OSPF SPF throttling feature in Cisco IOS. The command requires three timer parameters, which are:

  • SPF start interval: the amount of time in milliseconds OSPF used to initialize the wait time. It varies from 1 to 600000 ms.
  • SPF hold interval: the minimum amount of time, expressed in milliseconds, that must pass between two subsequent SPF executions. This timer’s value is adjustable from 1 to 600000 ms.
  • SPF max wait interval: the maximum amount of time, in milliseconds, OSPF waits between two subsequent SPF executions. Like the last two timers, the range is from 1 to 600000 ms.

The following example configures OSPF SPF throttling on router R1 with 10, 20, and 300 seconds as the initial delay, hold, and maximum interval values, respectively.

R1(config-if)#  router ospf 1
R1(config-router)#  timers throttle spf 10000 20000 300000

The show ip ospf command displays the current configuration of the OSPF SPF throttling timers, as shown in the example below.

R1# show ip ospf
 Routing Process "ospf 1" with ID 1.1.1.1
 Start time: 00:02:47.361, Time elapsed: 00:00:08.878
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Supports Link-local Signaling (LLS)
 Supports area transit capability
 Supports NSSA (compatible with RFC 3101)
 Supports Database Exchange Summary List Optimization (RFC 5243)
 Event-log enabled, Maximum number of events: 1000, Mode: cyclic
 Router is not originating router-LSAs with maximum metric
 Initial SPF schedule delay 10000 msecs
 Minimum hold time between two consecutive SPFs 20000 msecs
 Maximum wait time between two consecutive SPFs 300000 msecs



omitted output

Related Lessons to OSPF SPF Throttling

Conclusion

I hope this blog post helps you learn something.
Now I’d like to turn it over to you:
What did you like about this tutorial?
Or maybe you have an excellent idea that you think I need to add.
Either way, let me know by leaving a comment below right now.

Mohamed Ouamer
Mohamed Ouamer is a computer science teacher and a self-published author. He taught networking technologies and programming for more than fifteen years. While he loves to share knowledge and write, Mohamed's best passions include spending time with his family, visiting his parents, and learning new things.