O que é TTFB (Time to First Byte)?
Definição Rápida
O TTFB mede o tempo desde que um browser solicita uma página até receber o primeiro byte de dados do servidor, servindo como indicador do tempo de resposta do servidor.
Time to First Byte (TTFB) is a performance metric that measures the duration between a user's browser sending a request and receiving the very first byte of the server's response. It captures three phases: the time to send the request, the time the server takes to process it, and the time for the first byte to travel back.
A good TTFB is under 200 milliseconds. Between 200-500ms is acceptable, and anything over 600ms indicates a performance problem. Google considers TTFB when evaluating page experience, though it's not one of the Core Web Vitals.
Several factors affect TTFB. Server processing time depends on how long it takes to run database queries, execute server-side code, and generate the response. Network latency is the physical travel time between the user and server (which a CDN can reduce). DNS resolution time is how long it takes to convert your domain name to an IP address.
Common causes of slow TTFB include overloaded or underpowered servers, unoptimized database queries, lack of server-side caching, slow third-party API calls during page generation, and no CDN (meaning all requests go to a single origin server). Each of these can be diagnosed and improved with targeted optimizations.
Por Que é Importante
TTFB is the starting gun for your page load. Nothing else can happen until the browser receives that first byte. A slow TTFB delays everything: the HTML document, the CSS, the JavaScript, the images. It's the foundation that all other performance metrics build on.
For businesses, TTFB directly impacts user experience and conversion rates. If your server takes 2 seconds to respond before the browser can even start rendering the page, users on slower connections might wait 5+ seconds for a usable page.
Exemplos Reais
A WordPress site with a TTFB of 1.8 seconds implemented server-side caching and reduced it to 150ms, cutting total page load time by more than half
An e-commerce platform discovered their TTFB was 900ms due to slow database queries; adding database indexes and query caching brought it down to 120ms
A media site moved their origin server from a single US location to a CDN with edge caching, reducing TTFB for European users from 800ms to 80ms
A SaaS dashboard reduced their TTFB from 1.2 seconds to 200ms by pre-computing frequently accessed data and caching the results
Termos Relacionados
Core Web Vitals
As Core Web Vitals são três métricas específicas definidas pela Google que medem a experiência real dos utilizadores nos websites: desempenho de carregamento (LCP), interactividade (INP) e estabilidade visual (CLS).
CDN (Content Delivery Network)
Uma CDN é uma rede de servidores distribuídos geograficamente que entrega conteúdo web aos utilizadores a partir do servidor mais próximo, reduzindo os tempos de carregamento.
Caching
O caching é o processo de armazenar cópias de dados ou ficheiros numa localização temporária para que os pedidos futuros possam ser servidos mais rapidamente.
LCP (Largest Contentful Paint)
O LCP mede o tempo necessário para que o maior elemento de conteúdo visível numa página — como uma imagem hero ou um título — seja totalmente renderizado.
Precisa de ajuda com ttfb (time to first byte)?
A nossa equipa pode ajudá-lo a colocar este conceito em prática. Obtenha uma consulta gratuita para falar sobre o seu projecto.