크롬 Waiting TTFB - keulom Waiting TTFB

156

New! Save questions or answers and organize your favorite content.
Learn more.

I have a query which involves getting a list of user from a table in sorted order based on at what time it was created. I got the following timing diagram from the chrome developer tools.

크롬 Waiting TTFB - keulom Waiting TTFB

You can see that TTFB (time to first byte) is too high.
I am not sure whether it is because of the SQL sort. If that is the reason then how can I reduce this time?
Or is it because of the TTFB. I saw blogs which says that TTFB should be less (< 1sec). But for me it shows >1 sec. Is it because of my query or something else?
I am not sure how can I reduce this time.
I am using angular. Should I use angular to sort the table instead of SQL sort? (many posts say that shouldn't be the issue)
What I want to know is how can I reduce TTFB. Guys! I am actually new to this. It is the task given to me by my team members. I am not sure how can I reduce TTFB time. I saw many posts, but not able to understand properly. What is TTFB. Is it the time taken by the server?

Web_Designer

69.9k89 gold badges203 silver badges261 bronze badges

asked Feb 18, 2015 at 10:08

3

The TTFB is not the time to first byte of the body of the response (i.e., the useful data, such as: json, xml, etc.), but rather the time to first byte of the response received from the server. This byte is the start of the response headers.

For example, if the server sends the headers before doing the hard work (like heavy SQL), you will get a very low TTFB, but it isn't "true".

In your case, TTFB represents the time you spend processing data on the server.

To reduce the TTFB, you need to do the server-side work faster.

크롬 Waiting TTFB - keulom Waiting TTFB

Sam

7,16515 gold badges45 silver badges65 bronze badges

answered May 20, 2015 at 18:30

4

I have met the same problem. My project is running on the local server. I checked my php code.

$db = mysqli_connect('localhost', 'root', 'root', 'smart');

I use localhost to connect to my local database. That maybe the cause of the problem which you're describing. You can modify your HOSTS file. Add the line

127.0.0.1 localhost.

크롬 Waiting TTFB - keulom Waiting TTFB

BuZZ-dEE

5,32310 gold badges62 silver badges91 bronze badges

answered Apr 6, 2016 at 1:39

크롬 Waiting TTFB - keulom Waiting TTFB

CH ChowCH Chow

4174 silver badges6 bronze badges

4

TTFB is something that happens behind the scenes. Your browser knows nothing about what happens behind the scenes.

You need to look into what queries are being run and how the website connects to the server.

This article might help understand TTFB, but otherwise you need to dig deeper into your application.

answered Mar 4, 2015 at 11:10

AncientSwordRageAncientSwordRage

7,00314 gold badges82 silver badges163 bronze badges

If you are using PHP, try using <?php flush(); ?> after </head> and before </body> or whatever section you want to output quickly (like the header or content). It will output the actually code without waiting for php to end. Don't use this function all the time, or the speed increase won't be noticable.

More info

answered Aug 2, 2015 at 21:49

크롬 Waiting TTFB - keulom Waiting TTFB

I would suggest you read this article and focus more on how to optimize the overall response to the user request (either a page, a search result etc.)

A good argument for this is the example they give about using gzip to compress the page. Even though ttfb is faster when you do not compress, the overall experience of the user is worst because it takes longer to download content that is not zipped.

크롬 Waiting TTFB - keulom Waiting TTFB

Raptor

51.9k44 gold badges222 silver badges356 bronze badges

answered Jul 6, 2015 at 9:22

MikeMike

3,0071 gold badge33 silver badges47 bronze badges

1