OSPF SPF Throttling

OSPF SPF Throttling

OSPF Shortest Path First Throttling feature allows to schedule SPF calculations in milliseconds interval and delay SPF calculations during network instability. SPF runs when there is a topology change. By default, SPF interval is chosen dynamically and depends on frequency of topology changes.

The OSPF SPF Throttling is configured using the command timers throttle spf <spf-start> <spf-hold> <spf-max-wait> OSPF router configuration command.

spf-start: Initial delay to schedule an SPF calculation after a topology change. Range is 1 to 600000 milliseconds.

spf-hold: Minimum hold-time between two SPF calculations. Range is 1 to 600000 milliseconds.

spf-max-wait: Maximum wait between two SPF calculations. Range is 1 to 600000 milliseconds.

An example shows how this command works.

router ospf 1

timers throttle spf 5 1000 90000

!

The wait-interval indicates the amount of time to wait before scheduling an SPF calculation in an event of topology change; in this case, 1000 milliseconds. The wait-interval doubles when at least one topology change event is received during the previous wait-interval. Once the maximum wait-time is reached, the wait-interval remains the same until the topology stabilizes.

If the first topology change event occurs after the maximum wait-interval begins, the SPF calculation is again scheduled at the start-interval and subsequent wait-intervals are reset according to the timers throttle spf command.

Network topology:

Default behavior:

The default values for SPF calculations can be seen below.

Default timer values

R1# show ip ospf
 Routing Process "ospf 1" with ID 1.1.1.1
 Start time: 00:01:18.120, Time elapsed: 02:04:39.416
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Supports Link-local Signaling (LLS)
 Supports area transit capability
 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
!--output ommitted-------!

When R1 router first detects topology change event, it will initiate SPF calculation after 5000msec. Meanwhile, if R1 router detects another topology change, it will wait for 10000msec (5000x2) before another SPF calculation. Once wait-interval reaches maximum wait-interval 10000msec, the wait-interval remains the same until topology stabilizes.

Default behaviour

R1#
*Mar  1 02:04:39.179: OSPF: Begin SPF at 7479.180ms, process time 912ms
*Mar  1 02:04:39.179:       spf_time 02:04:34.180, wait_interval 5000ms
*Mar  1 02:04:39.183: OSPF: End SPF at 7479.184ms, Total elapsed time 4ms
*Mar  1 02:04:39.183:       Schedule time 02:04:39.184, Next wait_interval 10000ms
*Mar  1 02:04:39.187:       Intra: 4ms, Inter: 0ms, External: 0ms
*Mar  1 02:04:39.187:       R: 2, N: 1, Stubs: 2
*Mar  1 02:04:39.187:       SN: 0, SA: 0, X5: 0, X7: 0
*Mar  1 02:04:39.187:       SPF suspends: 0 intra, 0 total
R1#
*Mar  1 02:04:49.183: OSPF: Begin SPF at 7489.184ms, process time 920ms
*Mar  1 02:04:49.183:       spf_time 02:04:39.184, wait_interval 10000ms
*Mar  1 02:04:49.187: OSPF: End SPF at 7489.188ms, Total elapsed time 4ms
*Mar  1 02:04:49.187:       Schedule time 02:04:49.188, Next wait_interval 10000ms
*Mar  1 02:04:49.191:       Intra: 4ms, Inter: 0ms, External: 0ms
*Mar  1 02:04:49.191:       R: 1, N: 0, Stubs: 2
*Mar  1 02:04:49.191:       SN: 0, SA: 0, X5: 0, X7: 0
*Mar  1 02:04:49.191:       SPF suspends: 0 intra, 0 total
R1#
*Mar  1 02:04:52.407: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
R1#
*Mar  1 02:04:59.187: OSPF: Begin SPF at 7499.188ms, process time 948ms
*Mar  1 02:04:59.187:       spf_time 02:04:49.188, wait_interval 10000ms
*Mar  1 02:04:59.191: OSPF: End SPF at 7499.192ms, Total elapsed time 4ms
*Mar  1 02:04:59.191:       Schedule time 02:04:59.192, Next wait_interval 10000ms
*Mar  1 02:04:59.195:       Intra: 4ms, Inter: 0ms, External: 0ms
*Mar  1 02:04:59.195:       R: 2, N: 1, Stubs: 2
*Mar  1 02:04:59.195:       SN: 0, SA: 0, X5: 0, X7: 0
*Mar  1 02:04:59.195:       SPF suspends: 0 intra, 0 total

Changing SPF Timers:

Changing SPF Timers

R1 router:
router ospf 1
 timers throttle spf 5 1000 90000
!
R2 router:
router ospf 1
 timers throttle spf 5 1000 90000
!

This change can be verified as below.

Verifying SPF timers

R1# show ip ospf
 Routing Process "ospf 1" with ID 1.1.1.1
 Start time: 00:01:18.120, Time elapsed: 02:08:14.936
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Supports Link-local Signaling (LLS)
 Supports area transit capability
 Router is not originating router-LSAs with maximum metric
 Initial SPF schedule delay 5 msecs
 Minimum hold time between two consecutive SPFs 1000 msecs
 Maximum wait time between two consecutive SPFs 90000 msecs
!-----------output ommitted---------!

Now, when R1 router first detects topology change event, it will initiate SPF calculation in 5msec. Meanwhile, if R1 router detects another topology change, the wait-interval changes to 1000msec. If further topology changes are detected before wait-interval expires, the wait-interval doubles. If topology continues even further until maximum wait-interval 90000msec, the wait-interval remains the same (i.e. 90000msec) until the topology stabilizes.

Behavior after SPF timer changes

*Mar  1 02:08:07.807: OSPF: Begin SPF at 7687.808ms, process time 956ms
*Mar  1 02:08:07.807:       spf_time 02:08:07.800, wait_interval 5ms
*Mar  1 02:08:07.811: OSPF: End SPF at 7687.812ms, Total elapsed time 4ms
*Mar  1 02:08:07.811:       Schedule time 02:08:07.812, Next wait_interval 1000ms
*Mar  1 02:08:07.815:       Intra: 4ms, Inter: 0ms, External: 0ms
*Mar  1 02:08:07.815:       R: 1, N: 0, Stubs: 2
*Mar  1 02:08:07.815:       SN: 0, SA: 0, X5: 0, X7: 0
*Mar  1 02:08:07.815:       SPF suspends: 0 intra, 0 total
R1#
*Mar  1 02:09:14.203: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
R1#
*Mar  1 02:09:14.215: OSPF: Begin SPF at 7754.216ms, process time 984ms
*Mar  1 02:09:14.215:       spf_time 02:09:14.208, wait_interval 5ms
*Mar  1 02:09:14.219: OSPF: End SPF at 7754.220ms, Total elapsed time 4ms
*Mar  1 02:09:14.219:       Schedule time 02:09:14.220, Next wait_interval 2000ms
*Mar  1 02:09:14.219:       Intra: 4ms, Inter: 0ms, External: 0ms
*Mar  1 02:09:14.223:       R: 1, N: 0, Stubs: 2
*Mar  1 02:09:14.223:       SN: 0, SA: 0, X5: 0, X7: 0
*Mar  1 02:09:14.223:       SPF suspends: 0 intra, 0 total
R1#
*Mar  1 02:09:16.219: OSPF: Begin SPF at 7756.220ms, process time 992ms
*Mar  1 02:09:16.219:       spf_time 02:09:14.220, wait_interval 2000ms
*Mar  1 02:09:16.223: OSPF: End SPF at 7756.224ms, Total elapsed time 4ms
*Mar  1 02:09:16.223:       Schedule time 02:09:16.224, Next wait_interval 4000ms
*Mar  1 02:09:16.227:       Intra: 0ms, Inter: 0ms, External: 0ms
*Mar  1 02:09:16.227:       R: 1, N: 0, Stubs: 1
*Mar  1 02:09:16.227:       SN: 0, SA: 0, X5: 0, X7: 0
*Mar  1 02:09:16.227:       SPF suspends: 0 intra, 0 total
R1#
*Mar  1 02:09:20.223: OSPF: Begin SPF at 7760.224ms, process time 1000ms
*Mar  1 02:09:20.223:       spf_time 02:09:16.224, wait_interval 4000ms
*Mar  1 02:09:20.227: OSPF: End SPF at 7760.228ms, Total elapsed time 4ms
*Mar  1 02:09:20.227:       Schedule time 02:09:20.228, Next wait_interval 8000ms
*Mar  1 02:09:20.231:       Intra: 4ms, Inter: 0ms, External: 0ms
*Mar  1 02:09:20.231:       R: 2, N: 1, Stubs: 2
*Mar  1 02:09:20.231:       SN: 0, SA: 0, X5: 0, X7: 0
*Mar  1 02:09:20.231:       SPF suspends: 0 intra, 0 total