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

后端 未结 7 2011
离开以前
离开以前 2020-12-24 03:20

if you go to the homepage, you\'ll see that before the page loads, the browser waits ...

How i could reduce Time for the first byte?

7条回答
  •  心在旅途
    2020-12-24 03:36

    Nobody can give you a detailed answer without you showing the code responsible for generating the content of the site - because that's where the delay is.

    However, since the site is using php, you are most likely using output buffering

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

    
    
    
        
            Slow to Load, Slow to finish
        
        
        
        
    
    

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

    
    
        
            Fast to load, Slow to finish
        
        
            
            
        
    
    

    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.

    IMPORTANT: There are a lot of frontend changes you should make before focussing on TTFB.

提交回复
热议问题