Cutting the Wire: WiFi & Mobile Networks
Radio waves, interference, and the surprising performance characteristics of modern wireless networks. Essential reading for anyone building apps used on mobile or unreliable connections.
Wireless networking is everywhere — and it's deceptively complex. When your app feels slow on mobile or spotty on WiFi, the reasons have nothing to do with your code. They're buried in radio physics, protocol overhead, and the way cellular carriers have structured their networks.
Part 2 of this series covers Chapters 5–8 of High Performance Browser Networking: what wireless means for web performance, and what you can do about it.
Chapter 5: Introduction to Wireless Networks
Wireless networks transfer data by modulating electromagnetic radio waves. Unlike wired connections where data travels along a physical medium with predictable properties, wireless operates in a shared, uncontrolled medium with highly variable characteristics.
The Fundamental Constraints
Every wireless network operates under three fundamental constraints that shape everything downstream.
1. Shannon's Law — The Bandwidth Ceiling
Shannon's theorem defines the maximum theoretical channel capacity:
C = B × log₂(1 + S/N)
Where C is channel capacity (bits/s), B is bandwidth (Hz), and S/N is signal-to-noise ratio. The practical implication: more bandwidth (wider channel) or better signal quality equals more throughput. But there are physical limits to both.
2. The Half-Duplex Problem
Most wireless devices cannot transmit and receive simultaneously on the same frequency. Every wireless medium is inherently half-duplex — like a walkie-talkie. Bandwidth must be shared between upload and download, and between competing devices.
3. Shared Medium Contention
All devices in range share the same frequency spectrum. When two devices transmit simultaneously, their signals interfere and both transmissions fail. This requires collision avoidance protocols (CSMA/CA in WiFi, various schemes in cellular).
<CalloutBox type="info" title="Why WiFi Slows Down at Conferences"> At a tech conference with 500 laptops on the same WiFi network, you experience the shared medium problem directly. Each device must wait for others to finish transmitting. Even with a fast access point, effective per-device throughput drops dramatically as contention increases — regardless of the AP's theoretical maximum speed. </CalloutBox>Chapter 6: WiFi in the Wild
WiFi (IEEE 802.11) is the dominant local wireless standard, but its performance varies dramatically based on the standard in use, the environment, and how many devices are competing.
802.11 Standards Evolution
| Standard | Max Speed | Frequency | Key Feature |
|---|---|---|---|
| 802.11g | 54 Mbps | 2.4 GHz | Legacy, still common |
| 802.11n (WiFi 4) | 450 Mbps | 2.4/5 GHz | MIMO antennas |
| 802.11ac (WiFi 5) | 3.5 Gbps | 5 GHz | MU-MIMO, beamforming |
| 802.11ax (WiFi 6) | 9.6 Gbps | 2.4/5/6 GHz | OFDMA, better in dense environments |
These "maximum speeds" are theoretical. Real-world throughput is typically 40–60% of the maximum, and latency can be 1–10ms even at close range.
<PaywallGate partNumber={2}>WiFi Latency Characteristics
Unlike wired Ethernet (sub-millisecond latency), WiFi introduces variable latency from several sources:
- Collision avoidance backoff: Random delays when the medium is busy
- Retransmissions: Packets lost due to interference are retransmitted automatically
- Power save mode: Mobile devices sleep between beacon intervals to save battery, causing periodic 20–100ms delays
Real-world WiFi latency measurements on a home network:
| Condition | Typical Latency |
|---|---|
| Best case (idle channel, close range) | 1–2 ms |
| Normal home use | 5–15 ms |
| Crowded network or interference | 50–200 ms |
| Power save mode wake-up | 100 ms spike |
The 2.4 GHz vs 5 GHz Trade-Off
| Property | 2.4 GHz | 5 GHz |
|---|---|---|
| Range | Long (better wall penetration) | Short |
| Max throughput | Lower | Higher |
| Congestion | High (overlaps with Bluetooth, microwaves) | Lower |
| Channel width | 20/40 MHz | 20/40/80/160 MHz |
For performance-sensitive applications, 5 GHz is almost always better when you're within range. The narrower range isn't a bug — it's a feature in dense deployments, since each AP covers a smaller area with less interference.
Hidden Node Problem
Two devices may both be in range of an access point, but not in range of each other. Both may transmit simultaneously, causing collisions at the AP. WiFi's CSMA/CA protocol partially addresses this with RTS/CTS (Request to Send/Clear to Send) signaling, but at the cost of additional overhead on every transmission.
<CalloutBox type="tip" title="WiFi Optimization in Practice"> If you're building an app where WiFi performance matters (enterprise tools, conference apps, anything used in shared spaces), design for the worst WiFi case: high contention, variable latency, and 2–5% packet retransmission rate. Treat WiFi like a slightly better version of 4G — not like a wired connection. </CalloutBox>Chapter 7: Mobile Networks — 3G to 5G
Mobile networks are architecturally very different from WiFi. Where WiFi is a local network with a known number of devices, cellular networks must handle millions of devices across vast geographic areas with dynamic coverage.
Radio Access Network (RAN)
Mobile devices connect to base stations (cell towers) which form the Radio Access Network (RAN). The RAN connects to the carrier's core network, which provides routing, authentication, and internet connectivity.
Each base station covers a geographic cell. As you move, your device hands off between cells — a process that can cause brief connectivity interruptions of 50–300ms depending on carrier and generation.
Latency Characteristics by Generation
| Generation | Typical RTT | Peak Bandwidth | Key Improvement |
|---|---|---|---|
| 3G (HSPA) | 100–500 ms | 1–10 Mbps | First mobile data |
| 4G LTE | 30–50 ms | 10–100 Mbps | Latency breakthrough |
| 4G LTE Advanced | 15–30 ms | 50–300 Mbps | Carrier aggregation |
| 5G sub-6 GHz | 10–20 ms | 100–900 Mbps | Incremental 4G improvement |
| 5G mmWave | 1–5 ms | 1–4 Gbps | Dense urban areas only |
The dramatic improvement from 3G to 4G was primarily latency reduction — making mobile web browsing practical for the first time. Before 4G, a 300ms baseline RTT meant that even simple page loads involved multiple seconds of protocol overhead.
The Tail Latency Problem
Mobile network latency has a heavy tail distribution. While median latency on 4G might be 40ms, the 95th percentile can be 200–400ms due to:
- Network congestion: Peak hours (morning commute, lunch) cause queuing delays
- Cell tower handoffs: Switching between towers causes temporary service interruption
- DRX (Discontinuous Reception): Devices periodically sleep to save battery, adding 50–100ms wake-up delay when data arrives during sleep cycles
This tail latency is why mobile web performance requires different strategies than desktop. Your API must handle the case where 5% of requests take 10× longer than normal — graceful degradation matters more than optimizing the happy path.
<CodePlayground title="Detecting Network Conditions in the Browser" language="javascript" code={`// Network Information API (Chrome, Android WebView) const connection = navigator.connection || navigator.mozConnection;
if (connection) { console.log('Effective type:', connection.effectiveType); // → '4g', '3g', '2g', 'slow-2g'
console.log('Downlink speed:', connection.downlink, 'Mbps'); console.log('RTT estimate:', connection.rtt, 'ms'); console.log('Data saver mode:', connection.saveData);
// Adapt loading strategy based on connection quality if (connection.effectiveType === 'slow-2g' || connection.saveData) { document.documentElement.classList.add('reduced-motion'); // Skip auto-play video, serve smaller images, defer analytics }
// React to changes (moving from WiFi to cellular) connection.addEventListener('change', () => { console.log('Network changed to:', connection.effectiveType); }); }`} />
5G: Real vs. Marketing
5G comes in three distinct forms with vastly different performance characteristics. The marketing often conflates them.
Sub-6 GHz 5G (Low/Mid-band)
- Coverage similar to 4G — works through walls, outdoors, in buildings
- Roughly 2–4× throughput improvement over LTE
- Latency: 10–20ms (incremental improvement over 4G)
- Reality: This is what most "5G" icons on phones represent
mmWave 5G (High-band, 24–100 GHz)
- Ultra-fast: 1–4 Gbps peak
- Ultra-short range: 100–200 meters line-of-sight
- Blocked by walls, rain, hands holding the phone
- Reality: Limited to dense outdoor deployments (stadiums, downtown corridors, airports)
5G Standalone (SA) vs Non-Standalone (NSA)
- NSA uses the 4G core network with a 5G radio layer — limited latency improvements
- SA uses a full 5G architecture — enables network slicing and true low-latency guarantees
- Most current 5G deployments are NSA; SA rollouts are underway in 2024–2025
Chapter 8: Optimizing for Wireless
Understanding wireless constraints translates directly into concrete optimization strategies. The hierarchy of impact, in order:
1. Eliminate Round-Trips Entirely
Every round-trip on a high-latency mobile connection is expensive. The impact multiplies quickly:
- 1 unnecessary round-trip on 4G = 40–50ms
- 3 unnecessary round-trips on 3G = 300–1500ms
Optimization priority:
- Avoid the request entirely — aggressive caching, offline-first with Service Workers
- Batch requests — GraphQL batching, HTTP/2 multiplexing, REST aggregation endpoints
- Reduce payload size — Brotli compression, minification, tree-shaking
- Use the right protocol — HTTP/2 or HTTP/3 over HTTP/1.1
2. Cache Everything Possible
On mobile networks, cached assets skip the network entirely — they're served at memory speed:
<CodePlayground title="Optimal Cache-Control Strategy" language="javascript" code={`// Static assets (JS, CSS with content hash in filename) // Cache for 1 year — content hash guarantees cache busting Cache-Control: max-age=31536000, immutable
// API responses — serve stale while revalidating in background Cache-Control: max-age=60, stale-while-revalidate=600
// HTML pages — always revalidate, serve stale if revalidation fails Cache-Control: no-cache, stale-while-revalidate=86400
// Service Worker: cache-first for static, network-first for API // workbox-strategies: CacheFirst, NetworkFirst, StaleWhileRevalidate`} />
3. Battery Impact of Networking
Mobile networking hardware consumes significant battery. The radio state machine maintains "tail time" — staying powered for 5–10 seconds after data transfer completes, to avoid the startup cost of re-establishing connections.
This has a counterintuitive implication: rapid bursts of small requests are more battery-efficient than sustained low-rate transfers. Batch your requests, send them together, then let the radio sleep. Your API design affects user battery life.
4. Progressive Enhancement for Unreliable Connections
Build for the worst-case connection, enhance for better ones:
- Offline-first: Service Workers + Cache API for reliable offline experience
- Skeleton screens: Show layout structure immediately while content loads
- Lazy loading: Defer images and non-critical scripts until needed
- Adaptive bitrate: Serve lower-resolution images based on connection quality (use
<picture>withsrcset) - Optimistic UI: Update UI immediately, reconcile with server response in background
Key Takeaways
After these four chapters on wireless networks:
- Wireless is a shared medium: Contention, interference, and collision avoidance add latency beyond pure propagation delay
- WiFi latency is variable: 1ms on a quiet home network, 200ms on a crowded conference network
- 5G ≠ instant speed for everyone: Sub-6 GHz 5G is an incremental improvement; mmWave is transformative but rare
- Mobile tail latency is the real enemy: Design for P95, not P50 — 5% of requests will take 5–10× longer
- Battery is a performance metric: Network design affects user battery life, not just speed
- Aggressive caching is your best weapon: The fastest request is the one that never happens
Up Next: Part 3 — HTTP Mastery
Part 3 dives into the application layer: HTTP/1.1's bottlenecks, HTTP/2's multiplexing revolution, HTTP/3's QUIC foundation, and the browser APIs that enable real-time web applications.
</PaywallGate>