---
topic: networking
author: Crashtech Editorial
published: Sep 10, 2026 · read: 4 min
---

Application Networking Basics: What Happens Between DNS Lookup and the First API Byte

The complete journey of an API packet: DNS resolution, TCP three-way handshake, TLS 1.3 key exchange, and load balancer reverse proxying.

– –

When an engineer writes a line of code like fetch("https://api.crashtech.internal/v1/orders"), the operation feels instantaneous and abstract. A string URL goes into a function, and a parsed JSON object comes out.

Underneath that single function call lies one of humanity’s most complex engineering achievements: the global application networking stack.

Before a single byte of HTTP payload can travel from a client application to your backend microservice, the operating system and physical network must execute a strictly choreographed sequence of protocol handshakes, cryptographic key exchanges, routing tables, and reverse proxy delegations.

Understanding the mechanics of modern application networking (DNS, TCP, TLS 1.3, and Layer 7 Load Balancing) is the difference between an engineer who guesses at latency bugs and one who diagnoses them with mathematical precision.

+--------------------------------------------------------------------------+
|                  THE PRE-REQUEST NETWORKING SEQUENCE                     |
|                                                                          |
|  1. DNS Resolution        : Domain Name -> Anycast IP Address            |
|  2. IP Routing            : Packet traversal across local ISP & Tier-1   |
|  3. TCP Handshake         : SYN -> SYN-ACK -> ACK (1 Round Trip)         |
|  4. TLS 1.3 Handshake     : Certificate verify + Diffie-Hellman Key (1 RTT)
|  5. HTTP/2 or HTTP/3 Push : Multiplexed stream over secure tunnel        |
|  6. Load Balancer Proxy   : Envoy/Nginx selects healthy upstream pod     |
+--------------------------------------------------------------------------+

Step 1: DNS Resolution (Finding the Machine)

Computers cannot route packets using human-readable domain names like api.crashtech.internal. They route packets using 32-bit (IPv4) or 128-bit (IPv6) numerical addresses.

The client browser begins by checking four recursive cache layers in under 5 milliseconds:

  1. Browser DNS Cache: Chrome or Firefox checks its local memory.
  2. OS Resolver Cache: The operating system checks /etc/hosts and its internal DNS daemon.
  3. Local Router Cache: Queries the local Wi-Fi router.
  4. Recursive Resolver (ISP / 1.1.1.1 / 8.8.8.8): If uncached, the recursive resolver walks the global DNS hierarchy:
    • Queries Root Name Servers (.)
    • Queries TLD Name Servers (.internal or .com)
    • Queries the Authoritative Name Server (Cloudflare, Route53)

The authoritative server returns an A Record (IPv4) or AAAA Record (IPv6). In modern cloud architectures, this IP address is almost never a physical application server; it is a Border Gateway Protocol (BGP) Anycast IP pointing to the nearest edge Point of Presence (PoP).

Step 2: The Transmission Control Protocol (TCP) Handshake

IP (Internet Protocol) is an unreliable packet delivery mechanism: packets can be dropped, arrive out of order, or be duplicated.

To create a reliable, ordered, error-checked stream, the client and server establish a TCP Connection using the Three-Way Handshake:

Client                                      Server (Edge Gateway)
  |                                                  |
  | ------------ 1. SYN (Seq = 100) ---------------> |
  |                                                  |
  | <----------- 2. SYN-ACK (Seq = 300, Ack = 101) - |
  |                                                  |
  | ------------ 3. ACK (Seq = 101, Ack = 301) ----> |
  |                                                  |
[Connection Established: 1 Full Round-Trip Time (1 RTT)]
  1. SYN (Synchronize): Client chooses a random Initial Sequence Number (e.g., 100) and sends a packet with the SYN flag set.
  2. SYN-ACK: Server acknowledges by incrementing the client sequence number (Ack = 101) and sends its own random sequence number (Seq = 300).
  3. ACK: Client acknowledges the server sequence number (Ack = 301).

This exchange costs 1 full Round-Trip Time (1 RTT): if client-to-server latency is 40 ms, establishing TCP consumes 40 ms before transmitting data.

Step 3: Transport Layer Security (TLS 1.3)

Because public internet packets pass through untrusted routers, all modern APIs mandate HTTPS.

Older TLS 1.2 handshakes required two full round trips. Modern TLS 1.3 slashed this overhead to exactly 1 RTT (or 0-RTT with session resumption):

Client                                      Server (Edge Gateway)
  |                                                  |
  | -- ClientHello + Key Share (Diffie-Hellman) ---> |
  |                                                  |
  | <-- ServerHello + Key Share + Certificate + MAC -|
  |                                                  |
[Cryptographic Session Keys Derived: Symmetric AES-GCM Encryption Active!]
  1. ClientHello: In the very first packet, the client sends supported cipher suites AND its half of an Elliptic-Curve Diffie-Hellman (ECDH) cryptographic key exchange.
  2. ServerHello: The server responds with its key share, digital certificate, and cryptographic signature.
  3. Both sides independently compute the identical shared symmetric session key ($K$). All subsequent communication is encrypted using ultra-fast AES-GCM or ChaCha20 hardware instructions.

Step 4: HTTP Protocols: From 1.1 to HTTP/2 and HTTP/3

Once the encrypted tunnel is established, the HTTP protocol takes over:

HTTP/1.1: Sequential Blocking (Head-of-Line Blocking at Application Level)
[Req 1] -> [Resp 1] -> [Req 2] -> [Resp 2]

HTTP/2: Binary Framing & Multiplexing (Over 1 TCP Connection)
Stream 1: [Data Chunk A] [Data Chunk B]
Stream 2: [Data Chunk X] [Data Chunk Y] (Interleaved simultaneously!)

HTTP/3: QUIC over UDP (Eliminates TCP Head-of-Line Blocking completely)
Packet drops on Stream 1 do NOT stall Stream 2!
  • HTTP/1.1: Suffered from Head-of-Line (HoL) blocking. Browsers had to open up to 6 parallel TCP connections to fetch assets.
  • HTTP/2: Introduced binary framing and multiplexing. Hundreds of API requests travel over a single shared TCP connection concurrently.
  • HTTP/3 (QUIC): Replaces TCP with UDP. If a single packet drops on a cellular network, TCP halts all streams while waiting for retransmission. HTTP/3 isolates packet loss to the single affected stream, making mobile connections significantly faster.

Step 5: Reverse Proxying and Load Balancing

The encrypted packet arrives at the data center edge. It hits a Layer 7 Load Balancer (Envoy, Nginx, AWS ALB, Cloudflare):

  1. TLS Termination: The load balancer decrypts the packet, relieving internal application servers of cryptographic math.
  2. Health Checking: The load balancer maintains an active registry of healthy Kubernetes pods.
  3. Balancing Algorithms:
    • Round Robin: Sequential distribution.
    • Least Connections: Dispatches request to the server currently handling the fewest active threads.
    • Consistent Hashing: Routes requests based on user session ID or IP for cache affinity.
  4. Internal Forwarding: The load balancer forwards the raw HTTP request over high-speed internal data center fiber to the container application running your code.

The backend application executes, writes the JSON response, and the packet traverses the exact reverse path back to your screen.

Networking Latency Budget Breakdown

PhaseProtocolLatency Cost (Local)Latency Cost (Cross-Continent)
DNS LookupUDP 53 / DoH~2 ms (Cached)~80 ms (Uncached Root Walk)
TCP HandshakeTCP Layer 4~15 ms~120 ms
TLS 1.3 Key ExchangeTLS Layer 5~15 ms~120 ms
HTTP Request/ResponseHTTP/2 or 3~15 ms + Compute~120 ms + Compute
Total Pre-Request LagCombined~47 ms~440 ms

This mathematical reality explains why modern software architectures obsess over connection pooling, persistent WebSockets, and edge CDN termination: eliminating repeated TCP and TLS handshakes saves nearly half a second of latency on every interaction.

Advertisement

/* Comments */