1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

272 ms First Byte Time

Discussion in 'Apache' started by postcd, May 4, 2014.

  1. #1
    Hello,

    the blank test page on server i manage has 272 ms First Byte Time which is too high. WebPagetest.org advices "213 ms Target First Byte Time"

    The full page speed test: http://www.webpagetest.org/result/140504_7G_KEX/

    Please can anyone help me to discover the cause of this high first byte time? here is serv. inf_o

    server dont appears to be overloaded. i will try to do any linux command which can lead into solution of this case. Thank you
     
    Last edited: May 4, 2014
    postcd, May 4, 2014 IP
  2. billzo

    billzo Well-Known Member

    Messages:
    961
    Likes Received:
    278
    Best Answers:
    15
    Trophy Points:
    113
    #2
    I do not think that first byte time is too high at all. I just tested on a VPS with zero load and the first byte time was 0.257 seconds. I tested Google's home page and the first byte time was 0.580 seconds. Google has probably the most extensive and one of the highest performance data networks in the world. Maybe you are expecting too much?
     
    billzo, May 4, 2014 IP
  3. postcd

    postcd Well-Known Member

    Messages:
    1,037
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    190
    #3
    I think You are wrong. I used page speed tester (http://tools.pingdom.com/fpt/#!/cv4bnh/internetlifeforum.com/blank.php) which server is located in same City like my website and this tester connected to my server in 2 miliseconds. Then it waited 200 long miliseconds to get the reply.
    I want to know why my server takes such long time to respond blank page request....
     
    postcd, May 6, 2014 IP
  4. billzo

    billzo Well-Known Member

    Messages:
    961
    Likes Received:
    278
    Best Answers:
    15
    Trophy Points:
    113
    #4
    Run the uptime command in your terminal. It will report the server load in three figures: 1 minute average, 5 minute average, 15 minute average. The output will look like this:

    18:32:02 up 27 days, 18:42, 1 user, load average: 0.04, 0.04, 0.01

    The three numbers at the end will be different according to your server's load. If you do not want to do it by terminal, you can stick this in a PHP file and it will output your load averages:

    <?php
    print_r(sys_getloadavg());
    ?>
    Code (markup):
    Are you using Apache with AllowOverrides set to allow use of htaccess files? That has a big negative impact on performance. And what is the first byte time when you use access static HTML? If you have htaccess enabled, the server must check for any htaccess files in the current directory and all parent directories before it starts doing anything. Other things can slow down things like using output compression.

    What is you PHP setup? Are you running PHP as a module or CGI/FastCGI setup?

    Also, it looks like you are using PHP 5.3. That is old. Newer versions of PHP have been benchmarked to show performance gains over 5.3.

    There are a lot of variables when it comes to server performance tuning and you can spend many hours finding ways to shave a few milliseconds off each request. If you have very high traffic, it may be worthwhile. Otherwise, you are going to be wasting your time.
     
    billzo, May 6, 2014 IP
  5. postcd

    postcd Well-Known Member

    Messages:
    1,037
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    190
    #5
    billzo, thx for valuable info.

    Test HTML page was proper fast: http://tools.pingdom.com/fpt/#!/ePwAGu/http://internetlifeforum.com/test.html
    Connect: 2ms, Wait 3ms, Receive 7ms
    so it appears its in Apache..?

    Yes, i have allow override, because im hosting more people who need to be able edit .htaccess

    zlib.output_compression = Off
    output_buffering = Off
    mod deflate = On - http://www.whatsmyip.org/http-compr...vL2ludGVybmV0bGlmZWZvcnVtLmNvbS90ZXN0Lmh0bWw=
    I got impression output compression (mod deflate?) is a good thing that actually speedup site load..

    uptime:
    07:46:18 up 8 days, 2:15, 0 users, load average: 2.21, 2.65, 2.53
    i have 8 cores assigned to a VPS

    Im running PHP 5.3, CGI, Suexec
    Im using 5.3 because many scripts (not just my scripts) started throwing various errors at 5.4 (even Namecheap uses 5.3)

    Any ideas please?
    Thank you
     
    postcd, May 7, 2014 IP
  6. billzo

    billzo Well-Known Member

    Messages:
    961
    Likes Received:
    278
    Best Answers:
    15
    Trophy Points:
    113
    #6
    No, it's the way you have PHP setup with Apache. Doing a CGI is necessary if hosting multiple accounts so each account runs under its own user. But it has a negative impact on performance. If someone has a dedicated server or VPS, the recommended method of using PHP with Apache is as a module because it is faster than CGI.

    Using .htaccess files has a big negative impact on performance as well. One blog article I read recently about benchmarking Apache showed that enabling .htaccess resulted in it taking 3 - 4 times longer to server static HTML than with AllowOverrides set to None. I don't know how much of a performance decline .htaccess causes, but it will be some.

    I am not an expert in the area. But I have read that PHP-FPM offers the benefits of CGI with higher performance. But that is only with Apache 2.4.

    http://wiki.apache.org/httpd/PHP-FPM

    http://httpd.apache.org/docs/2.2/howto/htaccess.html

    You may be expecting performance that you cannot get with your current setup.

    http://chriswiegman.com/2011/10/fastcgi-vs-suphp-vs-cgi-vs-mod_php-dso/
     
    billzo, May 7, 2014 IP