{"id":780,"date":"2026-08-03T02:01:08","date_gmt":"2026-08-03T02:01:08","guid":{"rendered":"https:\/\/virtualserversvps.com\/blog\/?p=780"},"modified":"2026-08-03T02:01:08","modified_gmt":"2026-08-03T02:01:08","slug":"cutting-web-latency-vps-ttfb-tls-http2","status":"publish","type":"post","link":"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/","title":{"rendered":"Cutting Web Latency on a VPS: TTFB, TLS 1.3, and HTTP\/2 Tuning"},"content":{"rendered":"\n\n<p class=\"wp-block-paragraph\">Time to First Byte (TTFB) is the silent killer of perceived performance. A page can be perfectly optimized on the front end, yet every navigation still feels slow because the server takes 400\u2013800 ms to start responding. On a VPS, much of that delay is not the application \u2014 it is the network and TLS stack: TLS handshake round-trips, HTTP\/1.1 connection churn, missing session resumption, and disabled compression. This guide shows how to measure TTFB precisely and cut it by 200\u2013400 ms with Nginx configuration alone.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before tuning, know your starting point and your hardware&#8217;s limits. The latency your users experience also depends on where your VPS is located relative to them, so choose a provider with a datacenter near your audience \u2014 <a href=\"https:\/\/virtualserversvps.com\/#providers\">our VPS comparison table<\/a> includes region coverage for the major hosts.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Measure TTFB With a Timing Breakdown<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>curl<\/code> can decompose a request into its phases, which tells you exactly where the milliseconds go:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -o \/dev\/null -s -w \\\n  'DNS: %{time_namelookup}s\\nConnect: %{time_connect}s\\nTLS: %{time_appconnect}s\\nTTFB: %{time_starttransfer}s\\nTotal: %{time_total}s\\n' \\\n  https:\/\/your-vps.example.com\/\n\n# Repeat 10x and look at the median:\nfor i in $(seq 1 10); do curl -o \/dev\/null -s -w '%{time_starttransfer}\\n' https:\/\/your-vps.example.com\/; done | sort -n | sed -n '5p'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On a well-configured server in the same region as the test client, expect: DNS &lt; 5 ms, TCP connect &lt; 30 ms, TLS &lt; 50 ms, and TTFB under 150 ms for a cached page. Anything above that is tunable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Enable TLS 1.3 and OCSP Stapling<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">TLS 1.3 reduces the handshake from two round-trips to one \u2014 a 1-RTT saving on every new connection, which is often 30\u201360 ms of latency on cross-continental links. Pair it with OCSP stapling so the server (not the client) fetches certificate revocation status, saving another round-trip for clients that would otherwise check it themselves:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \/etc\/nginx\/conf.d\/tls.conf\nssl_protocols TLSv1.2 TLSv1.3;\nssl_prefer_server_ciphers off;\nssl_stapling on;\nssl_stapling_verify on;\nresolver 1.1.1.1 8.8.8.8 valid=300s;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify with <code>openssl s_client -connect your-vps:443 -brief<\/code> \u2014 you should see <code>TLSv1.3<\/code> and, with stapling, no separate OCSP URL fetch.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Cache TLS Sessions for Reconnects<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Browsers reconnect to your server constantly. A shared session cache lets a returning client skip the full handshake \u2014 for TLS 1.3 this also enables 0-RTT resumption for idempotent requests. Give Nginx a generous shared cache:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssl_session_cache shared:SSL:10m;   # ~40k sessions\nssl_session_timeout 1d;\nssl_session_tickets on;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is one of the cheapest wins on the list: repeat visits and asset requests stop paying the handshake tax entirely.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. Turn On HTTP\/2<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">HTTP\/2 multiplexes many requests over a single connection, eliminating head-of-line blocking and connection churn for pages with dozens of assets. With Nginx it is one line per server block:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>listen 443 ssl http2;\n# (or on newer builds: listen 443 ssl;  http2 on;)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Combined with TLS session caching, HTTP\/2 typically removes 2\u20134 connection round-trips from a page load. Confirm it is active with <code>curl -I --http2 -s https:\/\/your-vps\/ | head -1<\/code> (look for <code>HTTP\/2<\/code>).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. Tune Keepalive and TCP Options<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Keepalive reuses connections instead of rebuilding them, and <code>tcp_nodelay<\/code> disables Nagle&#8217;s algorithm so small responses flush immediately. For the upstream (PHP-FPM) side, an upstream keepalive pool avoids reopening connections to the backend on every request:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># HTTP\/1.1 client keepalive\nkeepalive_timeout 20s;\nkeepalive_requests 1000;\ntcp_nodelay on;\n\n# Upstream keepalive for PHP-FPM\nupstream php {\n    server unix:\/run\/php\/php8.3-fpm.sock;\n    keepalive 32;\n}\nserver {\n    location ~ \\.php$ {\n        fastcgi_pass php;\n        fastcgi_keep_conn on;\n        include fastcgi_params;\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>tcp_nopush<\/code> can be left on for static file responses \u2014 it batches headers and body into fewer packets, which pairs well with <code>sendfile on<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6. Compress Text Assets<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Compression does not change TTFB for the HTML itself much, but it dramatically shortens the transfer phase for CSS, JS, and JSON \u2014 which users perceive as part of &#8220;first byte&#8221; on slow links. Enable gzip (or brotli via the <code>ngx_brotli<\/code> module) with sensible minimum lengths:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gzip on;\ngzip_comp_level 5;\ngzip_min_length 1024;\ngzip_types text\/css application\/javascript application\/json image\/svg+xml;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">7. What the Numbers Should Look Like<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">On a 2 vCPU VPS with a PHP app and a same-region test client, the stack above typically moves TTFB from 350\u2013500 ms to 80\u2013150 ms. The handshake savings (TLS 1.3 + session cache + HTTP\/2) account for most of the improvement on repeat visits; compression and keepalive handle the rest. If TTFB stays above 300 ms after this tuning, profile the application itself \u2014 the bottleneck is then PHP, the database, or an external API call, not the transport layer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Reducing web latency on a VPS is mostly a configuration exercise: TLS 1.3 with OCSP stapling, a shared session cache, HTTP\/2, keepalive, and compression. Measure with <code>curl -w<\/code> before and after each change so you know what actually moved the needle. If your stack still feels slow after tuning, the next lever is application-level caching or a managed platform that bakes this in \u2014 <a href=\"https:\/\/cloudways.com\/en\/?id=2010927&amp;data1=virtualserversvps\" rel=\"noreferrer noopener sponsored\" target=\"_blank\">Cloudways<\/a>, for example, ships with HTTP\/2 and caching enabled out of the box. And when you shop for the VPS itself, remember that datacenter location is the one latency factor no config can fix \u2014 <a href=\"https:\/\/virtualserversvps.com\/#providers\">see the full specs and regions<\/a> on the main site before you buy.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Slow TTFB drives visitors away before they see your page. Measure it with curl, then apply TLS 1.3, OCSP stapling, session caching, HTTP\/2, and keepalive tuning to shave 200\u2013400 ms.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-780","post","type-post","status-publish","format-standard","hentry","category-performance-optimization"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Cutting Web Latency on a VPS: TTFB, TLS 1.3, and HTTP\/2 Tuning - Virtual Servers VPS Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Cutting Web Latency on a VPS: TTFB, TLS 1.3, and HTTP\/2 Tuning\" \/>\n<meta property=\"og:description\" content=\"Cutting Web Latency on a VPS: TTFB, TLS 1.3, and HTTP\/2 Tuning\" \/>\n<meta property=\"og:url\" content=\"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/\" \/>\n<meta property=\"og:site_name\" content=\"Virtual Servers VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-03T02:01:08+00:00\" \/>\n<meta name=\"author\" content=\"Virtual-Servers-Vps-Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virtual-Servers-Vps-Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/\",\"name\":\"Cutting Web Latency on a VPS: TTFB, TLS 1.3, and HTTP\/2 Tuning - Virtual Servers VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\"},\"datePublished\":\"2026-08-03T02:01:08+00:00\",\"author\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\"},\"breadcrumb\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/virtualserversvps.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cutting Web Latency on a VPS: TTFB, TLS 1.3, and HTTP\/2 Tuning\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/\",\"name\":\"Virtual Servers VPS Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\",\"name\":\"Virtual-Servers-Vps-Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"caption\":\"Virtual-Servers-Vps-Editor\"},\"sameAs\":[\"https:\/\/virtualserversvps.com\/blog\"],\"url\":\"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Cutting Web Latency on a VPS: TTFB, TLS 1.3, and HTTP\/2 Tuning - Virtual Servers VPS Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/","og_locale":"en_US","og_type":"article","og_title":"Cutting Web Latency on a VPS: TTFB, TLS 1.3, and HTTP\/2 Tuning","og_description":"Cutting Web Latency on a VPS: TTFB, TLS 1.3, and HTTP\/2 Tuning","og_url":"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/","og_site_name":"Virtual Servers VPS Blog","article_published_time":"2026-08-03T02:01:08+00:00","author":"Virtual-Servers-Vps-Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Virtual-Servers-Vps-Editor","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/","url":"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/","name":"Cutting Web Latency on a VPS: TTFB, TLS 1.3, and HTTP\/2 Tuning - Virtual Servers VPS Blog","isPartOf":{"@id":"https:\/\/virtualserversvps.com\/blog\/#website"},"datePublished":"2026-08-03T02:01:08+00:00","author":{"@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0"},"breadcrumb":{"@id":"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/virtualserversvps.com\/blog\/cutting-web-latency-vps-ttfb-tls-http2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/virtualserversvps.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Cutting Web Latency on a VPS: TTFB, TLS 1.3, and HTTP\/2 Tuning"}]},{"@type":"WebSite","@id":"https:\/\/virtualserversvps.com\/blog\/#website","url":"https:\/\/virtualserversvps.com\/blog\/","name":"Virtual Servers VPS Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0","name":"Virtual-Servers-Vps-Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","caption":"Virtual-Servers-Vps-Editor"},"sameAs":["https:\/\/virtualserversvps.com\/blog"],"url":"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/"}]}},"_links":{"self":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/comments?post=780"}],"version-history":[{"count":2,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/780\/revisions"}],"predecessor-version":[{"id":787,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/780\/revisions\/787"}],"wp:attachment":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/media?parent=780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/categories?post=780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/tags?post=780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}