«   2018/10   »
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Archives
Today
685
Total
1,165,493
안정적인 DNS서비스 DNSEver
관리 메뉴

Blue Breeze

PHP workman Container helloWorld 본문

Language/PHP

PHP workman Container helloWorld

푸른바람 C/H 2018.06.12 08:30

Workerman

composer require workerman/workerman
vi serve.php
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Workerman\Worker;
$worker = new Worker('tcp://0.0.0.0:1337');
$worker->count=3;
$worker->onMessage = function($connection, $data)
{
    $msg = "hello World";
    $connection->send("HTTP/1.1 200 OK\r\nConnection: keep-alive\r\nServer: workerman\r\nContent-Length: ".strlen($msg)."\r\n\r\n{$msg}");
};
Worker::runAll();
php serve.php start -d

#other shell
ab -n 10000 -c 10 -k http://127.0.0.1:1337/
..
Document Path:          /
Document Length:        11 bytes

Concurrency Level:      10
Time taken for tests:   0.094 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    10000
Total transferred:      930000 bytes
HTML transferred:       110000 bytes
Requests per second:    106857.01 [#/sec] (mean)
Time per request:       0.094 [ms] (mean)
Time per request:       0.009 [ms] (mean, across all concurrent requests)
Transfer rate:          9704.79 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     0    0   0.1      0       3
Waiting:        0    0   0.1      0       3
Total:          0    0   0.1      0       3

Percentage of the requests served within a certain time (ms)
  50%      0
  66%      0
  75%      0
  80%      0
  90%      0
  95%      0
  98%      0
  99%      1
 100%      3 (longest request)


'Language > PHP' 카테고리의 다른 글

PHP Laravel Framework helloWorld  (0) 2018.06.15
PHP reactPHP helloWorld  (0) 2018.06.14
PHP workman Container helloWorld  (0) 2018.06.12
php codeignier3 framework helloWorld  (0) 2018.06.11
PHP Slim Framework helloWorld  (0) 2018.06.07
PHP7 event, libevent Installation  (0) 2018.06.06
0 Comments
댓글쓰기 폼