How to reduce the "Time for the first byte" on my website?

Answer

Given that's the case, the following code will give a TTFB of (network latency +) 2s:

<?php ob_start(); ?>
<!doctype html>
<html>
    <head>
        <title>Slow to Load, Slow to finish</title>
    </head>
    <body>
    <?php
        sleep(2); // Simulate slow processing
        echo "Body"
    ?>
    </body>
</html>

Whereas this will give you a TTFB of (network latency +) 0s:

<!doctype html>
<html>
    <head>
        <title>Fast to load, Slow to finish</title>
    </head>
    <body>
        <?php ob_start(); ?>
        <?php
            sleep(2); // Simulate slow processing
            echo "Body"
        ?>
    </body>
</html>

The time to load the whole page is the same in both cases - only where the delay is changes. If you are specifically focussed on reducing TTFB (why), that should give you enough information to investigate further.

 

All dns Questions

Ask your interview questions on dns

Write Your comment or Questions if you want the answers on dns from dns Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---