PerformanceSSLSecurityLatencyCore Web Vitals

SSL/TLS Handshake Latency: How Encryption Affects Website Speed and How to Optimize It

Discover how TLS encryption handshakes impact Time to First Byte (TTFB). Learn the differences between TLS 1.2 and 1.3, OCSP stapling, ECDSA, and HTTP/3 QUIC.

PingXD Team7 min read

In the early days of the web, enabling HTTPS was notoriously slow. System administrators warned of heavy CPU loads, and negotiating secure connections introduced noticeable pauses before web pages began rendering.

While modern CPUs now feature dedicated cryptographic hardware acceleration (such as Intel AES-NI and ARM Cryptography extensions), network round trips remain an unavoidable physical constraint.

Before a browser can download a single byte of HTML or API data over HTTPS, it must complete two sequential handshakes across the internet:

  1. The TCP three-way handshake (establishing the network transport).
  2. The TLS cryptographic handshake (authenticating the server and negotiating shared encryption keys).

If your users live hundreds or thousands of miles from your origin server, these round trips compound quickly, directly inflating your Time to First Byte (TTFB) and hurting your Google Largest Contentful Paint (LCP) Core Web Vitals score.

This guide explores the anatomy of the SSL/TLS connection lifecycle, compares the performance of TLS 1.2 versus TLS 1.3, and outlines actionable optimizations to minimize cryptographic latency.

The mechanics of connection latency: Why RTT matters

Every network packet traveling between a client browser and your server is bound by the speed of light in fiber optic cables (roughly 200,000 kilometers per second in glass). The duration required for a packet to travel to the server and return is known as the Round-Trip Time (RTT).

Let's look at a realistic international user scenario:

  • A user in Tokyo visits a server hosted in Northern Virginia (US East).
  • The baseline physical RTT measured with a ping test is 150 milliseconds.

The legacy HTTPS connection waterfall (TCP + TLS 1.2)

Under legacy protocols (HTTP/1.1 or HTTP/2 over TLS 1.2), establishing a secure connection required 3 full round trips before the first HTTP request could even be transmitted:

Client                                                  Server
  │                                                       │
  │ ──── SYN ───────────────────────────────────────────> │  [Round Trip 1: TCP Handshake]
  │ <─── SYN-ACK ──────────────────────────────────────── │
  │ ──── ACK + ClientHello ─────────────────────────────> │
  │                                                       │  [Round Trip 2: TLS 1.2 Setup]
  │ <─── ServerHello + Certificate + KeyExchange ──────── │
  │                                                       │  [Round Trip 3: Key Negotiation]
  │ ──── ClientKeyExchange + ChangeCipherSpec + Finished > │
  │ <─── ChangeCipherSpec + Finished ──────────────────── │
  │                                                       │
  │ ──── GET /index.html (HTTP Request) ────────────────> │  [Round Trip 4: First Application Byte]
  │ <─── HTTP/2 200 OK (First Byte of HTML) ───────────── │

At a 150 ms RTT, 4 round trips equal 600 milliseconds of dead time before the origin server even begins processing the backend query or rendering HTML!

For e-commerce and SaaS platforms where every 100 ms of delay reduces conversions, 600 ms of connection setup latency is unacceptable.

TLS 1.2 vs. TLS 1.3: Cutting a round trip in half

The publication of TLS 1.3 (RFC 8446) represented the biggest performance leap in web security in a decade.

1-RTT Handshake in TLS 1.3

In TLS 1.2, the client and server had to first agree on a cipher suite before calculating Diffie-Hellman cryptographic parameters in a subsequent exchange.

TLS 1.3 drastically stripped down obsolete ciphers (removing insecure algorithms like RSA key exchange, RC4, and 3DES) and made a fundamental design change: The client guesses which modern key exchange algorithm the server supports and sends its public key share directly inside the very first ClientHello message.

Client                                                  Server
  │                                                       │
  │ ──── SYN ───────────────────────────────────────────> │  [Round Trip 1: TCP Handshake]
  │ <─── SYN-ACK ──────────────────────────────────────── │
  │ ──── ACK + ClientHello (with Key Share) ────────────> │
  │                                                       │  [Round Trip 2: TLS 1.3 Handshake]
  │ <─── ServerHello (with Key Share) + Cert + Finished ─ │
  │                                                       │
  │ ──── GET /api/data (Encrypted HTTP Request) ────────> │  [Round Trip 3: Application Data]
  │ <─── HTTP 200 OK ──────────────────────────────────── │

By completing the TLS negotiation in just one round trip, TLS 1.3 saves an entire RTT cycle for every new visitor.

0-RTT Session Resumption (Early Data)

For returning visitors, TLS 1.3 introduces 0-RTT Resumption.

When a user visits a site, the server issues a cryptographic Pre-Shared Key (PSK) ticket. When that user returns later, the client can encrypt the initial HTTP GET request using that PSK and transmit the application data simultaneously with the ClientHello.

The connection setup latency for encrypted data drops to zero additional round trips beyond TCP!

Security Note on 0-RTT: Because 0-RTT data is transmitted before the server's freshness handshake is verified, it is susceptible to replay attacks. Modern web servers and CDNs only permit idempotent methods (GET and HEAD) over 0-RTT, rejecting POST, PUT, or state-changing API mutations.

5 essential optimizations to minimize TLS latency

1. Upgrade from RSA to ECDSA certificates

Most websites still issue legacy 2048-bit or 4096-bit RSA SSL certificates. However, modern certificates based on Elliptic Curve Digital Signature Algorithm (ECDSA / secp256r1 or ed25519) provide significant performance advantages:

  • Payload Size: A 256-bit ECDSA public key provides the same cryptographic strength as a 3072-bit RSA key, but reduces certificate chain download size by over 70%. Smaller certificates fit into fewer initial TCP packets, avoiding slow-start segmentation delays.
  • Computation Speed: ECDSA signature generation is drastically faster and uses less CPU, accelerating page load speeds on mobile and low-power devices.

Modern CAs like Let's Encrypt support ECDSA out of the box:

certbot certonly --key-type ecdsa --elliptic-curve secp256r1 -d example.com

2. Enable OCSP Stapling (RFC 6066)

When a browser validates an SSL certificate, it checks whether the certificate has been revoked. Without OCSP Stapling, the browser must pause and make a separate DNS lookup and HTTP request to the Certificate Authority's Online Certificate Status Protocol (OCSP) server.

If the CA's OCSP responder is slow or throttled, your user's connection stalls.

OCSP Stapling solves this by having your web server periodically query the CA in the background, cache the signed revocation status, and "staple" that proof directly to the TLS handshake payload. The client gets instant verification without making an external request.

NGINX Configuration:

ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
resolver 1.1.1.1 8.8.8.8 valid=300s;
resolver_timeout 5s;

3. Terminate TLS at the network edge via an Anycast CDN

No amount of code optimization can beat the physics of distance. If your backend server resides in Frankfurt, an Australian user will always experience a 250 ms round trip.

By placing an Anycast Content Delivery Network (such as Cloudflare, Fastly, or CloudFront) in front of your origin, TLS termination occurs at an edge data center situated physically near the user (e.g., in Sydney).

The TCP and TLS handshakes complete in 10–15 milliseconds. The edge proxy then maintains persistent, pre-warmed TCP/TLS keep-alive connection pools across dedicated backbone fibers back to your origin server.

4. Enable ALPN for HTTP/2 and HTTP/3

Application-Layer Protocol Negotiation (ALPN) is a TLS extension that allows the browser and server to negotiate the application protocol (e.g., h2 or http/1.1) directly during the TLS handshake, eliminating the need for an extra HTTP Upgrade round trip.

Ensure your web server configuration includes HTTP/2 support:

listen 443 ssl http2;

5. Deploy HTTP/3 with QUIC (UDP)

The ultimate solution to handshake latency is HTTP/3, which replaces TCP with QUIC running over UDP.

Because QUIC integrates the transport and cryptographic layers into a unified protocol:

  • Initial connection setup requires only 1 round trip total (TCP and TLS happen simultaneously in the same packet!).
  • Connection resumption achieves true 0-RTT.
  • QUIC eliminates Head-of-Line Blocking: In TCP, if a single packet is lost on a poor connection, all subsequent HTTP streams halt until the lost packet is retransmitted. In QUIC over UDP, individual streams operate independently without stalling unaffected assets.

How to measure TLS handshake performance

To diagnose whether SSL latency is dragging down your TTFB:

  1. Run a full synthetic audit: Use the PingXD website performance test to view your waterfall timing breakdown. Compare the relative duration of DNS resolution, TCP connection, SSL handshake, and TTFB.
  2. Benchmark API endpoint handshakes: Use the API speed test to test raw endpoints without browser rendering noise. Inspect whether connection establishment is dominating total response time.
  3. Verify worldwide baseline latencies: Test your origin IP with a multi-location ping test to determine your minimum theoretical RTT from North America, Europe, and Asia.

By enforcing TLS 1.3, enabling OCSP stapling, switching to ECDSA certificates, and leveraging edge termination, you can turn a 400 ms connection bottleneck into a frictionless sub-50 ms entry point for users worldwide.