Are you Getting 503 errors? Connection Timeouts?

Discussion in 'PHP' started by robfrew, Jan 11, 2009.

  1. robfrew

    robfrew New Member

    We have recently discovered the reason behind why we were getting a load of 503 errors, connection timeouts and so on with our external PHP (lsapi) processes. We hope we can help others who may be experiencing this problem as well.

    Our average load times were around 2.5 to 3.0 on an 8 core system. We also have 6 gigs of memory. We get a lot of usage because we are a high traffic site. Everything seemed normal but every day around 9 or 10 am, the external processes would runaway and we would get nothing but 503 errors and connection timeouts. Eventually, LSWS would sever those external processes and restart them but there would be around 5 minutes that nobody could connect with us.

    We started playing around with different settings and eventually changed PHP_LSAPI_MAX_REQUESTS to 500 just to see if those external processes would die quicker to avoid the problems. What we found is that the problems we saw every 24 hours started happening a lot quicker. So we upped the PHP_LSAPI_MAX_REQUESTS to 10000 and we found that the problems started happening later, every 48 hours. Well, we did some more research and started reading about persistent connections from PHP to MySql. What we read was that for most sites, this was a bad practice. We began to wonder if this was what was causing the external php processes to hang so we changed our php code to stop using persistent connections and guess what, it fixed our 503 error issues and actually reduced our load averages to .50. It also released a heck of a lot of memory.

    So it is recommended in the PHP/MySql community to NOT use persistent connections for most sites.

    We have created a WIKI for this tip on the LiteSpeed website. Here is the link: http://www.litespeedtech.com/suppor...tespeed_wiki:php_mysql_persistent_connections

    Here is the PHP page for more information on persistent connections: http://us2.php.net/mysql_pconnect
  2. anewday

    anewday Moderator

    Thanks for the tip! George doesn't recommend turning it on either. :)
  3. mistwang

    mistwang LiteSpeed Staff

    Thank you for the wiki and sharing this with us. :)
  4. darenas

    darenas New Member

    Connection Timeout

    Hi,

    I've the same error... :

    connection to [uds://tmp/lshttpd/lsphp5.sock] on request #0, Connection timed out!
    ExtConn timed out while processing.
    connection to [uds://tmp/lshttpd/lsphp5.sock] on request #0, Connection timed out!
    ExtConn timed out while processing.
    connection to [uds://tmp/lshttpd/lsphp5.sock] on request #0, Connection timed out!
    ExtConn timed out while processing.
    connection to [uds://tmp/lshttpd/lsphp5.sock] on request #0, Connection timed out!
    ExtConn timed out while processing.
    connection to [uds://tmp/lshttpd/lsphp5.sock] on request #0, Connection timed out!
    ExtConn timed out while processing.
    connection to [uds://tmp/lshttpd/lsphp5.sock] on request #0, Connection timed out!
    ExtConn timed out while processing.
    connection to [uds://tmp/lshttpd/lsphp5.sock] on request #0, Connection timed out!
    Connection idle time: 11 while in state: 5 watching for event: 25,close!
    Content len: 0, Request line:


    But i don't use the persistents connections... Have you got any idea?

    Thanks.
  5. mistwang

    mistwang LiteSpeed Staff

Share This Page