TTFB: Why Time To First Byte is important for both SEO and LLMs
Time To First Byte (TTFB) is one of the most critical, yet overlooked, performance metrics for websites. While most focus on page load time or visual rendering, TTFB is the first indicator of how responsive your site is — and that matters both for search engines and AI crawlers. Slow TTFB can mean that AI systems crawl fewer pages, prioritize your content lower, or give up crawling your site entirely. This guide explains what TTFB is, why it matters, and how to optimize it.
TTFB: Why Time To First Byte is important for both SEO and LLMs
Time To First Byte (TTFB) is one of the most critical, yet overlooked, performance metrics for websites. While most focus on page load time or visual rendering, TTFB is the first indicator of how responsive your site is — and that matters both for search engines and AI crawlers. Slow TTFB can mean that AI systems crawl fewer pages, prioritize your content lower, or give up crawling your site entirely. This guide explains what TTFB is, why it matters, and how to optimize it.
What is TTFB?
Time To First Byte (TTFB) is the time from when a browser/crawler sends an HTTP request until it receives the first byte of data from the server.
Components of TTFB:
DNS lookup — Time to translate domain name to IP address
Connection time — Time to establish TCP connection
SSL/TLS handshake — Time to establish HTTPS connection (if applicable)
Server processing time — Time the server takes to generate response
Network latency — Time it takes for the first byte to travel back
Formula:
TTFB vs. other metrics
TTFB measures server responsiveness before any content is sent.
FCP (First Contentful Paint) measures when the first visual content renders.
LCP (Largest Contentful Paint) measures when the main element is loaded.
TTFB happens first — it is the foundation for all other load metrics.
Why TTFB matters for AI crawlers
1. Crawler budgets
AI crawlers (and search engines) have limited time per site. If your TTFB is slow, they crawl fewer pages before their time budget runs out.
Example:
Site A: TTFB = 200ms → Crawler gets to crawl 500 pages in 5 minutes
Site B: TTFB = 2000ms → Crawler only gets to crawl 150 pages in 5 minutes
Site A gets 3x more crawl coverage.
2. Crawl prioritization
Crawlers prioritize fast sites. If your TTFB is consistently slow, crawlers will:
Return less frequently
Crawl fewer pages per visit
Prioritize competitors' sites
3. Data quality
Long TTFB can result in timeouts. AI gets incomplete data or gives up entirely.
Google's guidance:
Good TTFB: < 600ms
Okay TTFB: 600ms - 1200ms
Bad TTFB: > 1200ms
The same applies to AI crawlers.
Why TTFB also matters for SEO
Google has confirmed that TTFB is a ranking factor via Core Web Vitals indirectly (it affects LCP).
Impact:
Slow TTFB → Slow LCP → Worse ranking
Fast TTFB → Fast LCP → Better ranking
Measure your current TTFB
Browser DevTools (Chrome)
Open Chrome DevTools (F12)
Go to Network tab
Refresh the page
Click on the first request (typically your HTML document)
TTFB is broken down into several components. Identify bottlenecks:
1. DNS Lookup (should be < 20ms)
Problem: Slow DNS resolver.
Test:
Solution:
Use fast DNS provider (Cloudflare DNS, Google DNS)
Enable DNS prefetching:
<linkrel="dns-prefetch"href="//ditwebsite.dk">
<linkrel="dns-prefetch"href="//ditwebsite.dk">
<linkrel="dns-prefetch"href="//ditwebsite.dk">
2. Connection time (should be < 50ms)
Problem: Geographic distance to server or slow network.
Solution:
Use Content Delivery Network (CDN) to be closer to users/crawlers
Reduce number of connections (HTTP/2 helps)
3. SSL/TLS handshake (should be < 100ms)
Problem: Slow SSL negotiation.
Test:
openssl s_time -connect ditwebsite.dk:443 -www
openssl s_time -connect ditwebsite.dk:443 -www
openssl s_time -connect ditwebsite.dk:443 -www
Solution:
Enable TLS 1.3 (faster handshake)
Use OCSP stapling
Enable HTTP/2 or HTTP/3
4. Server processing time (should be < 200ms)
Problem: Slow backend or database queries.
This is typically the biggest bottleneck.
Identify:
Check server logs for slow requests
Use APM tools (New Relic, Datadog)
Profile database queries
Optimize server processing time
This is where you get the biggest impact.
1. Implement caching
Server-side caching:
Use Redis or Memcached to cache database results.
Example (PHP with Redis):
<?php
$redis = new Redis();$redis->connect('127.0.0.1',6379);$cache_key = 'homepage_data';$data = $redis->get($cache_key);if(!$data){// Data not in cache, fetch from database$data = fetch_from_database();$redis->setex($cache_key,3600,serialize($data));// Cache for 1 hour}else{$data = unserialize($data);}echojson_encode($data);
<?php
$redis = new Redis();$redis->connect('127.0.0.1',6379);$cache_key = 'homepage_data';$data = $redis->get($cache_key);if(!$data){// Data not in cache, fetch from database$data = fetch_from_database();$redis->setex($cache_key,3600,serialize($data));// Cache for 1 hour}else{$data = unserialize($data);}echojson_encode($data);
<?php
$redis = new Redis();$redis->connect('127.0.0.1',6379);$cache_key = 'homepage_data';$data = $redis->get($cache_key);if(!$data){// Data not in cache, fetch from database$data = fetch_from_database();$redis->setex($cache_key,3600,serialize($data));// Cache for 1 hour}else{$data = unserialize($data);}echojson_encode($data);
-- Bad: Multiple joins without proper indexesSELECT * FROM orders
JOIN users ON orders.user_id = users.id
JOIN products ON orders.product_id = products.id
WHERE users.country = 'DK';
-- Good: Add composite indexesCREATE INDEX idx_user_country ON users(country, id);
CREATE INDEX idx_product_id ON products(id)
-- Bad: Multiple joins without proper indexesSELECT * FROM orders
JOIN users ON orders.user_id = users.id
JOIN products ON orders.product_id = products.id
WHERE users.country = 'DK';
-- Good: Add composite indexesCREATE INDEX idx_user_country ON users(country, id);
CREATE INDEX idx_product_id ON products(id)
-- Bad: Multiple joins without proper indexesSELECT * FROM orders
JOIN users ON orders.user_id = users.id
JOIN products ON orders.product_id = products.id
WHERE users.country = 'DK';
-- Good: Add composite indexesCREATE INDEX idx_user_country ON users(country, id);
CREATE INDEX idx_product_id ON products(id)
3. Upgrade server resources
Check server load:
top# See CPU usage and memory usage
htop
# More user-friendly alternative
top# See CPU usage and memory usage
htop
# More user-friendly alternative
top# See CPU usage and memory usage
htop
# More user-friendly alternative
If consistently high (>80% CPU):
Upgrade CPU
Add more RAM
Use load balancing
4. Use a CDN
Content Delivery Networks cache content geographically close to users/crawlers.
Popular CDNs:
Cloudflare — Free tier available, excellent for small-medium sites
AWS CloudFront — Highly scalable
Fastly — Great performance, more technical
BunnyCDN — Budget-friendly
How CDN improves TTFB:
Without CDN:
User in US requests site hosted in Europe
TTFB = 500ms (200ms network latency + 300ms server processing)
TTFB is a critical metric both for SEO and AI visibility. Slow TTFB means fewer pages crawled, lower prioritization, and potentially incomplete data for AI systems. Most sites can improve TTFB with caching (server-side and full-page), database optimization, and use of CDN.
Start by measuring your current TTFB, identify the biggest bottleneck (typically server processing), and implement caching. For most sites, it's possible to get under 600ms with basic optimization, and under 300ms with CDN and aggressive caching.
Remember: TTFB is the foundation — all other performance metrics depend on it. Optimize TTFB first, then FCP and LCP.