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)
See Timing tab
You will see:
PageSpeed Insights
Enter your URL
See "Server response time" under diagnostics
WebPageTest
Enter your URL and select test location
See "Time to First Byte" in results
WebPageTest also shows:
TTFB per request (not just first HTML)
Breakdown of DNS, Connect, SSL, Wait
Command-line test with curl
Python script for bulk testing
Identify what makes your TTFB slow
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:
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:
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):
Full-page caching:
Cache entire HTML responses.
Nginx example:
2. Optimize database queries
Problem: N+1 queries or unindexed queries.
Identify slow queries (MySQL):
Solutions:
Add indexes:
Use query caching:
Optimize JOINs:
3. Upgrade server resources
Check server load:
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)
With CDN:
User in US requests → CDN edge server in US
TTFB = 150ms (20ms network latency + 130ms cache hit)
5. Enable Gzip/Brotli compression
Compression reduces response size, speeding up transfer time.
Nginx config:
Apache config:
6. Reduce server-side processing
Minimize:
Heavy computations on each request
External API calls
File I/O operations
Example (Python Flask):
7. Use HTTP/2 or HTTP/3
HTTP/2 allows multiplexing, reducing connection overhead.
Enable HTTP/2 (Nginx):
Test if HTTP/2 is enabled:
Optimize specifically for AI crawlers
1. Prioritize important pages
Ensure your most important pages (homepage, key products, top articles) have the fastest TTFB.
Nginx: Separate cache for key pages:
2. Detect and optimize for crawlers
Serve cached version to crawlers:
3. Pre-warm cache before crawler visits
If you know when crawlers visit (e.g., after sitemap submission), pre-warm the cache:
Monitor TTFB continuously
Setup automated monitoring
Pingdom:
Create account at pingdom.com
Add URL checks
Set alert threshold (e.g., "alert if TTFB > 800ms")
UptimeRobot:
Free monitoring every 5 minutes
Email alerts
Custom script (cron job):
Run every hour:
TTFB targets
Google's recommendations
Good: < 600ms
Needs improvement: 600ms - 1200ms
Poor: > 1200ms
For AI crawlers (recommendations)
Excellent: < 300ms (gets highest crawl priority)
Good: 300ms - 600ms (normal crawl rate)
Acceptable: 600ms - 1000ms (lower crawl rate)
Poor: > 1000ms (risk of incomplete crawls)
Common TTFB issues and fixes
Problem | Symptom | Solution |
|---|---|---|
No caching | TTFB > 1000ms on all requests | Implement Redis/Memcached |
Slow database | TTFB high on dynamic pages | Add indexes, optimize queries |
No CDN | High TTFB for international traffic | Enable Cloudflare or AWS CloudFront |
Server overload | TTFB spikes during traffic | Scale up server or add load balancing |
Unoptimized code | TTFB inconsistent | Profile code, remove bottlenecks |
External API calls | TTFB high, variable | Cache API responses, use async calls |
Implementation Checklist
Use this checklist to improve TTFB:
Measure baseline TTFB — Use PageSpeed Insights or WebPageTest
Identify bottleneck — DNS, connection, SSL, or server processing?
Implement server-side caching — Redis/Memcached for database results
Enable full-page caching — For static or semi-static pages
Optimize database queries — Add indexes, remove N+1 queries
Enable Gzip/Brotli — Compress responses
Use CDN — Cloudflare, AWS CloudFront, or BunnyCDN
Enable HTTP/2 — Reduce connection overhead
Monitor TTFB — Setup Pingdom or custom monitoring
Test with curl — Verify improvements
Conclusion
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.