|
Posted by noone on 09/30/76 11:40
joel.washburn@gmail.com wrote:
> 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
>
whatelse is the CPU supposed to do?
let's see:
do I/O to the network
encrypt the message
open the socket - get data from remote
decrypt the SSL data
move it somewhere (memory/disk)
more processing to display it.
If your CPU is not busy doing other things, it should take as much as it
needs to get the job done.
Navigation:
[Reply to this message]
|