swooletw / laravel-swoole

High performance HTTP server based on Swoole. Speed up your Laravel or Lumen applications.
MIT License
4.03k stars 388 forks source link

How did I know swoole is succefull applied on my environment #534

Open rooniieesss opened 1 year ago

rooniieesss commented 1 year ago

Make sure you read Issues Guideline and answer these questions before submitting your issue. Thanks! (Any non-English issues will be closed immediately.)

  1. Please provide your PHP and Swoole version. (php -v and php --ri swoole)
    PHP 7.4.32 (cli) (built: Oct 28 2022 18:18:25) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.32, Copyright (c), by Zend Technologies
    Server API | FPM/FastCGI

and

Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.8.12
Built => Oct 29 2022 22:59:10
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
pcre => enabled
zlib => 1.2.11
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608
  1. Please provide your Laravel/Lumen version. "laravel/framework": "^6.0",

  2. Which release version of this package are you using?

    Version => 4.8.12
    Built => Oct 29 2022 22:59:10
    "swooletw/laravel-swoole": "^2.12"
  3. What did you do? If possible, provide a recipe for reproducing the error. Just Installing swoole on laravel project like on documentation. My laravel project using laradok

  4. What did you expect to see?

How did I know swoole is succefull applied on my environment. Because I test a benchmark with wrk. Nothing improve (just a litte bit) perfomance between using swoole and not using swoole.

  1. What did you see instead? using swoole
    wrk -t3 -c10 -d5s -H 'x-api-key:fasdf' -H 'Content-Type:application/json' -H 'Accept:application/json' "http://api-test/api?limit=10"
    Running 5s test @ http://api-test/api?limit=10
    3 threads and 10 connections
    Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    58.03ms   71.92ms 339.84ms   85.70%
    Req/Sec    80.87     38.69   181.00     59.06%
    1205 requests in 5.00s, 417.75KB read
    Non-2xx or 3xx responses: 1205
    Requests/sec:    240.81
    Transfer/sec:     83.48KB

no using swoole

wrk -t3 -c10 -d5s -H 'x-api-key:fasdf' -H 'Content-Type:application/json' -H 'Accept:application/json' "http://api-test/api?limit=10"
Running 5s test @ http://api-test/api?limit=10
  3 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    56.38ms   72.46ms 344.37ms   85.71%
    Req/Sec    86.23     39.65   210.00     70.67%
  1292 requests in 5.01s, 447.91KB read
  Non-2xx or 3xx responses: 1292
Requests/sec:    258.03
Transfer/sec:     89.45KB

run command php artisan swoole:http infos

+-----------------+-------------------------------------------------------------------+ | Name | Value | +-----------------+-------------------------------------------------------------------+ | PHP Version | 7.4.32 | | Swoole Version | 4.8.12 | | Laravel Version | 6.20.44 | | Listen IP | 127.0.0.1 | | Listen Port | 1215 | | Server Status | Online | | Reactor Num | 8 | | Worker Num | 8 | | Task Worker Num | 0 | | Websocket Mode | Off | | Master PID | 2791 | | Manager PID | 2795 | +-----------------+-------------------------------------------------------------------+

Arkanius commented 1 year ago

Are you sure that your swoole server is still alive between all requests?