Starting the performance journey. TTFB

PHPz
Release: 2024-07-18 06:12:39
Original
345 people have browsed it

Starting the performance journey. TTFB

We start the journey by typing www.ourwebsite.com, this will send a get request to our server to retrieve the page's HTML. So our first task is to make this retrieval fast.

This step is indicated by a metric - TTFB, Time to First Byte

TTFB is not the most important, but as its the first that means it will affect every other coming metric.

TTFB matters more in client side rendered applications than in server side rendered, as Client sides totally depends on js files populating it.

All sites should strive for TTFB of 0.8 seconds or less, you can measure the TTFB with lighthouse or other profiling tools, it will be shown as "Initial server response time".

Here are some way to optimise TTFB

  • Hosting - Make sure you have good hosting provider, allocate sufficient memory space, configure server settings.

  • Use CDN for serving static files, JS,HTML,CSS and images.

  • Send resources in chunks

  • Send 103 Early Hints for render-critical resources: "The 103 Early hints header is an early response code that the server can send to the browser while the backend is busy preparing markup. This header can be used to hint to the browser that there are render-critical resources the page should begin downloading while the markup is being prepared." Google, web.dev

The above is the detailed content of Starting the performance journey. TTFB. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!