My web page uses Google charts to produce five graphs. If the graphs are not already cached, I have the following line of code that retrieves the image.
$image = file_get_contents("http://chart.apis.google.com/chart?".$query);
When that code is executed in a loop, it takes 10 seconds to get each image. But, if I change the code as to use one of Google's ip addresses instead of the url:
$image = file_get_contents("http://74.125.93.100/chart?".$query);
It takes less than one second to retrieve the images. So my initial thought was that DNS is not resolving the URL and the delay is from cycling through the assigned DNS servers? So I tried to ping chart.apis.google.com from the server and it immediately returned a reasonable response.
So my question is: Is there any PHP (or Apache2) configuration setting that I may be overlooking that may cause this delay, or does this sound like a server configuration issue?