Network Saturation

This document explores network performance issues through latency and bandwidth concepts, covering how physical distance and connection capacity affect data transmission. It examines traffic prioritization using traffic shaping, connection limits, and diagnostic tools like iftop for identifying bandwidth consumption patterns across network services.

This document examines network performance through the critical concepts of latency and bandwidth, exploring how these factors determine data transmission speed across local and remote services. It covers diagnostic techniques for identifying slow network connections, strategies for optimizing performance based on data transfer patterns, and tools for managing bandwidth allocation through traffic shaping and connection monitoring.


Network Connections in IT

Working with Distributed Services

When working in IT, interaction occurs with services all over the Internet. At one moment, connection might happen to a service running on the local network, and the next might use another service running in a data center located on a different continent.

Service location diversity:

Service LocationNetwork TypeTypical LatencyConnection Type
Same computerLoopback<1 mslocalhost/127.0.0.1
Local networkLAN1-5 msEthernet/WiFi
Same cityMAN5-20 msISP network
Same countryWAN20-80 msInternet backbone
Different continentInternet100-300 msUndersea cables

Perceiving Location Differences

If the network connection is good, it might not be possible to tell the difference where the website being browsed is hosted.

User perception of network quality:

Connection QualityLatencyPage Load TimeUser Experience
Excellent<50 ms<1 secondInstant response
Good50-100 ms1-2 secondsFast, acceptable
Fair100-200 ms2-4 secondsNoticeable delay
Poor>200 ms>4 secondsFrustrating

Investigating Slow Connections

But if dealing with a network service that isn’t exactly up to speed, more details about the connection being used might be needed.

When to investigate network performance:

SymptomPossible CauseInvestigation Tool
Slow page loadsBandwidth limitationSpeed test
Delayed responsesHigh latencyping, traceroute
Intermittent failuresPacket lossping with statistics
Connection timeoutsNetwork congestiontraceroute, mtr
Slow file transfersBandwidth saturationiftop, nethogs

Understanding Latency and Bandwidth

Defining Latency

The two most important factors that determine the time it takes to get the data over the network are the latency and the bandwidth of the connection. The latency is the delay between sending a byte of data from one point and receiving it on the other.

Latency characteristics:

AspectDescriptionImpact
DefinitionRound-trip time for dataAffects responsiveness
MeasurementMilliseconds (ms)Lower is better
Primary factorPhysical distanceCannot eliminate
Secondary factorIntermediate hopsCan optimize

This value is directly affected by the physical distance between the two points and how many intermediate devices there are between them.

Factors affecting latency:

FactorImpact on LatencyExample
Physical distanceSpeed of light limitCross-ocean: +100ms
Router hopsProcessing delay per hopEach hop: +1-5ms
Network congestionQueuing delaysVariable: +10-100ms
Connection typeMedium transmission speedFiber > copper > satellite

Typical latency by distance:

ConnectionDistanceLatencyUse Case
Localhost0 km<1 msLocal services
Same building<1 km1-2 msLAN services
Same city<50 km5-10 msCDN edge servers
Same region<500 km10-30 msRegional services
Cross-country1,000-5,000 km30-80 msNational services
Cross-ocean5,000-20,000 km100-300 msGlobal services

Defining Bandwidth

The bandwidth is how much data can be sent or received in a second. This is effectively the data capacity of the connection.

Bandwidth specifications:

AspectDescriptionMeasurement
DefinitionData transfer rateBits per second (bps)
Typical unitsMbps, GbpsHigher is better
DirectionUpload vs downloadOften asymmetric
Effective capacityTheoretical vs actualReal-world lower

Common bandwidth levels:

Connection TypeDownload SpeedUpload SpeedUse Case
Dial-up56 Kbps48 KbpsLegacy
DSL1-100 Mbps384 Kbps - 20 MbpsHome
Cable100-1000 Mbps10-50 MbpsHome/small business
Fiber100-10,000 Mbps100-10,000 MbpsBusiness/enterprise
Gigabit Ethernet1000 Mbps1000 MbpsLocal network
10 Gigabit10,000 Mbps10,000 MbpsData centers

Bandwidth Marketing vs Reality

Internet connections are usually sold by the amount of bandwidth the customer will see. But it’s important to know that the usable bandwidth to transmit data to and from a network service will be determined by the available bandwidth at each endpoint and every hop between them.

Bandwidth bottleneck principle:

Point in PathAdvertised BandwidthResult
Home connection100 Mbps-
ISP backbone10 Gbps-
Internet exchange100 Gbps-
Destination ISP1 Gbps-
Destination server100 Mbps-
Effective bandwidth100 MbpsSlowest link wins

Real-world bandwidth limitations:

LimitationCauseImpact
Slowest hopBottleneck in pathEntire connection limited
Shared connectionMultiple usersDivided capacity
Protocol overheadTCP/IP headers~5-10% loss
CongestionNetwork trafficVariable reduction
Peering agreementsISP relationshipsRoute inefficiency

Latency and Bandwidth Interaction

Website Loading Example

To understand how latency and bandwidth interact, think about what happens when trying to visit a website over the Internet.

Website request lifecycle:

StepActionTime ComponentDelay
1. DNS lookupResolve domain nameLatency~20-50 ms
2. TCP handshakeEstablish connectionLatency (3 round trips)~300 ms
3. HTTP requestSend GET requestLatency~100 ms
4. Server processingGenerate responseServer timeVariable
5. Initial responseFirst bytes arriveLatency~100 ms
6. Full downloadReceive all dataBandwidthDepends on size

Cross-Ocean Scenario

If the web server is hosted somewhere across the ocean, the latency might be 100 milliseconds or so. That’s the time it takes for the request to reach the server.

Request-response with high latency:

EventTimeCumulative Time
Send request0 ms0 ms
Request arrives at server+100 ms latency100 ms
Server processes+50 ms150 ms
Response starts journey-150 ms
First byte arrives+100 ms latency250 ms
Full content received+Bandwidth time250 ms + download time

The server will then generate a response and send it back. The first bytes of the response will again take 100 milliseconds to zap across the pond to the computer.

Bandwidth Impact on Download Time

Once the response is on its way, the time it takes for the rest of the data to arrive is determined by the bandwidth.

Bandwidth calculation:

BandwidthBytes per SecondMegabytes per Second
1 Mbps125,000 bytes0.125 MB
10 Mbps1,250,000 bytes1.25 MB
100 Mbps12,500,000 bytes12.5 MB
1 Gbps125,000,000 bytes125 MB

If the available bandwidth between the two points is 10 megabits per second, 1.25 megabytes can be received every second.

Small Content Scenario

So for a website of about one megabyte of content, that large initial latency will be noticeable, since it’s an extra 20 percent on top of the total time to download it.

Small file download analysis (1 MB website, 10 Mbps bandwidth):

ComponentTimePercentage of Total
Initial latency (round trip)200 ms20%
Download time (1 MB ÷ 1.25 MB/s)800 ms80%
Total time1000 ms (1 second)100%

Large Content Scenario

But if the content is 10 megabytes or more, the initial latency will be less than five percent of the total time to download it, so it matters less.

Large file download analysis (10 MB website, 10 Mbps bandwidth):

ComponentTimePercentage of Total
Initial latency (round trip)200 ms2.4%
Download time (10 MB ÷ 1.25 MB/s)8000 ms97.6%
Total time8200 ms (8.2 seconds)100%

Latency impact by file size:

File SizeDownload Time (10 Mbps)Latency (200ms)Latency %
100 KB80 ms200 ms71%
1 MB800 ms200 ms20%
10 MB8000 ms200 ms2.4%
100 MB80,000 ms200 ms0.25%

Optimizing for Different Scenarios

When to Optimize for Latency

Let’s say there’s an attempt to figure out why a network connection isn’t going as fast as desired. Remember that if transmitting a lot of small pieces of data, latency matters more than bandwidth.

Small data transfer characteristics:

Transfer TypeData SizeFrequencyLatency ImpactBandwidth Impact
API requests<10 KBHighCriticalMinimal
Chat messages<1 KBContinuousVery highNegligible
Database queries1-100 KBVery highCriticalLow
Sensor data<1 KBConstantHighLow
IoT telemetry<500 bytesFrequentVery highMinimal

In this case, ensuring the server is as close as possible to the users of the service is desired, aiming for a latency of less than 50 milliseconds if possible, and up to 100 milliseconds in the worst-case.

Latency optimization strategies:

StrategyLatency ReductionImplementationCost
CDN deployment50-150 msContent delivery networkMedium
Regional servers30-100 msMulti-region deploymentHigh
Edge computing40-120 msProcess at network edgeMedium
Caching50-200 msCache common responsesLow
Protocol optimization10-50 msHTTP/2, connection poolingLow

Acceptable latency targets:

Use CaseTarget LatencyMaximum AcceptableUser Impact if Exceeded
Real-time gaming<20 ms50 msUnplayable
Video calls<50 ms150 msNoticeable lag
Interactive apps<50 ms100 msFeels sluggish
Web browsing<100 ms200 msSlow response
File transfers<200 ms500 msMinimal (bandwidth matters)

When to Optimize for Bandwidth

On the flip side, if transmitting large chunks of data, bandwidth matters more than latency.

Large data transfer characteristics:

Transfer TypeData SizeLatency SensitivityBandwidth NeedExample
Video streamingGB per hourLowHighNetflix, YouTube
File downloadsMB to GBLowHighSoftware updates
Backup operationsGB to TBVery lowVery highCloud backups
Data replicationGB dailyLowHighDatabase sync
Media uploadsMB to GBLowHighPhoto/video sharing

In this case, having as much bandwidth available as possible is desired regardless of where the server is hosted.

Bandwidth optimization strategies:

StrategyBandwidth GainImplementationTrade-off
Compression50-90%Gzip, BrotliCPU overhead
Delta sync70-95%Only send changesComplexity
Deduplication40-80%Identify duplicatesStorage overhead
Parallel transfers2-10×Multiple connectionsConnection limits
Upgrade connectionVariableHigher tier serviceDirect cost

Bandwidth Sharing and Competition

What Bandwidth Available Means

What is meant by bandwidth available? Computers can transmit data to and from many different points of the Internet at the same time, but all those separate connections share the same bandwidth.

Bandwidth sharing example (100 Mbps connection):

ScenarioActive ConnectionsBandwidth per ConnectionTotal Used
Single download1100 Mbps100 Mbps
Two equal downloads250 Mbps each100 Mbps
Ten connections1010 Mbps each100 Mbps
Mixed usage5 (varied)Uneven split100 Mbps

Uneven Bandwidth Distribution

Each connection will get a portion of the bandwidth, but the split isn’t necessarily even. If one connection is transmitting a lot of data, there may be no bandwidth left for the other connections.

Bandwidth competition scenarios:

Connection TypeBandwidth ConsumedImpact on OthersPriority
Large file download95 MbpsStarves other connectionsHigh volume
Video streaming5-25 MbpsModerate impactMedium
Web browsing1-5 MbpsMinimal impactLow
Email<1 MbpsNegligibleVery low
Background syncVariableCan monopolizeUnpredictable

Traffic Jams and Increased Latency

When these traffic jams happen, the latency can increase a lot because packets might get held back until there’s enough bandwidth to send them.

Congestion impact on latency:

Network StateNormal LatencyCongested LatencyIncrease Factor
Idle20 ms20 ms
Light load (30%)20 ms25 ms1.25×
Moderate load (60%)20 ms40 ms
Heavy load (90%)20 ms100 ms
Saturated (100%)20 ms500+ ms25×+

Monitoring Network Usage

Personal Experience with Shared Bandwidth

This has probably already been experienced on personal computers. If several applications have been run using the same network at once, the overall connection speed may have seemed slower.

Application bandwidth consumption:

ApplicationTypical BandwidthImpact Level
Video call (HD)2-4 MbpsModerate
Video streaming (4K)25 MbpsHigh
Online gaming1-3 MbpsLow (but latency-sensitive)
File downloadVariable (can max out)Very high
Music streaming0.3-1 MbpsLow
Web browsing1-5 MbpsLow to moderate
System updatesVariable (can max out)Very high

Using iftop for Monitoring

Processes using the network connection can be checked by running a program like iftop. This shows how much data each active connection is sending over the network.

iftop command usage:

 1# Install iftop (if not present)
 2sudo apt-get install iftop  # Debian/Ubuntu
 3sudo yum install iftop      # RHEL/CentOS
 4
 5# Run iftop (requires root)
 6sudo iftop
 7
 8# Monitor specific interface
 9sudo iftop -i eth0
10
11# Show port numbers
12sudo iftop -P
13
14# Show bandwidth in bytes instead of bits
15sudo iftop -B

iftop output interpretation:

1                  12.5Mb        25.0Mb        37.5Mb        50.0Mb
2┌─────────────────┴─────────────┴─────────────┴─────────────┴────────
3myserver.local    => cdn.example.com           15.2Mb  12.1Mb  10.5Mb
4                  <=                            1.5Mb   1.2Mb   1.1Mb
5myserver.local    => api.service.com            2.1Mb   3.5Mb   2.8Mb
6                  <=                            0.5Mb   0.8Mb   0.6Mb
ColumnMeaningUse
Source/DestinationConnection endpointsIdentify services
=>Outgoing trafficUpload bandwidth
<=Incoming trafficDownload bandwidth
Last 3 columns2s, 10s, 40s averagesTrend analysis

Alternative network monitoring tools:

ToolPlatformView TypeBest For
iftopLinuxConnection-basedReal-time bandwidth by host
nethogsLinuxProcess-basedBandwidth per application
iotopLinuxI/O operationsDisk and network I/O
tcpdumpUnix/LinuxPacket captureDeep packet analysis
WiresharkCross-platformGUI packet analysisDetailed protocol debugging
nloadLinuxInterface-basedSimple bandwidth graph

Multiple Users Impact

It might also have been noticed that the more users sharing the same network, the slower the data comes in. This is true for home connections and office connections alike.

Shared connection capacity:

UsersConnection SpeedPer-User BandwidthPerformance
1 user100 Mbps100 MbpsExcellent
5 users100 Mbps20 Mbps averageGood
10 users100 Mbps10 Mbps averageAdequate
25 users100 Mbps4 Mbps averageSlow
50 users100 Mbps2 Mbps averageVery slow

No matter how much bandwidth is available, it’s a limited resource, so care will be needed with how it’s shared among users.


Traffic Shaping

Managing Bandwidth Distribution

If some applications are using so much bandwidth that others can’t transmit anymore data, it’s possible to restrict how much each connection takes by using traffic shaping.

Traffic shaping purpose:

ProblemSolutionBenefit
One connection monopolizesLimit per-connection bandwidthFair distribution
Critical services starvedPrioritize important trafficMaintain service quality
Bulk transfers block interactiveDeprioritize large transfersResponsive UI
Network congestionShape overall trafficPrevent saturation

Priority-Based Traffic Management

This is a way of marking the data packets sent over the network with different priorities.

Traffic priority levels:

PriorityTraffic TypeExamplesLatency Tolerance
CriticalReal-time, interactiveVoIP, video callsVery low
HighImportant interactiveSSH, RDP, databaseLow
MediumNormal trafficWeb browsing, emailModerate
LowBulk transfersBackups, downloadsHigh
Best effortBackgroundUpdates, syncVery high

Preventing Bandwidth Monopolization

To avoid having huge chunks of data use all the bandwidth, by prioritizing accordingly, processes that send and receive small packets can keep working fine, while processes that need the most bandwidth can use the rest.

Traffic shaping strategies:

StrategyImplementationUse Case
Rate limitingCap connection speedPrevent single user monopoly
Priority queuingServe high-priority firstProtect interactive traffic
Fair queuingEqual share per flowDemocratic distribution
Class-based queuingGroup by application typePolicy-based management
Token bucketAllow bursts within limitsSmooth traffic flow

Linux traffic shaping example (tc command):

 1# Limit outgoing bandwidth on eth0 to 1 Mbps
 2sudo tc qdisc add dev eth0 root tbf rate 1mbit burst 32kbit latency 400ms
 3
 4# Create priority-based queuing
 5sudo tc qdisc add dev eth0 root handle 1: prio bands 3
 6
 7# Assign SSH traffic to high priority (band 0)
 8sudo tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 \
 9  match ip dport 22 0xffff flowid 1:1
10
11# Show current tc configuration
12sudo tc -s qdisc show dev eth0

Traffic shaping benefits vs trade-offs:

BenefitTrade-off
Fair bandwidth distributionConfiguration complexity
Protected critical servicesRequires continuous monitoring
Improved user experienceMay limit legitimate bulk transfers
Prevented network saturationOverhead in packet processing

Connection Limits

Maximum Connection Constraints

There’s also a limit to how many network connections can be established on a single computer. This isn’t usually a problem, but there could be bugs in the software that causes it to open way too many connections, or keep old connections open even if they’re no longer in use.

Connection limit factors:

Limit TypeTypical ValueControlled BySymptom When Exceeded
File descriptors1024-65535OS ulimit“Too many open files”
Port numbers65535 totalTCP/IP stackPort exhaustion
Kernel connections100,000+Kernel parametersSystem slowdown
Application connectionsVariesApplication designApp crashes

Common connection limit issues:

IssueCauseManifestationSolution
Connection leakNot closing connectionsGrowing count over timeFix cleanup code
File descriptor limitDefault too lowCannot accept new connectionsIncrease ulimit
TIME_WAIT buildupHigh connection churnPort exhaustionTune TCP parameters
Connection pool exhaustionMisconfigured poolRequests timeoutAdjust pool size

Server Connection Problems

If this happens on a server, no new users will be able to connect to it until whatever is keeping those connections open closes them.

Server connection exhaustion:

StageConnection CountService StateUser Experience
Normal0-500HealthyFast connections
Busy500-5000LoadedSlower responses
Near limit5000-10000StressedTimeouts starting
Exhausted10000+Failing“Connection refused”

Diagnosing connection issues:

 1# Count current connections
 2ss -s
 3
 4# Show all TCP connections
 5ss -tan | wc -l
 6
 7# Count connections by state
 8ss -tan | awk '{print $1}' | sort | uniq -c
 9
10# Show connections per IP
11netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
12
13# Check file descriptor usage
14lsof -u username | wc -l
15
16# Check system-wide file descriptor limit
17cat /proc/sys/fs/file-max
18
19# Check process-specific limits
20ulimit -n

Connection state monitoring:

TCP StateMeaningNormal CountProblem Indicator
ESTABLISHEDActive connectionHundredsThousands = leak
TIME_WAITRecently closedHundredsTens of thousands = churn
CLOSE_WAITWaiting for app to closeFewMany = app not closing
SYN_RECVIncoming connectionFewMany = SYN flood attack

Mitigation strategies:

StrategyImplementationPrevents
Connection poolingReuse connectionsOpening too many
Timeout configurationClose idle connectionsIndefinite holds
Resource limitsSet max connectionsUncontrolled growth
Proper cleanupAlways close in finally blocksConnection leaks
Monitoring alertsAlert on thresholdExhaustion scenarios

Conclusion

Network performance in IT environments depends fundamentally on two factors: latency representing the delay between sending and receiving data affected by physical distance and intermediate hops, and bandwidth representing data transfer capacity that determines how much information can move per second, with internet connections sold by bandwidth but actual usable capacity limited by the slowest link in the entire path from source to destination. The interaction between latency and bandwidth determines overall performance differently based on data size—for small frequent transfers like API requests and chat messages latency dominates and servers should be placed close to users targeting under 50ms ideally and 100ms maximum, while for large transfers like video streaming and file downloads bandwidth becomes the primary factor requiring maximum available capacity regardless of server location, with the relative impact shifting as file sizes change from latency being 71% of total time for 100KB files down to only 0.25% for 100MB files. Bandwidth represents a limited shared resource where computers simultaneously connect to multiple services dividing available capacity unevenly, with high-volume connections potentially monopolizing bandwidth and causing traffic jams that dramatically increase latency from normal 20ms to over 500ms when fully saturated, observable through tools like iftop showing per-connection bandwidth consumption and alternative tools like nethogs for process-based monitoring. Traffic shaping manages bandwidth distribution by marking packets with different priorities to prevent huge data chunks from monopolizing capacity, allowing processes with small packets like interactive applications to maintain performance while bulk transfer processes use remaining bandwidth through strategies like rate limiting, priority queuing, and class-based management implemented via tools like Linux tc command. Connection limits on computers typically ranging from 1024 to 65535 file descriptors can be exhausted by software bugs causing excessive connection opening or failing to close old connections, manifesting on servers as inability for new users to connect until existing connections close, with diagnosis through commands like ss and netstat revealing connection states where thousands of ESTABLISHED connections indicate leaks and mitigation requiring connection pooling, proper cleanup code, timeout configuration, and monitoring alerts to prevent exhaustion scenarios.


FAQ