Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Slow PHP page load - solution but not obvious

James
2005-08-14
2013-04-24
  • James
    James
    2005-08-14

    I've been running the PHP/SQL version for a while and couln't figure why my pages were taking so long.  Spent a while trying to see how to optimize the PHP and SQL queries, but the odd thing was that running top on the server showed long periods with no CPU activity from either httpd or mysqld.

    Turns out that the culprit is the php function gethostbyip - if you don't have a dns with entries for every host on your list then it simply waits ages for the o/s level timeout which can be up to 5 seconds.

    Removing the offending elements from the code has reduced my page loads from 249 to 5 seconds!