Concept Guide

Changing the Sampling Rate
The sflow sample-rate command, when issued in CONFIGURATION mode, changes the default sampling rate.
By default, the sampling rate of an interface is set to the same value as the current global default sampling rate. If the value entered is not a
correct power of 2, the command generates an error message with the previous and next power-of-2 value. Select one of these two
numbers and re-enter the command. (For more information on values in power-of-2, refer to Sub-Sampling.)
To change the sampling rate either globally or on an interface, use the following command.
Change the global or interface sampling rate.
CONFIGURATION mode or INTERFACE mode
[no] sflow sample-rate sample-rate
sample-rate: The range is from 256 to 8388608 for the C-Series and S-Series. The range is from 2 to 8388608 for the E-Series.
The rate must be entered in factors of 2 (for example, 4096 or 8192).
Sub-Sampling
The sFlow sample rate is not the frequency of sampling, but the number of packets that are skipped before the next sample is taken.
Therefore, the sFlow agent uses sub-sampling to create multiple sampling rates per port-pipe. To achieve dierent sampling rates for
dierent ports in a port-pipe, the sFlow agent takes the lowest numerical value of the sampling rate of all the ports within the port-pipe and
congures all the ports to this value. The sFlow agent is then able to skip samples on ports where you require a larger sampling rate value.
Sampling rates are congurable in powers of two. This conguration allows the smallest sampling rate possible on the hardware and also
allows all other sampling rates to be available through sub-sampling.
For example, if Tengig 1/0 and 1/1 are in a port-pipe, and they are congured with a sampling rate of 4096 on interface Tengig 1/0, and 8192
on Tengig 1/1, the sFlow agent does the following:
1 Congures the hardware to a sampling rate of 4096 for all ports with sFlow enabled on that port-pipe.
2 Congures interface Tengig 1/0 to a sub-sampling rate of 1 to achieve an actual rate of 4096.
3 Congures interface Tengig 1/1 to a sub-sampling rate of 2 to achieve an actual rate of 8192.
NOTE
: Sampling rate backo can change the sampling rate value that is set in the hardware. This equation shows the
relationship between actual sampling rate, sub-sampling rate, and the hardware sampling rate for an interface:
Actual sampling rate = sub-sampling rate * hardware sampling rate
Note the absence of a congured rate in the equation. That absence is because when the hardware sampling rate value on the port-
pipe exceeds the congured sampling rate value for an interface, the actual rate changes to the hardware rate. The sub-sampling rate
never goes below a value of one.
Back-O Mechanism
If the sampling rate for an interface is set to a very low value, the CPU can get overloaded with ow samples under high-trac conditions.
In such a scenario, a binary back-o mechanism gets triggered, which doubles the sampling-rate (halves the number of samples per
second) for all interfaces. The backo mechanism continues to double the sampling-rate until the CPU condition is cleared. This is as per
sFlow version 5 draft. After the back-o changes the sample-rate, you must manually change the sampling rate to the desired value.
As a result of back-o, the actual sampling-rate of an interface may dier from its congured sampling rate. You can view the actual
sampling-rate of the interface and the congured sample-rate by using the show sflow command.
794
sFlow