API Response Latency Calculator
Break an API response into DNS, TCP, TLS, server and transfer time, then project the p95 and p99 tail.
Inputs
A warm connection skips DNS, TCP and TLS entirely.
Median Response Time
310.80ms
Time to First Byte
234.00ms
Connection Setup Time
82.00ms
Content Transfer Time
76.80ms
95th-Percentile Response Time
683.76ms
99th-Percentile Response Time
1,398.60ms
Saving From Reusing the Connection
82.00ms
Dominant Term
Server processing — cache the response or optimise the handler
Step by step
Values used
DNS resolution = 18 ms; Round-trip time to the endpoint = 32 ms; TLS handshake cost = TLS 1.3 full handshake (1 round trip); Server processing time = 120 ms; Response body size = 240 KB; Effective client throughput = 25 Mbps; Connection already established = No; p95 multiple of the median = 2.20 ×; p99 multiple of the median = 4.50 ×
API Response Latency
response = DNS + TCP (1 RTT) + TLS (RTT × handshake round trips) + request RTT + server processing + body ÷ throughput; a reused connection zeroes the first three terms.
Median Response Time
= 310.80 ms
Time to First Byte
= 234.00 ms
Connection Setup Time
= 82.00 ms
Content Transfer Time
= 76.80 ms
95th-Percentile Response Time
= 683.76 ms
99th-Percentile Response Time
= 1,398.60 ms
How it works
A cold request pays DNS, then one round trip for TCP, then one or two more for TLS, before the request itself makes a round trip and the server does its work. Decomposing it this way shows which term actually dominates, and the p95/p99 multiples project the tail that users complain about but averages hide. Optimising the wrong term is the most common latency mistake — shaving 20 ms of server time is pointless when the client is spending 96 ms on handshakes it could have skipped by reusing a connection or terminating TLS at the edge.
Formula
API Response Latency
response = DNS + TCP (1 RTT) + TLS (RTT × handshake round trips) + request RTT + server processing + body ÷ throughput; a reused connection zeroes the first three terms.
- RTT
- Round-trip time between client and endpoint
- handshake round trips
- 0 for a resumed session, 1 for TLS 1.3, 2 for TLS 1.2
- transfer time
- Response body size divided by the client's usable throughput
Frequently Asked Questions
How is API Response Latency calculated?
response = DNS + TCP (1 RTT) + TLS (RTT × handshake round trips) + request RTT + server processing + body ÷ throughput; a reused connection zeroes the first three terms. A cold request pays DNS, then one round trip for TCP, then one or two more for TLS, before the request itself makes a round trip and the server does its work. Decomposing it this way shows which term actually dominates, and the p95/p99 multiples project the tail that users complain about but averages hide.
Why does API Response Latency matter?
Optimising the wrong term is the most common latency mistake — shaving 20 ms of server time is pointless when the client is spending 96 ms on handshakes it could have skipped by reusing a connection or terminating TLS at the edge.
What values do I need to enter?
This calculator takes 9 inputs: DNS resolution, Round-trip time to the endpoint, TLS handshake cost, Server processing time, Response body size, Effective client throughput, Connection already established, p95 multiple of the median, p99 multiple of the median. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
Why report p95 and p99 rather than the mean?
The mean is dragged down by fast cache hits and hides the slow tail. If 1% of requests take five times as long, a user making a hundred calls to render one page almost certainly hits it — so the p99, not the average, is what the page actually feels like.
You might also need
- Global Latency CalculatorCommonly used together
- Traffic Routing CalculatorCommonly used together
- Edge Compute Cost CalculatorCommonly used together
- Edge Performance Score CalculatorCommonly used together
- CDN Cache Hit Ratio CalculatorAlso in CDN, Edge & DNS
- Anycast Coverage CalculatorAlso in CDN, Edge & DNS