Comments (2)
Analysis:
Sonic uses a moving average over a 10 second period, with polling every 1 second to calculate the moving average for Rx/Tx bps and pps and link utilization.
The script that calculates the rate is at: https://github.com/sonic-net/sonic-swss/blob/master/orchagent/port_rates.lua
With line rate of 400Gbps, subtracting the interframe gap of 0.24ns, one cannot achieve 100 utilization rate, since the utilization rates are for L2 rates and not L1.
A 0.24 ns adds an equivalent of 12B overhead for every packet, in addition to 7 byte preamble and 1 byte start-of-frame delimiter Ref: Interpacket gap
Thus, for 400G interface, the Rx Util can be: 8192/(8192+20) = 99.75%
SONiC logic:
Default values of parameters (configurable)
Counterpoll interval: 1 sec
Smoothing interval for port: 10 seconds (config rate smoothing-interval port), determines the weight in calculating averages
Calculated values :
port_alpha = 2.0/(smooth_interval + 1) = 0.18, using the default smooth_interval of 10 seconds
The (rx) bps is calculated using the moving average as:
new_rx_bps = (current SAI_PORT_STAT_IF_IN_OCTETS - previous SAI_PORT_STAT_IF_IN_OCTETS ) / counter_poll_interval_sec * 8 # read every counter_poll interval
retrieve old_rx_bps from last iteration
rx_bps = port_alpha * new_rx_bps + (1 – port_alpha) * old_rx_bps
Save the calculated value as old_rx_bps for next run
Accuracy can be changed by config tuning:
Tune port_alpha (Increase smoothing interval to reduce recency bias. Decrease smoothing interval to reduce increase recency bias)
Tune counter_poll interval
larger interval will average out the traffic and not show the peak/instantaneous rates
small interval (e.g. 1 second causes more variability as the slight drift in polling time has a larger impact)
Some examples:
counterpoll port interval 1 second, smoothing interval of 10 seconds (port alpha 0.18), RX_UTIL oscillates in [83%, 107%]
counterpoll port interval 10 second, smoothing interval of 1 seconds (with port alpha 1), RX_UTIL oscillates in [99.74%, 99.79%]. This is very close to 99.75% theoretical value.
from sonic-buildimage.
viz: @neethajohn @kevinwangsk
from sonic-buildimage.
Related Issues (20)
- [PINS] [P4RT] Failed to validate P4Info. PacketIO metadata not supported by P4Info. HOT 1
- BGP State Change Does not Trigger BGP State Event HOT 1
- [202405][DNX] orchagent exited because of failing to set SAI_NEIGHBOR_ENTRY_ATTR_IS_LOCAL HOT 9
- Port stats - negative rate counters after speed change HOT 3
- [Micas]platform M2-W6510 standardization by using native Linux kernel drivers HOT 1
- Telemetry Swss Events are not Triggered HOT 1
- [MCLAG L2 Scenario] Interface Mac address update fails. system mac of active dut is not same as standby
- /lib/systemd/systemd-networkd-wait-online command fails on host
- GNMI Server Needs Support for Multi-Asic For COUNTERS_DB Query
- [sonic_package_manager] Bug in sonic-installer install with package migrate
- [Smartswitch] Orchagent is crashing when the MGMT_VRF is enabled HOT 1
- [Broadcom-DNX] Pause frames sent for Priority 0 traffic with new MMU buffer settings.
- [Broadcom-DNX] Intermittent lossless packet drop seen with Pause storm on egress port and latest MMU buffer settings.
- Gnmi Client Access Fails with Server after Rotating Telemetry Certificates HOT 4
- Missing YANG model for new added attribute related to fabric link monitoring HOT 1
- [202405] delayed ssh service start due to dependency caused by banner-config service HOT 2
- [202305][warm-reboot]: BGP Graceful-Restart timeout is reached due to hostcfgd failed with graceful shutdown
- Build Error in SONiC master branch
- Ethernet RIF counters being reported as ifInErrors in SNMP
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sonic-buildimage.