Very slow fread() in function parseResponeFile($fp) in RPC.php
| From: | Christian Marcos | Date: | Mon, 26 Nov 2007 17:40:41 +0000 |
| Subject: | Very slow fread() in function parseResponeFile($fp) in RPC.php | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-48603@lists.php.net to get a copy of this message | ||
Hi! I'm setting up Openads on a dedicated server for my webbsite and I'm trying to use XML-RPC for invocation since it seems to be the fastest method for end users in particular.
I have implemented everything and banners are fetched OK, although it's very slow. Each fetch increases page load with 0.12 seconds, and with 10 banners that becomes way to much. I have pin point measured execution times in RPC.php since I came to conclution it may not be OpenAds related and I found out that most of the time is spent in the function "parseResponseFile($fp)" in RPC.php, and in particular by the PHP-function fread().
I've installed pear-XML_RPC from the FreeBSD ports collection and I'm running FreeBSD 6.2-RELEASE with Apache 2.2.4 and PHP 5.2.5
This is how it could look like. A timer is started when page is loaded then plotted just before the while-loop with fread(), and then plotted again right after to see how much time was spent there:
0.0030639171600342 seconds
while ($data = @fread($fp, 8192)) { ... }
0.12888193130493 seconds.
Any ideas would be appreciated.
Thanks,
Christian