webmen等框架真的比php-fpm快吗?

发布时间 2023-12-21 10:36:03作者: 冯元春

php-fpm + nginx

代码

<?php
        usleep(100000);
        echo "hello world";
?>

wrk -c 200 -t 50 -d 10s http://127.0.0.1/

Running 10s test @ http://127.0.0.1/
  50 threads and 200 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.11s   554.60ms   1.99s    58.23%
    Req/Sec     8.81     11.11    30.00     70.95%
  477 requests in 10.01s, 93.16KB read
  Socket errors: connect 0, read 0, write 0, timeout 398
Requests/sec:     47.64
Transfer/sec:      9.30KB

QPS 42

webman 直接启动

wrk -c 1000 -t 50 -d 10s http://127.0.0.1:8787/index/json/

代码

<?php
        usleep(100000);
        echo "hello world";
?>

进程开256个

Running 10s test @ http://127.0.0.1:8787/index/json/
  50 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   372.50ms  382.21ms   2.00s    85.37%
    Req/Sec    48.35     35.14   180.00     65.89%
  23455 requests in 10.10s, 3.02MB read
  Socket errors: connect 29, read 0, write 0, timeout 880
Requests/sec:   2322.46
Transfer/sec:    306.18KB

QPS 2322