Skip to content

From Browser to Server: Networking, Load Balancers, and Latency Budgets

14 min reading

Separate bandwidth, round trips, dependency ordering and admission before choosing network changes.

Page details

Workload and constraints · Lesson 02

Published · Sources · 14 min reading · Last edited:

Know first: Numbers Every Engineer Should Know; Reading Architecture Diagrams.

Editorial correction:

Earlier design notes used unsupported universal performance or reliability claims. This revision explains conditional mechanisms and explicitly hypothetical examples; no author-run benchmark or production incident is asserted.

More
20px

Northwind: Networking: connection setup, multiplexing and critical paths

Outcome. After this lesson, you can budget the browser path and the balancing boundary.

Hypothetical scenario. At Northwind, The price page waits on connections before Postgres sees a query.

In short. Allocate round trips and service time separately. Measure the slow dependency on the actual critical path.

Hypothetical scenario. The catalogue from the capacity lesson returns small item records. Its response-payload estimate fits the nominal network link, yet readers wait when a page fetches an item, then its seller, then related stock. Each operation is small; the dependency chain is long.

Capacity answers how much demand arrives. Networking adds where the work travels, which exchanges must finish first, and how connections carry that work. A wide pipe does not eliminate propagation delay, server queues, connection setup or dependency ordering. The useful design question is which part of the user's wait changes when an architectural choice changes.

This lesson separates latency, bandwidth and concurrency, then connects them to connection reuse and traffic distribution. Its calculations are chosen scenarios, not latency measurements for particular cities, protocols, machines or vendors.

Stop treating bandwidth as a stopwatch

For a payload of a known size, dividing bits by a chosen transfer rate estimates serialization time under that simplified model. It does not count travel time, contention, request processing or time spent waiting for dependencies. A small request can therefore take longer than a much larger local transfer.

Similarly, a protocol version does not establish a latency guarantee. RFC 9113 specifies HTTP/2 streams and their multiplexing over a connection. This changes application-level scheduling, but a shared TCP connection still has ordered transport delivery. QUIC's stream model removes that particular cross-stream delivery dependency; congestion, path quality and application dependencies still matter.

A connection is also a finite resource. Reusing connections can avoid repeated setup, while a pool with too few usable slots can make callers queue. Making the pool enormous can instead overload a downstream service. Identify both the work saved and the load admitted.

Draw the critical path before changing the protocol

Start with the user-visible result, then draw the prerequisites for producing it. Some work must wait for an earlier answer: a seller identifier may be needed before fetching the seller. Other work can run independently once the catalogue item is known. Only genuine independence justifies parallel dispatch.

Two independent dependencies after a catalogue lookupA request reaches the catalogue lookup. After obtaining the item, seller and inventory requests can run concurrently only if their inputs are available. A join waits for required results before responding.RequestItem lookupSellerInventoryJoin

The response's critical path is the longest required dependency chain, not the sum of all work performed anywhere. Parallelism can reduce elapsed time while increasing simultaneous resource demand. It also changes failure policy: decide whether missing inventory blocks the result or can be represented honestly as unavailable.

Budget the browser path and the balancing boundary

Northwind's landing page crosses several independently operated boundaries. DNS finds an address; a transport connection carries bytes; TLS authenticates and protects the connection; HTTP defines the request and response. A load balancer chooses an upstream destination, but that choice does not prove that the destination has enough free application or database capacity. Connection health and useful request success are separate observations.

For a hypothetical cold path, let DNS consume 20 ms and the network round trip be 40 ms. A TCP handshake consumes one such round trip, and the simplified TLS 1.3 handshake budget consumes another. Sending a request and receiving its first response adds a third. The communication subtotal is therefore 20 + 40 + 40 + 40 = 140 ms before application processing, queueing and response-body transfer. These are declared teaching assumptions, not internet latency measurements. A reused connection avoids some setup work but retains request and application costs.

HTTP/2 multiplexes streams over a connection, which changes how requests share that connection. It does not remove dependencies in application logic. A request that needs the result of an earlier request still waits for that result. QUIC's stream delivery model addresses another transport boundary; it does not make a slow database query or an overloaded worker disappear. Choose the protocol after identifying the dependency that consumes the budget.

At the balancing boundary, make overload visible to the routing decision when the platform supports it, and bound the waiting that remains inside each service. Repeatedly sending a request elsewhere after an uncertain state-changing attempt creates a correctness question as well as a network question. The later idempotency lesson supplies the operation identity that connection-level retry rules cannot provide.

Calculate time in flight and in the pool

Hypothetical scenario. Choose three sequential remote exchanges. Each has a 40 ms network round trip and 10 ms of server work, with no queueing, overlap or connection setup included. One exchange takes 40 + 10 = 50 ms; the sequence takes 3 × 50 = 150 ms. If the final two exchanges are independent after the first, the required path becomes 50 + max(50, 50) = 100 ms. Work is still performed by all three dependencies.

Now choose an established connection transferring a 2,000-byte response over a hypothetical 100,000,000-bit/s usable payload rate. Serialization is 2,000 × 8 ÷ 100,000,000 = 0.00016 seconds = 0.16 ms. This narrow component is small relative to the chosen 40 ms round trip. It does not establish the complete download time because the calculation deliberately excludes other costs.

For pool reasoning, choose a stable arrival rate of 200 operations/s and a mean slot-holding time of 0.1 seconds. Rate multiplied by holding time gives an estimated mean occupancy of 200 × 0.1 = 20 slots under the stated steady-flow accounting. This is not a safe pool-size prescription: variability, uneven scheduling, long operations and the downstream limit still require examination.

If the pool exposes 25 slots and operations occupy each for exactly 0.1 seconds with no other overhead, its idealized ceiling is 25 ÷ 0.1 = 250 operations/s. At an attempted 300 operations/s, the model has 300 − 250 = 50 operations/s of excess demand. An unbounded wait list grows instead of creating service capacity. A real system needs admission and timeout policies, not reliance on the idealized ceiling.

In the wild: Budget the browser path and the balancing boundary

The primary reference establishes this concrete distinction: hTTP/2 multiplexing is distinct from TCP/application dependencies.

Connection reuse does not remove failure boundaries

New-connection cost depends on DNS, transport and security state, protocol negotiation, resumption and the path. The TCP chapter of High Performance Browser Networking explains connection startup and congestion behavior; its historical examples should not be read as current measurements of every network.

Reuse an eligible connection when it suits the service's resource and isolation needs. Still account for stale connections, changed endpoints, maximum lifetimes and failures while a request is in progress. A connection pool is not proof that the requested business operation completed. After a lost reply, retry safety belongs to the operation's semantics, which the later idempotency lesson examines.

Traffic distribution adds another boundary. A Layer 4 distributor routes using transport-level information, whereas a Layer 7 proxy can use application-level information such as an HTTP route. A choice depends on required routing behavior, termination, visibility and operational cost. There is no universal proxy throughput figure that can replace measurements of the intended request mix.

Discovery supplies candidate endpoints; routing chooses where a particular request goes. A cached discovery result can outlive an endpoint, and a registered endpoint can fail after selection. Define membership refresh, connection retirement and what clients do when discovery itself is unavailable. A registry is not a promise that every listed server can complete the real operation.

Hypothetical scenario. Keep the earlier 40 ms round-trip time and 10 ms server work. DNS is already resolved. Choose a fresh TCP startup that takes one round trip, then a full TLS 1.3 handshake taking one additional round trip before the ordinary application request. Ignore loss, certificate-processing time, congestion startup and all other overhead. The selected path is 40 + 40 + 40 + 10 = 130 ms. Reusing an already eligible connection leaves 40 + 10 = 50 ms under the same simplified accounting.

Chosen connection state changes the critical path
StageFresh connectionEligible reused connection
TCP startup40 msAlready complete
TLS handshake40 msAlready complete
Request round trip + work40 + 10 = 50 ms40 + 10 = 50 ms
Modeled total130 ms50 ms

The 80 ms difference belongs to this chosen path, not every new connection. Resuming TLS can change handshake work and authentication state; it is not synonymous with sending application data at zero round trips. Optional early data has weaker replay protection, which TLS 1.3, Section 8 treats explicitly. Retrying a side effect still needs an application-level operation contract.

HTTP/2 gives separate streams on a connection so messages can be interleaved rather than requiring each response to finish before another is carried. It does not remove TCP's ordered-byte delivery. If a segment is lost, later bytes on that connection can wait for recovery even when their frames belong to another stream. Application response ordering and transport head-of-line blocking are different boundaries.

Multiplexing also does not remove connection or stream flow control, peer limits, server queues or application dependencies. A slow required inventory read remains on the page's critical path. More connections might isolate some transport contention while adding startup, resource and operational costs. Choose from measured work and failure behavior rather than treating a protocol name as a latency guarantee.

For the document assistant, retrieval and model-provider connections have different destinations and limits. Reuse each appropriately, carry the task's remaining deadline and distinguish opening a connection from obtaining a supported answer. The remote-request lesson follows what happens when an attempt ends without a confirmed result.

The pool that moved the queue

Hypothetical scenario. An application widens its connection pool to reduce caller waiting. Requests immediately reach a database that was already resource constrained. The queue moves from the application into the database, where more in-flight operations hold memory and increase latency. Callers time out and retry, adding more work.

The local pool metric improved while the user experience worsened. Diagnose the complete path: offered versus admitted work, where time is spent, which operations consume resources and whether retries create duplicate effects. Reducing simultaneous load may be part of the repair even when there are more network connections available.

A health check needs equal care. A process answering a lightweight probe may still be unable to serve the real operation. Define what readiness means and how traffic returns after recovery; do not make every transient slow response trigger a synchronized fleet restart.

Networking shortcuts to question

“HTTP/3 removes all head-of-line blocking.” Distinguish transport stream delivery from application ordering and shared resource queues. Removing one dependency does not remove the others.

“Parallel means the slowest call is the only cost.” That describes a simplified elapsed-time join, not total work, connection usage or failure handling.

“A successful socket write means the update succeeded.” It establishes neither application acceptance nor durable state. A missing result can leave an uncertain outcome.

“More connections fix overload.” More admission can move or amplify an existing bottleneck. Inspect the downstream constraint before widening a pool.

Choose the boundary you can explain

Use the model to identify whether a proposed improvement changes serialization, round trips, setup, queueing or server work. Reuse connections, reduce dependent exchanges or move computation closer to data when the actual workload supports that decision. Measure the user-visible path after the change.

Do not choose a protocol because a generic comparison table declares it faster. Consider deployment support, connection behavior, loss patterns and the application contract. Nor should the network become a reason to hide correctness: serving nearby stale state is a consistency choice that must be explicit.

The next data module asks what the service reads and writes. Carry forward the workload and the dependency graph; storage and index choices will change the work inside each exchange rather than magically eliminating the network around it.

Limits of this model

The cold-connection timeline is deliberately simplified. Resumption, negotiated protocol, connection reuse, packet loss, payload size and application dependencies change a real request. Use the critical-path method to identify those terms; keep authentication and write-recovery semantics intact when reducing connection costs.

Check yourself: inspect the critical path

One of the parallel 50 ms dependencies now takes 90 ms. What does the simplified path become?

The first 50 ms exchange remains required. The join waits max(50, 90) = 90 ms, giving 140 ms before excluded costs. Parallelism does not hide a required slow dependency.

Would doubling usable bandwidth halve the complete 150 ms sequential path?

No. Only the modeled serialization component halves. Round trips, server work and queueing do not automatically change. Identify which component dominates before predicting the improvement.

A pool has room, but the server is rejecting work. Should the application keep admitting requests?

Not simply because slots are available. Pool capacity and downstream usable capacity differ. Apply the declared admission, deadline and retry policies and inspect whether attempts amplify overload.

Northwind decision log

Allocate round trips and service time separately.
Measure the slow dependency on the actual critical path.
Check connection reuse before adding application capacity.

Go deeper: Budget the browser path and the balancing boundary

Related blog: Provider failover and the latency boundary.