|
Posted by joel.washburn on 09/29/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
[Back to original message]
|