Lighttpd + FastCGI - Slow PHP

Discussion in 'Site & Server Administration' started by BBNuno, Jun 18, 2011.

  1. #1
    Hi,

    I need help to figure out here is the problem and why a simple php file with echo "teste" sometimes take more than 15s to load. My server have 300 req/s and about 4 milions visitors day, this is the first time I use Lighttpd and I already try a lot of configs on fastcgi but same result.

    Can somenone help me with this?

    Server specs 24GB RAM 8 CORES SSD DISK
     
    BBNuno, Jun 18, 2011 IP
  2. stardust.x7

    stardust.x7 Active Member

    Messages:
    369
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    90
    #2
    Try to use NGNIX and optimize your process limit.
     
    stardust.x7, Jun 18, 2011 IP
  3. BBNuno

    BBNuno Member

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    But Lighttpd can't handle this?
     
    BBNuno, Jun 19, 2011 IP
  4. supportex

    supportex Peon

    Messages:
    66
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #4
    lighttpd can definitly handle it
     
    supportex, Jun 19, 2011 IP
  5. BBNuno

    BBNuno Member

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    What you sugest to check?
     
    BBNuno, Jun 20, 2011 IP
  6. cripperz

    cripperz Active Member

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #6
    You seems to have a very high spec for a server. You might want to check out what causing the loading slow. maybe some external links in the site that is causing that slowness or php script that is taking time to load.

    for a start, try install httpwatch on your browser to see what is loading slower than others. =P

    You can download the httpwatch directly here - http://adf.ly/1tsuS
     
    cripperz, Jun 23, 2011 IP
  7. BBNuno

    BBNuno Member

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #7
    But this happen when I open a php file with echo inside...after the server starts and have about 2000 connections if I open php file ...

     
    BBNuno, Jun 24, 2011 IP
  8. raffo77

    raffo77 Active Member

    Messages:
    234
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #8
    Maybe you forgot cache in nginx and php??
    Check the fastcgi limitation on config files and also report the iowait of this, load average..
     
    raffo77, Jun 30, 2011 IP
  9. BBNuno

    BBNuno Member

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #9
    Config files already try a lot of them, load av it's fine 0 , iowait no idea. How can I chek it?
     
    BBNuno, Jul 1, 2011 IP
  10. raffo77

    raffo77 Active Member

    Messages:
    234
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #10
    paste top command here.
     
    raffo77, Jul 1, 2011 IP
  11. BBNuno

    BBNuno Member

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #11
    top - 15:30:24 up 17:55, 3 users, load average: 0.00, 0.15, 0.16
    Tasks: 647 total, 3 running, 644 sleeping, 0 stopped, 0 zombie
    Cpu0 : 49.2%us, 3.7%sy, 0.0%ni, 44.2%id, 0.0%wa, 0.0%hi, 3.0%si, 0.0%st
    Cpu1 : 25.5%us, 2.6%sy, 0.0%ni, 71.5%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
    Cpu2 : 15.7%us, 1.3%sy, 0.0%ni, 82.6%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
    Cpu3 : 5.0%us, 1.0%sy, 0.0%ni, 94.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
    Cpu4 : 22.8%us, 3.0%sy, 0.0%ni, 73.8%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
    Cpu5 : 13.5%us, 1.6%sy, 0.0%ni, 84.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
    Cpu6 : 2.6%us, 0.7%sy, 0.0%ni, 96.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
    Cpu7 : 2.9%us, 0.0%sy, 0.0%ni, 96.7%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
    Mem: 24726108k total, 7587704k used, 17138404k free, 134620k buffers
    Swap: 1046520k total, 0k used, 1046520k free, 3058428k cached

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    2195 mysql 20 0 431m 87m 4188 S 9.0 0.4 1:54.84 mysqld
    3596 nginx 20 0 218m 11m 4132 S 3.3 0.0 0:00.76 php-cgi
    3106 nginx 20 0 219m 12m 4160 S 3.0 0.1 0:02.02 php-cgi
    3534 nginx 20 0 219m 12m 4136 S 2.7 0.1 0:01.06 php-cgi
    3526 nginx 20 0 219m 12m 4140 S 2.3 0.1 0:00.78 php-cgi
    3582 nginx 20 0 219m 12m 4144 S 2.3 0.1 0:00.98 php-cgi
    4084 nginx 20 0 218m 10m 3860 S 2.3 0.0 0:00.07 php-cgi
    3249 nginx 20 0 219m 12m 4152 S 2.0 0.1 0:01.41 php-cgi
    3257 nginx 20 0 219m 12m 4152 S 2.0 0.1 0:01.32 php-cgi
     
    BBNuno, Jul 1, 2011 IP
  12. BBNuno

    BBNuno Member

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #12
    When I have much connections I start getting errors like "FastCGI sent in stderr: "PHP Warning: file_get_contents() [<a href='function.file-get-contents'>function.file-get-contents</a>]: php_network_getaddresses: getaddrinfo failed: Name or service not known in"
     
    BBNuno, Jul 1, 2011 IP
  13. raffo77

    raffo77 Active Member

    Messages:
    234
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #13
    too much php-cgi process. You must tune fastcgi to work with not much process
     
    raffo77, Jul 3, 2011 IP