You are here: fread using 99% CPU in Windows with SSL Connection « PHP Programming Language « IT news, forums, messages
fread using 99% CPU in Windows with SSL Connection

Posted by joel.washburn on 10/03/89 11:40

I'm looking for some information on why fread calls max out CPU usage
on SSL connections in windows. I've tried upgrading PHP (now at 5.1.2)
and OpenSSL (now 9.8) but cannot stop fread() from slamming the
processor on long network requests.

Below is a simple way to reproduce the problem with fgets():

Create two files, one (timer.php) has to be accessable from the web
(HTTP and HTTPS) and the other can be ran from the command prompt
(pingtimer.php). When you run pingtimer.php using SSL, php.exe will
stick at 99% CPU in Task Manager. When you run it using clean sockets,
its idle while waiting for a response.

timer.php :
<?php
sleep(10);
print "<html><body>10 sec. are up!</body></html>";
?>

pingtimer.php:
<?php
//$sock = fsockopen("localhost", 80);
$sock = fsockopen("ssl://localhost", 443);

$query = "GET /timer.php HTTP/1.1\r\n";
$query .= "Host: localhost\r\n";
$query .= "Connection: Close\r\n\r\n";

fwrite($sock, $query);
while (!feof($sock)) {
echo fgets($sock, 128);
}
fclose($sock);
?>

Any info (background, workaround, etc...) would be helpful.

- Joel

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация