← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

Latency vs Bandwidth

networking Intermediate

Also Known As

latency bandwidth RTT round trip time throughput

TL;DR

Latency is delay per request (physics + processing); bandwidth is throughput — high bandwidth does not fix high latency for small interactive responses.

Explanation

Latency: time for a packet to travel from source to destination — physical distance, hops, processing time. Cannot be improved beyond the speed of light. Bandwidth: maximum data transfer rate — upgradeable with better hardware. For small responses (API calls, HTML pages), latency dominates performance. A 10Mbps connection at 10ms RTT delivers a 10KB response faster than 100Mbps at 200ms RTT. HTTP/2 multiplexing and CDN reduce the impact of latency.

Common Misconception

More bandwidth always means a faster website — for small responses latency dominates; a 100Mbps connection with 200ms latency downloads a 10KB response in 200ms while a 10Mbps at 10ms delivers it in 10ms.

Why It Matters

Optimising image sizes (bandwidth) on an API making 20 serial requests (latency bottleneck) delivers minimal improvement — identifying the correct constraint guides correct optimisation.

Common Mistakes

  • Serial HTTP requests where parallel would reduce total time
  • No HTTP keep-alive — each new connection adds one RTT
  • No CDN — distant users have high latency regardless of origin bandwidth
  • Optimising file sizes when connection count is the real bottleneck

Code Examples

✗ Vulnerable
// 10 serial API calls — each adds full RTT:
async function loadDashboard() {
    const user    = await fetch('/api/user');     // 100ms RTT
    const orders  = await fetch('/api/orders');   // 100ms RTT
    const reviews = await fetch('/api/reviews');  // 100ms RTT
    // Total: 300ms in latency alone
}
✓ Fixed
// Parallel requests — latency is max(individual):
async function loadDashboard() {
    const [user, orders, reviews] = await Promise.all([
        fetch('/api/user'),
        fetch('/api/orders'),
        fetch('/api/reviews'),
    ]);
    // Total: ~100ms (parallel) vs 300ms (serial)
}

Added 16 Mar 2026
Edited 22 Mar 2026
Views 27
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
1 ping W 0 pings T 1 ping F 0 pings S 0 pings S 1 ping M 0 pings T 0 pings W 1 ping T 1 ping F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 1 ping F 0 pings S 0 pings S 0 pings M 0 pings T 1 ping W 0 pings T 1 ping F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T
No pings yet today
No pings yesterday
Amazonbot 6 Perplexity 4 Google 2 Unknown AI 2 Majestic 1 Ahrefs 1
crawler 16
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: Medium
⚡ Quick Fix
Latency is round-trip time (affected by distance); bandwidth is throughput (affected by connection speed) — PHP apps suffer latency not bandwidth; reduce round trips with CDN, HTTP/2, and connection reuse
📦 Applies To
any web cli
🔗 Prerequisites
🔍 Detection Hints
Many small HTTP requests that could be batched; no HTTP/2 multiplexing; PHP making serial external API calls that could be concurrent
Auto-detectable: ✗ No webpagetest lighthouse
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: Medium Context: File

✓ schema.org compliant