Network Monitoring and Performance Questions
Network telemetry and performance operations: SNMP polling and traps (including counter wraparound and SNMPv3 access), NetFlow, sFlow and IPFIX flow export, sampling and its accuracy, streaming telemetry (gNMI), and eBPF or packet-capture telemetry; interface-level metrics (utilization, errors, discards, queue depth, microbursts), active synthetic probing alongside passive counters, link-flap detection, baselining and anomaly detection on network signals including elephant-flow spotting, network SLIs and SLOs, alerting, alert-storm suppression and NOC dashboards, telemetry pipeline design, storage, retention, downsampling and cardinality for network data (including securing the collection path and handling bursty remote sites), BGP and link-state monitoring including prefix hijack and route-leak detection, and network capacity monitoring, percentile utilization and bandwidth headroom planning. Also covers measuring and tuning network-level latency, jitter, packet loss and throughput (bufferbloat, queueing, TCP tuning for long paths). Excludes the generic metrics, logs and traces stack and alert design, the layered fault-isolation method and packet-capture troubleshooting, TCP and protocol fundamentals, application and CDN latency engineering, cloud VPC design and security detection.
A link between two routers flaps intermittently. How would you detect and alert on flapping reliably, avoid paging for every bounce, and tell a flap from a genuine outage?
Sample Answer
Direct answer
Treat "link is down" and "link is flapping" as two different alerts built from different questions. The rules below are written for Prometheus (a monitoring system that stores metrics as time series and evaluates alert expressions) and routed by Alertmanager (its companion that groups, deduplicates and delivers the notifications). An outage is one continuous state: the interface has been down for a set time (3 minutes here). A flap is a pattern: six or more state changes inside 15 minutes (three down-and-up bounces), whatever state it is in now. Page a human for the outage. Open a ticket for the flap, hold it open through the brief up periods so it does not resolve and re-fire every bounce, and suppress it while a real outage is already paging for the same interface. Then find the cause by comparing both ends, the error counters and the optics, because a flap is usually physical.
Detecting reliably: three signals, each with a blind spot
| Signal | What it gives | Blind spot |
|---|---|---|
| Polled state (ifOperStatus from the interface MIB, 1 = up, 2 = down, polled every 30 s) | Easy to alert on and graph | A bounce shorter than the poll interval can leave the state "up" at both polls |
| ifLastChange (the sysUpTime value when the interface entered its current state, RFC 2863) | Moves on every transition, so a short bounce still shows | Several bounces between two polls look like one change. It resets when the device reinitializes, giving one false change |
| Event stream: linkDown and linkUp traps, syslog, or a gNMI (gRPC Network Management Interface) ON_CHANGE subscription (the device sends an update only when a value changes) | One event per transition, with the device's own timestamp | Traps and syslog are commonly sent over UDP and can be lost, so reconcile with polling |
Use polled state for alerting, and the event stream as the exact count and timeline when you investigate. Do not treat an absence of polled changes as proof of a stable link.
Alert rules
groups:
- name: link-health
rules:
- alert: LinkDown
expr: ifOperStatus{ifAlias=~"UPLINK:.*"} == 2 and on (instance, ifIndex) ifAdminStatus == 1
for: 3m
labels:
severity: page
annotations:
summary: "{{ $labels.instance }} {{ $labels.ifName }} down for 3 minutes"
- alert: LinkFlapping
expr: changes(ifOperStatus{ifAlias=~"UPLINK:.*"}[15m]) >= 6
keep_firing_for: 20m
labels:
severity: ticket
annotations:
summary: "{{ $labels.instance }} {{ $labels.ifName }} changed state {{ $value }} times in 15 minutes"
changes()is a Prometheus function that returns the number of times a series' value changed in the window. Each down and each up counts as one, so 6 means three bounces.- The
for: 3mclause keeps an alert pending until the condition has held across 3 minutes of evaluations. A flap whose down periods are shorter than 3 minutes therefore never pages as an outage. keep_firing_for: 20mkeeps the flap alert firing after its condition last held, so the up phases between bounces do not resolve it and send another notification.ifAdminStatus == 1(administratively enabled) excludes ports an operator shut on purpose: a port that is administratively down also shows operational state down.and on (instance, ifIndex) ifAdminStatus == 1joins two series: theon (...)list says to pair samples that have the same device and interface index, so each interface's operational status is compared with its own admin status.- The
ifAlias=~"UPLINK:.*"selector assumes a naming convention that marks monitored links in the interface description. Use whatever your source of truth makes reliable.
Worked check: a 30-second poll series 1 1 2 1 1 1 2 1 1 2 1 1 (1 up, 2 down) holds one sample per 30 s, at t = 0, 30, 60 and so on to 330 s. The values change at t = 60, 90, 180, 210, 270 and 300 s, so the sixth change is at t = 300 s, and the series has six changes by the 5-minute mark, so LinkFlapping fires at 5 minutes with value 6. A link that goes down once and stays down has one change and never reaches the flap threshold, but fires LinkDown 3 minutes after it fell. A link whose state is 2 but whose ifAdminStatus is 2 fires neither.
Not paging for every bounce
route:
receiver: noc
group_by: [instance]
group_wait: 30s
group_interval: 5m
repeat_interval: 4h
routes:
- matchers: ['severity="page"']
receiver: pager
inhibit_rules:
- source_matchers: ['alertname="LinkDown"']
target_matchers: ['alertname="LinkFlapping"']
equal: [instance, ifName]
- Inhibition means a firing alert can silence a related one. Grouping by
instancemeans a line card failure that downs 24 links produces one notification for the device, not 24.group_wait(default 30 s) holds the first notification so related alerts arrive together,group_interval(default 5 minutes) spaces later updates for the same group, andrepeat_interval(default 4 hours) spaces reminders. - The inhibition rule suppresses
LinkFlappingfor an interface whileLinkDownis firing for the same instance and interface, because the outage page already covers it. - Only
severity="page"goes to the pager. The flap goes to the network operations center (NOC) queue as a ticket, so a link that bounces ten times overnight leaves one ticket, not ten pages.
Telling a flap from a genuine outage
| Observation | Flap | Outage |
|---|---|---|
| Operational state over 15 min | Repeated 1, 2, 1, 2 | One transition to 2 and staying there |
| Routing adjacencies (the neighbor sessions between routers) and traffic | Come and go, reconverge (recompute their routes) each time | Gone until fixed, traffic on the backup path |
| Error counters before the event | Often climbing (CRC, cyclic redundancy check, a checksum failure that signals a corrupted frame, and other input errors) | May be clean (a cut or power loss) |
| Alert | LinkFlapping, ticket | LinkDown, page |
Both can be true in sequence: a flapping link can end as an outage when the optic or cable finally fails, which is why the flap ticket matters.
Finding the cause, in order
- Compare both ends' logs. The same instant on both sides suggests the cable, patch panel (a rack of sockets where cables are cross-connected) or the optical path between them. One side logging link loss while the other stays up suggests that side's port or transceiver, or the far end's transmitter. The transceiver (also called the optic) is the pluggable module that turns the switch's signal into light or electrical signal on the cable, and a line card is a removable board holding a group of ports.
- Read the error counters. ifInErrors rising before each bounce points at signal quality (dirty fiber, damaged cable, bad optic).
- Read the optical power levels the transceiver reports (digital optical monitoring, DOM): transmit or receive power drifting near the limits explains flaps without any counter errors.
- Look at the timing. Intervals that repeat almost exactly (say every 40 seconds) suggest a protocol or timer, a negotiation loop or a power cycle. Random intervals suggest a physical fault.
- Change one thing. Swap the patch cable, then the optic, then move the port, and watch that the flap count over the next 15 minutes stays under the threshold.
Verify the fix
Run changes(ifOperStatus{...}[1h]) and expect 0 over a full hour, check the error counters are not rising, and let the keep_firing_for period elapse so the ticket clears on its own.
Users in one office get slow, odd behavior that you suspect is asymmetric routing. What passive data would you use to confirm it, and how would you alert on it going forward?
Sample Answer
Direct answer
Asymmetric routing means the forward traffic and the return traffic take different paths. It is often harmless, but it breaks things when a stateful device (a firewall or NAT, network address translation, which keeps per-connection state) sees only one direction and drops what does not match a session it knows. The passive evidence I would use: flow records from the office's edge devices, interface byte counters, firewall logs for drops with no matching session, and TCP symptoms from capture or host statistics. Going forward I would alert on a per-office asymmetry index only when it coincides with drops or retransmits.
What the passive data shows
- Flow records (NetFlow or IPFIX, summaries of conversations that routers export) from every edge device. Flows are recorded per direction (the IPFIX Biflow document, RFC 5103, distinguishes a Uniflow, one direction, from a Biflow, both). For one conversation, the outbound record should appear on the same device and interface as the inbound reply. If the outbound flow is on edge A and the reply is on edge B, the path is asymmetric.
- Interface counters (SNMP, the Simple Network Management Protocol, IF-MIB, RFC 2863, using 64-bit ifHCInOctets and ifHCOutOctets). On a pair of parallel links, one that sends a lot and receives almost nothing, while its sibling does the reverse, matches asymmetry.
- Firewall logs. Drops with a "no matching session" or "invalid TCP state" style reason (wording varies by vendor) for traffic that was legitimate. A reply arriving on a firewall that never saw the SYN (the first packet of a TCP connection, the 'synchronize' request) is the classic case.
- TCP evidence. A capture at the edge showing SYN leaving but SYN-ACK arriving elsewhere, or host retransmit counters rising (a retransmit is a segment the sender had to send again because no acknowledgement arrived) (
ss -tiper socket,nstatfor kernel counters).
Worked example: computing the index from flow records
# Flow records exported by two office edge routers: (exporter, direction, src, sport, dst, dport)
flows = [
("edgeA", "out", "10.1.1.10", 51000, "203.0.113.5", 443),
("edgeA", "in", "203.0.113.5", 443, "10.1.1.10", 51000), # symmetric
("edgeA", "out", "10.1.1.11", 51001, "203.0.113.5", 443),
("edgeB", "in", "203.0.113.5", 443, "10.1.1.11", 51001), # reply on the other router
("edgeA", "out", "10.1.1.12", 51002, "203.0.113.9", 443),
("edgeB", "in", "203.0.113.9", 443, "10.1.1.12", 51002), # reply on the other router
("edgeA", "out", "10.1.1.13", 51003, "203.0.113.9", 22), # no reply seen at all
]
outs = {(s, sp, d, dp): ex for ex, dr, s, sp, d, dp in flows if dr == "out"}
# A reply has its source and destination swapped, so key it with src/dst swapped back (the forward tuple)
# to line it up with the outbound record of the same conversation.
ins = {(d, dp, s, sp): ex for ex, dr, s, sp, d, dp in flows if dr == "in"}
same = diff = missing = 0
for key, ex in outs.items():
if key not in ins:
missing += 1
elif ins[key] == ex:
same += 1
else:
diff += 1
total = len(outs)
print("conversations", total, "same", same, "different_router", diff, "no_reply_seen", missing)
print("asymmetry index", round(diff / (same + diff), 2))
Output:
conversations 4 same 1 different_router 2 no_reply_seen 1
asymmetry index 0.67
The index is conversations whose reply came back through a different router, divided by conversations with both directions seen: 2 / (1 + 2) = 0.67. In the code the inbound record is keyed with source and destination swapped back, because a reply travels the opposite way and would otherwise never match its outbound record. The 22/tcp conversation with no reply seen is counted separately because it is a different symptom (a reply dropped or lost).
Alerting going forward
- Compute the index per office every 5 minutes from flows, joining on the swapped 5-tuple (source and destination addresses and ports, plus protocol) within a short time window.
- Alert only when the index is well above that office's own baseline AND firewall no-session drops are above zero or the retransmit ratio (retransmitted segments divided by segments sent) is up, for 3 consecutive intervals. Some asymmetry is normal (for example hot-potato routing: each provider hands traffic to the next network at its nearest exit, so the return path can differ from the outbound path) and harmless if no stateful device sits in both paths.
- Routing: asymmetric and dropping opens a high-priority ticket; asymmetric alone stays on the dashboard.
Fix direction (so the alert leads somewhere)
Make return traffic follow the forward path: adjust routing policy so both directions use the same edge, or move the stateful inspection to where both paths converge, or sync state between the firewalls in a cluster. I verify with the same index dropping toward baseline and the drops stopping.
Pitfalls
- Sampled flow data (the router records only 1 in every N packets) can miss the reply of a small conversation, so use enough volume per interval rather than single connections.
- Clock differences between exporters can break the time-window join; keep NTP (Network Time Protocol) consistent.
- Treat asymmetry as a symptom only when something stateful is in the path.
Compare NetFlow, sFlow and IPFIX: how each produces its records, what a record contains, how sampling works in each, and when you would pick one over another.
Sample Answer
Direct answer
All three summarise traffic as per-conversation records so you can answer "who talked to whom, how much, over which path" without capturing packets. NetFlow (Cisco-originated) and IPFIX (IP Flow Information Export, the IETF standard that evolved from NetFlow v9) track flows in a flow cache (a table in the device's memory with one entry per active flow) on the device and export a record when each flow ends or ages out. sFlow keeps no flow cache: it samples one in every N packets (a header snippet) plus periodic interface counters, and leaves flow assembly to the collector. Pick by what your devices support: IPFIX when the fleet is mixed and supports it, NetFlow v9 on Cisco-centric estates, sFlow where the platform offers only sFlow (check the data sheet per platform and software release).
How each produces records
NetFlow v9 (RFC 3954). A flow is "a unidirectional sequence of packets with some common properties that pass through a network device". The exporter keeps a flow cache. A flow record is exported when a TCP FIN or RST (the packets that close or abort a connection) is seen, when the flow has been inactive for a configured timeout, or, for long-lasting flows, on a regular basis (the active timeout). Records are sent over UDP to the collector. The "version 9" format is template-based: the exporter first sends a template describing which fields follow, then data records using that template.
IPFIX (RFC 7011). Same model, standardised: version field 0x000a (one above NetFlow v9), Template Sets define record layouts, Data Sets carry the records, Options Template Sets define records that describe the exporter itself instead of a flow (for example "sampling 1 in 1,000"). Transport is more serious than v9: SCTP (Stream Control Transmission Protocol, a reliable message-oriented transport, used with its partial-reliability extension PR-SCTP) MUST be implemented by every compliant implementation, while TCP and UDP MAY also be implemented. Over UDP, templates must be re-sent periodically because UDP gives no reliability.
sFlow (version 5 specification, sflow.org). An agent in the switch ASIC (the forwarding chip) does two jobs, with no flow cache:
- Flow samples: randomly select roughly one in N packets. The sample carries the first bytes of the packet header, the original frame length, the sampling rate, the sample pool (the running count of all packets that could have been sampled, so the collector can tell how many packets the samples stand for), a drop count (how many times the agent skipped a packet it had chosen because it ran out of resources) and the input and output interfaces.
- Counter samples: poll interface counters on a timer and export them, so you also get utilisation without SNMP.
The registered UDP port is 6343.
What a record contains
| NetFlow v9 | IPFIX | sFlow v5 | |
|---|---|---|---|
| Unit | Aggregated flow (many packets) | Aggregated flow, any fields the template defines | Individual sampled packet, plus counters |
| Typical fields | IP addresses, packet and byte counts, timestamps, ToS (type of service, the header byte that marks priority), ports, input and output interfaces | Same, plus a registry of standard information elements (the named, numbered fields IPFIX defines, such as sourceIPv4Address) and vendor-defined ones | Raw header bytes, frame length, sampling rate, interfaces, counters |
| Flexibility | Template per exporter | Template per exporter, standardised | Layouts fixed in the specification; new record types can be added and decoders skip types they do not know |
| Collector work | Light (already aggregated) | Light | Heavier (decodes headers, builds flows) |
One flow, three ways. The values are illustrative; the field names are the real ones (RFC 3954 field types, the IANA IPFIX registry and the sFlow v5 specification). Take one TCP conversation from 192.0.2.10 port 51514 to 198.51.100.7 port 443 that carried 1,260 packets and 1,512,000 bytes:
NetFlow v9 data record IPFIX data record sFlow v5 flow sample (ONE packet)
IPV4_SRC_ADDR 192.0.2.10 sourceIPv4Address 192.0.2.10 sampling_rate 1000
L4_SRC_PORT 51514 sourceTransportPort 51514 sample_pool 52000
IPV4_DST_ADDR 198.51.100.7 destinationIPv4Address 198.51.100.7 drops 0
L4_DST_PORT 443 destinationTransportPort 443 input / output 12 / 7
PROTOCOL 6 (TCP) protocolIdentifier 6 frame_length 1514
TCP_FLAGS 0x1b tcpControlBits 0x001b header first bytes of the
IN_PKTS 1260 packetDeltaCount 1260 packet (Ethernet, IP, TCP)
IN_BYTES 1512000 octetDeltaCount 1512000
FIRST/LAST_SWITCHED (uptime ms) flowStart/EndMilliseconds (clock)
INPUT_SNMP / OUTPUT_SNMP 12 / 7 ingressInterface / egressInterface 12 / 7
Read it as follows. The first two columns are one finished conversation with its totals: who, which ports, which protocol, the OR of every TCP flag seen (0x1b is FIN, SYN, ACK and PSH bits together), how many packets and bytes, when it started and ended, and which interfaces it entered and left (as SNMP interface index numbers). The two formats carry nearly the same fields; the difference is that NetFlow v9 timestamps are the router's uptime in milliseconds while IPFIX can carry absolute clock time. The sFlow sample is only one packet that happened to be picked: its header bytes let the collector read the addresses and ports itself, and sampling_rate 1000 tells it that this packet stands for about 1,000 packets, so it credits roughly 1,514 x 1,000 = 1,514,000 bytes to this conversation (a statistical estimate, not a count).
How sampling works in each
- NetFlow v9 exports its sampling configuration in the record stream through
SAMPLING_INTERVAL(field 34) andSAMPLING_ALGORITHM(field 35); the algorithm is deterministic (0x01) or random (0x02). The collector multiplies counts by the interval. - IPFIX carries the same kind of metadata in Options Template data, so a collector can scale counts per exporter.
- sFlow puts the rate in every flow sample (
sampling_rate), so the collector can scale each packet by N without trusting configuration files.
Sampling accuracy is statistical, not a vendor setting. sFlow's packet-sampling note gives the 95% percentage error as about 1.96 x sqrt(1/c), where c is the number of samples in the traffic class you are estimating. Where it comes from: counting c random events has a typical wobble of about sqrt(c), so the relative wobble is sqrt(c) / c = 1/sqrt(c), and 1.96 is the number of such wobbles that covers 95 percent of outcomes on a bell curve. The accuracy depends on samples collected, not on the sampling rate alone:
| Samples c | Error (95%) |
|---|---|
| 50 | 27.7% |
| 400 | 9.8% |
| 10,000 | 1.96% |
Worked example: at 1-in-1,000 sampling, a collector sees 50 samples of a customer's traffic, each 1,500 bytes. Estimate: 50 x 1,000 x 1,500 = 75,000,000 bytes, with an error of about 27.7%, so the true value is plausibly 54 to 96 MB. To tighten to about 10% for that class you need around 400 samples: either more traffic or a lower N. Sampling is also blind to small flows: a 10-packet flow at 1-in-1,000 has a probability of 1 - (1 - 0.001)^10 = 1.0% (0.9955%) of being sampled at all, which matters for scan and attack detection.
When to pick which
| Need | Choice | Why |
|---|---|---|
| Per-flow accounting, billing-style totals, security forensics on routers | NetFlow v9 or IPFIX, unsampled or lightly sampled | Complete records of who and how much |
| Multi-vendor estate, one collector | IPFIX | Standard record format and reliable transports |
| Line-rate switches at 25/100 Gbit/s where a cache is costly | sFlow | Stateless sampling, plus counters in the same stream |
| Utilisation and top talkers across hundreds of ports | sFlow (or sampled IPFIX) | Cheap, scalable, statistical |
My default: sampled flow on edges and uplinks, IPFIX where it is available, sFlow where it is the only option, and never as the only telemetry (flow tells you about traffic, not device health).
Trade-offs and pitfalls
- A flow cache on a busy router costs memory and CPU, and a cache that fills starts losing flows; sampling or shorter timeouts relieve it.
- Over UDP, an IPFIX or NetFlow v9 collector that restarts has no templates until the exporter re-sends them, so records are undecodable for a while.
- Collector and exporter must agree on the sampling rate, or every volume number is off by that factor.
- Flow data records a flow once per observation point (the place where packets are watched, such as one interface), so enabling export on both ends of a link double-counts when you add the sites up.
Tell me about a time you diagnosed and resolved a network performance or latency problem. What did the monitoring show, who did you work with, and what changed afterward?
Sample Answer
Direct answer
A strong answer is one concrete incident told in four moves: the symptom and why it mattered, what the monitoring data showed (and what it could not show), the specific actions you took and who else you pulled in, and what changed permanently afterward, followed by a short reflection on what you would do differently. Keep it first-person and name the metrics you looked at. Below is the shape, then a worked example you can replace with your own facts.
Structure to follow
- Situation (2 sentences). Who was affected, what they saw, how it was reported (users, an alert, a customer ticket) and the business stake.
- What the monitoring showed. Name the signals: interface utilization, output drops and errors, queue depth, round-trip latency and jitter (how much the delay varies from packet to packet) from a synthetic probe (a scripted test that sends fake traffic on a schedule), flow records (per-conversation summaries exported by routers: who talked to whom and how many bytes). Say honestly what the monitoring missed at first; the interesting part of most stories is a blind spot.
- Your actions, and who you worked with. The order of your checks, the hypothesis you ruled out, and the people you needed (an application owner, the carrier, a server or virtualization team, a security colleague) and what you asked each of them for.
- Result and what changed. The fix, how you proved it worked (the same measurement before and after), and the lasting change: a new alert, a shorter polling interval on that link, a runbook, a design change.
- Reflection. One thing you would do differently, stated as a behaviour ("I would have asked for per-second counters on day one"), not a virtue.
Example story (replace with your own facts)
Situation. A branch office reported that video calls froze for a few seconds every morning around the same time. The branch had a 1 Gbit/s WAN (wide-area network) link and the dashboard, which polls interface counters every 5 minutes, showed the link comfortably under half full.
What the monitoring showed. The 5-minute utilization graph looked healthy, but the interface's output-discard counter (packets the router dropped because its queue was full) was increasing. That contradiction was the clue: a 5-minute average of 400 Mbit/s is equally consistent with a steady 400 Mbit/s and with 20 seconds at 1,000 Mbit/s plus 280 seconds at about 357 Mbit/s (400 x 300 = 120,000 megabits in the window; the burst accounts for 20 x 1,000 = 20,000, so 120,000 - 20,000 = 100,000 remain; 100,000 / 280 s = 357). Drops with a calm average mean the link was saturating in short bursts the polling interval averaged away.
Actions and collaboration. I temporarily polled the counters every few seconds on that one link, which confirmed full-rate bursts of tens of seconds. I read the flow records for those minutes and found a scheduled file-sync job from the branch file server dominating the bursts, so I worked with the server owner to confirm the job's schedule, and with the application team on which traffic class the video calls used. The queueing policy on the router (its rules for which packets wait, and which are dropped, when the link is full) gave video and file-sync the same default treatment, so video packets were dropped alongside bulk traffic.
Result. We moved the sync job off the morning peak, put video in a priority class (a queue the router serves first, with a guaranteed share of the link) with a bandwidth guarantee and bulk sync in a lower class, and confirmed the fix with the same measurements that exposed the problem: the output-discard counter stopped increasing during the sync window and the synthetic call probe's jitter stayed flat. Afterward I added an alert on output discards (not only on average utilization) for all WAN links and a one-minute polling interval for links with a history of bursts.
What I would do differently. I would have asked the branch to open a ticket with timestamps on day one; matching their timestamps to counters would have shortened the investigation.
Pitfalls
- Do not present a story with no data in it ("I looked at the monitoring and found the problem"). Name the counter or probe and what its value told you.
- Do not claim sole credit. A network performance problem almost always crosses a team boundary, and the interviewer is listening for how you worked across it.
- Do not invent precise before-and-after numbers you cannot defend. A qualitative outcome you can prove ("drops stopped, jitter flat for two weeks") beats a fabricated percentage.
What is bufferbloat? Explain how it hurts latency and jitter under load, how you would detect it in production, and how you would mitigate it.
Sample Answer
Direct answer
Bufferbloat is excess latency caused by queues that are too deep at a bottleneck link. When something keeps sending faster than the link can drain (a bulk TCP transfer), the buffer fills, packets wait in it, and every other flow sharing that queue (voice, video, a web click) waits too. Because TCP loss-based congestion control (the sender keeps speeding up until a packet is lost, and only then slows down) only slows down when it sees a drop, a huge buffer delays the drop signal and lets the queue stay full. The fix is to put the queue where you control it and keep it short: shape traffic slightly below the bottleneck rate and use an active queue management (AQM) algorithm, which drops or marks packets early so the queue stays short, with flow isolation, which gives each flow its own queue so a bulk transfer cannot delay a small flow, such as FQ-CoDel or CAKE.
How it hurts latency and jitter
The delay a packet adds at a full queue is the queue size divided by the link rate:
queue delay=link rate (bit/s)buffer bytes×8
Worked example: a 20 Mbit/s uplink with a 1,000,000-byte buffer. A full buffer adds 1,000,000 x 8 / 20,000,000 = 0.4 seconds, 400 ms, on top of a 20 ms base round-trip time (RTT). The bandwidth-delay product (BDP), the amount of data in flight needed to keep the link busy, is 20,000,000 x 0.02 / 8 = 50,000 bytes. The buffer is 1,000,000 / 50,000 = 20 times the BDP, so far more queue than needed to keep the link full.
Jitter (variation in delay) comes from the queue occupancy changing: when a transfer starts the queue grows toward 400 ms, when TCP backs off it drains, and a voice packet arriving at each moment sees a different wait. An idle link shows 20 ms steadily and a busy one swings between 20 ms and about 420 ms.
Detecting it in production
- Compare latency idle versus loaded. Run continuous active probes (ping or an ICMP/TCP probe) through the suspect link and plot RTT against link utilization. Bufferbloat shows as RTT that climbs with utilization and falls back when it drops, with little or no packet loss until the buffer overflows.
- Run a controlled test. Flent's RRUL test (Realtime Response Under Load, the standard Bufferbloat project chart showing download and upload speeds plus latency) loads the link in both directions while measuring latency:
flent rrul -p all_scaled -l 60 -H <netserver-address> -o result.png. It requires netperf (a network benchmarking tool) and its netserver (the listening program) on the far side. A simpler version is to ping across the link during a large transfer and compare with an idle ping. - Read the queue itself. On a Linux router,
tc -s qdisc show dev eth0prints the backlog (bytes and packets waiting) and drops for the queue discipline (qdisc, the rule set that decides how packets wait in a queue and leave it). A persistently large backlog on the egress interface (the outbound side) during complaints is direct evidence. On other platforms use queue depth or occupancy counters if the device exports them through SNMP or streaming telemetry. - Correlate with complaints. Calls choppy exactly when a backup or software update runs is the signature. For example, plot ping RTT beside link utilization: RTT sits near 20 ms all morning, jumps to several hundred milliseconds at 09:05 when a backup job starts, and drops back at 09:20 when it finishes. That matching shape is the evidence, and the calls that broke up during those 15 minutes are the complaints it explains.
What the queue looks like in tc output
The worked example can be reproduced in a Linux container (debian:12 with NET_ADMIN) on its loopback interface, which has no real bottleneck, so the script creates one: the interface MTU set to 1500, a token-bucket shaper (tbf, which releases packets at a fixed rate) at 20 Mbit/s with a 1,000,000-byte limit, and a 15 s TCP iperf3 transfer in the background, with ping before and during the transfer.
#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq && apt-get install -y -qq iproute2 iperf3 iputils-ping
ip link set lo mtu 1500
echo "# idle"
ping -c 5 -i 0.2 127.0.0.1 | tail -1
tc qdisc replace dev lo root tbf rate 20mbit burst 4kb limit 1000000
iperf3 -s -D
sleep 1
iperf3 -c 127.0.0.1 -t 15 > /dev/null &
sleep 5
echo "# loaded"
tc -s qdisc show dev lo
ping -c 5 -i 0.2 127.0.0.1 | tail -1
wait
Save it as bloat-demo.sh and run it with docker run --rm --cap-add NET_ADMIN -v "$PWD":/w -w /w debian:12 bash bloat-demo.sh. Counters and round-trip times differ on every run; the printout below is one run, and two other runs showed backlogs of 84,462 and 143,706 bytes and average loaded RTTs of about 98 and 100 ms.
This is the printed output of such a run:
# idle
rtt min/avg/max/mdev = 0.014/0.036/0.050/0.013 ms
# loaded
qdisc tbf 8028: root refcnt 2 rate 20Mbit burst 4Kb lat 398ms
Sent 12157962 bytes 11874 pkt (dropped 0, overlimits 9895 requeues 0)
backlog 130406b 111p requeues 0
rtt min/avg/max/mdev = 90.140/110.183/136.692/21.185 ms
Reading it line by line. rate 20Mbit is the drain speed, and lat 398ms is the worst-case wait the 1,000,000-byte limit allows, matching the 400 ms worked above (1,000,000 x 8 / 20,000,000). Sent is the cumulative traffic that has left the queue (about 12.2 MB, which is what 20 Mbit/s, 2.5 MB/s, delivers in the roughly 5 seconds since the transfer started), and dropped counts packets thrown away because the queue was full (zero here, because loopback applies back-pressure to the sender before the queue overflows). backlog 130406b 111p is the part that diagnoses bufferbloat: 130,406 bytes in 111 packets are waiting right now, which at 20 Mbit/s is 130,406 x 8 / 20,000,000 = 0.052 s, about 52 ms of delay added for every packet behind them. A healthy queue shows a backlog near zero. The two ping lines confirm it from outside: idle RTT is 0.036 ms and loaded RTT is about 110 ms, a rise of over 100 ms. A ping crosses this loopback queue twice (request and reply both use it), so roughly two passes of the 52 ms backlog, about 104 ms, close to the measured 110 ms; the backlog changes from moment to moment. The backlog stays below the 1,000,000-byte limit here because a single local socket is held back by the host before the queue fills; on a real router with many senders the queue can reach the limit and the 400 ms of the worked example.
Mitigation
- Make your device the bottleneck. The queue only helps if it forms where your AQM runs. Shape egress to a rate a little below the real link rate (18 Mbit/s, 90 percent, on the 20 Mbit/s uplink above is a starting point, tuned by testing): the modem or provider buffer then never fills.
- Use AQM with flow isolation. FQ-CoDel (RFC 8290) gives each flow its own queue (1,024 by default) and drops or ECN-marks packets (ECN, explicit congestion notification: the router sets a bit in the packet header so the sender slows down without a drop) when queue delay stays above the target (5 ms default, the delay it is willing to tolerate) for an interval (100 ms default, how long the delay must persist before it acts). At 20 Mbit/s, a 5 ms standing queue (a queue that stays non-empty instead of draining between bursts) is 0.005 x 20,000,000 / 8 = 12,500 bytes, against 1,000,000 before. CAKE (Common Applications Kept Enhanced) combines the shaper, the AQM and flow isolation in one queue discipline.
- Commands on a Linux router (iproute2):
# FQ-CoDel only (defaults: target 5ms, interval 100ms, 1024 flows)
tc qdisc replace dev eth0 root fq_codel
# Or CAKE with a shaper at 90 percent of the 20 Mbit/s uplink
tc qdisc replace dev eth0 root cake bandwidth 18mbit
- Enable ECN on hosts, so congestion is signalled without drops where both ends support it: the bufferbloat project's Linux tips list
net.ipv4.tcp_ecn=1. - Download direction. The queue is upstream of you and you cannot shorten it from your side by shaping egress. Shape ingress (traffic arriving at your router) at the router nearest the bottleneck, or ask the provider. Shaping ingress works because your router deliberately drops or delays arriving packets once they exceed a rate just below the real link speed, so the senders slow down, the arrival rate stays below what the provider's link can drain, and the provider's queue never fills.
- Verify. Rerun the loaded test: RTT under load should rise by only a few milliseconds above idle instead of the hundreds of milliseconds in the example, and throughput should stay near the shaped rate.
Trade-offs and pitfalls
- Shaping below line rate gives up some capacity (2 of 20 Mbit/s here). That is the price of a controlled queue.
- Simply shrinking buffers to the BDP is crude: it can drop bursts and hurt throughput on high-bandwidth paths. AQM adapts the queue to delay instead of a fixed size.
- Bufferbloat is a property of the bottleneck. Fixing a switch that is not the bottleneck changes nothing, so locate the slowest hop first.
- Data center fabrics trade buffer depth against incast (many servers answering one receiver at the same instant, which briefly overflows a switch queue) in a different way, and the link-level fix above does not carry over unchanged.
Unlock Full Question Bank
Get access to all 21 Network Monitoring and Performance interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.