sun's longitude:30 08 29 
¡¤ ÀÚÀ¯°Ô½ÃÆÇ ¡¤ ¹¯°í´äÇϱ⠡¤ ¾ËÆĹ®¼­ ¡¤ RPMS list
¡¤ »ç¿ëÀÚ¹®¼­ ¡¤ ÆÁ/FAQ¸ðÀ½ ¡¤ ¸®´ª½ºLinks ¡¤ ÀÚ·á½Ç
¡¤ ¼­¹öÁ¤º¸ ¡¤ ¿î¿µÀÚ ¡¤ Books/FAQ ¡¤ FreeBSD
 
/board/read.php:¼Ò½ºº¸±â   
 
¾ËÆĹ®¼­
ÀÚÁÖ Àؾî¸Ô°Å³ª, ¸Þ¸ðÇØ µÑ Çʿ伺ÀÌ ÀÖ´Â ÆÁÀ̳ª ¹®¼­, ±âŸ µîµî
[*** ¾²±â ±ÝÁö´Ü¾î ÆÐÅÏ ***]
±Û º»¹® Áß°£¿¡ ¾÷·ÎµåÇÒ À̹ÌÁö¸¦ Ãß°¡ÇÏ´Â ¹æ¹ý : @@À̹ÌÁöÀ̸§@@
ex) @@foo.gif@@
119 ¹ø ±Û: [PHP] stream, socket benchmark
±Û¾´ÀÌ: »êÀÌ [ȨÆäÀÌÁö] ±Û¾´³¯: 2005³â 03¿ù 30ÀÏ 23:29:45 ¼ö(Àú³á) Á¶È¸: 3114
php-stream-socket-benchmark.xls020 KB(19,968 Bytes) ÆÄÀϸí: php-stream-socket-benchmark.xls
[PHP] client stream(blocking), socket(blocking/non-blocking) download Benchmark with
server KeepAlive 

2005.03.29 san2(at)linuxchannel.net 

benchmark source :
- http://ftp.linuxchannel.net/devel/php_download/


1. client blocking (fsockopen) benchmark
------------------------------------------------------------------------------------
clinet                        server KeepAlive On  server KeepAlive Off  HTTP
header
------------------------------------------------------------------------------------
NA(feof)                            3965.9 KB/sec*        10718.7KB/sec
Connection                         10882.1 KB/sec         10904.4KB/sec       
close
timeout                             4017.3 KB/sec*        10769.2KB/sec
buf check                           3984.5 KB/sec*        10811.5KB/sec ¡¡ 
Connection + timeout               11094.3 KB/sec         11382.6KB/sec       
close
Connection + buf check             10700.1 KB/sec         11489.4KB/sec       
close
timeout + buf check                10059.0 KB/sec         11073.0KB/sec
Connection + timeout + buf check   10589.5 KB/sec         11497.5KB/sec       
close
------------------------------------------------------------------------------------

PHP guide
(
  Connection: close [+ ...] // <-- recommend
  or
  timeout + buf check [+ ...]
)

example
(
  $req = "GET /path HTTP/1.1\r\nHost: hostname\r\nConnection:
close\r\n\r\n";
  $fp = fscokopen(...);
  stream_set_timeout($fp,0,500000); // some recommend
  fwrite($fp,$req);
  while($buf = fread($fp,4096))
  {
      $rbuf .= $buf;
      ...
  }
  fclose($fp);
)


2. client blocking (socket) benchmark
------------------------------------------------------------------------------------
clinet                        server KeepAlive On  server KeepAlive Off  HTTP
header
------------------------------------------------------------------------------------
NA(socket_read)                      4014.9KB/sec*        11463.8KB/sec
Connection                          11491.0KB/sec         11465.4KB/sec       
close
timeout                             11372.2KB/sec         11482.3KB/sec
buf(1M)                              4007.5KB/sec*        11294.7KB/sec
Connection + timeout                11373.5KB/sec         11496.8KB/sec       
close
Connection + buf(1M)                11500.8KB/sec         11017.5KB/sec       
close
timeout + buf(1M)                   11373.2KB/sec         11499.9KB/sec
Connection + timeout + buf(1M)      11369.1KB/sec         11378.3KB/sec       
close
------------------------------------------------------------------------------------

PHP guide
(

  Connection: close [+ ...]
  or
  timeout [+ ...]
)

example
(
  $req = "GET /path HTTP/1.1\r\nHost: hostname\r\nConnection:
close\r\n\r\n";
  $timeout = array('sec'=>0,'usec'=>500000);
  $sock = socket_create(...);
  socket_set_option($sock,...,SO_RCVTIMEO,$timeout); // some recommend
  socket_connect(...);
  socket_write($sock,$req);
  while($buf = socket_read($sock,1048576))
  {
      $rbuf .= $buf;
      ...
  }
  socket_close($sock);
)


3. client non-blocking (socket) benchmark
------------------------------------------------------------------------------------
clinet                        server KeepAlive On  server KeepAlive Off  HTTP
header
------------------------------------------------------------------------------------
NA(socket_read)                     11352.4KB/sec            CLOSE_WAIT*
Connection                             CLOSE_WAIT*           CLOSE_WAIT*      
close
timeout                             11343.1KB/sec            CLOSE_WAIT*
buf(1M)                             11361.0KB/sec            CLOSE_WAIT*
Connection + timeout                   CLOSE_WAIT*           CLOSE_WAIT*      
close
Connection + buf(1M)                   CLOSE_WAIT*           CLOSE_WAIT*      
close
timeout + buf(1M)                   11359.1KB/sec            CLOSE_WAIT*
Connection + timeout + buf(1M)         CLOSE_WAIT*           CLOSE_WAIT*      
close
------------------------------------------------------------------------------------

PHP guide
(
  buf check [+ ...]
)

example
(
  $req = "GET /path HTTP/1.1\r\nHost: hostname\r\nConnection:
close\r\n\r\n";
  $timeout = array('sec'=>0,'usec'=>500000);
  $sock = socket_create(...);
  socket_set_option($sock,...,SO_RCVTIMEO,$timeout); // some recommend
  socket_connect(...);
  socket_write($sock,$req);
  socket_set_nonblock($sock); // set to non-blocking mode
  $stream = array($sock);
  while(@socket_select($stream,$write=NULL,$except=NULL,0,500000) !== FALSE)
  {
      if(!in_array($sock,$stream)) break;
      if($buf = @socket_read($sock,1048576))
      {
            $rbuf .= $buf;
            ...
      } else break; // good idea, EOF, buf check
  }
  socket_close($sock);
)


4. client non-blocking buf check (socket) benchmark

------------------------------------------------------------------------------------
clinet                        server KeepAlive On  server KeepAlive Off  HTTP
header
------------------------------------------------------------------------------------
NA(socket_read)                     10870.7KB/sec         11455.9KB/sec
Connection                          11488.1KB/sec         11481.9KB/sec       
close
timeout                             10869.7KB/sec         11165.4KB/sec
buf(1M)                             10872.9KB/sec         11494.5KB/sec
Connection + timeout                10903.7KB/sec         11496.6KB/sec       
close
Connection + buf(1M)                11500.6KB/sec         11500.2KB/sec       
close
timeout + buf(1M)                   10880.3KB/sec         11399.8KB/sec
Connection + timeout + buf(1M)      11500.1KB/sec         11498.4KB/sec       
close
------------------------------------------------------------------------------------

PHP guide
(
  buf check [+ ...]
)


example
(
  same as above example
)


EOF

 
ÀÌÀü±Û : [Javascript] object squick reference
´ÙÀ½±Û : [ETC] 2005³âµµ ÀϽİú ¿ù½Ä  
 from 211.243.181.98
JS(Redhands)Board 0.4 +@

|±Û¾²±â| |´äÀå¾²±â| |¼öÁ¤| |»èÁ¦|
|ÀÌÀü±Û| |´ÙÀ½±Û| |¸ñ·Ïº¸±â|
Àμâ¿ë 

apache lighttpd linuxchannel.net 
Copyright 1997-2024. linuxchannel.net. All rights reserved.

Page loading: 0.03(server) + (network) + (browser) seconds