bear / swoole
Swoole script for BEAR.Sunday
0.6.0
2022-12-29 20:05 UTC
Requires
- php: ^7.3 || ^8.0
- ext-json: *
- ext-swoole: >=4.0.0
- bear/app-meta: ^1.6
- bear/query-repository: ^1.8.4
- bear/resource: ^1.15
- bear/sunday: ^1.5
- doctrine/cache: ^1.10
- fastd/http: 5.0.x-dev
- psr/cache: ^1.0 || ^2.0 || ^3.0
- psr/http-message: ^1.0
- ray/di: ^2.11.3
- ray/psr-cache-module: ^1.3
- ray/psr7-module: ^1.3
- symfony/cache: ^5.4 || ^6.2
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.4
- bear/package: ^1.9
- bear/skeleton: ^1.6
- eaglewu/swoole-ide-helper: dev-master
- guzzlehttp/guzzle: ^6.5 || ^7.5
- josegonzalez/dotenv: ^3.2
- phpunit/phpunit: ^9.5
- symfony/process: ^5.0
This package is auto-updated.
Last update: 2024-11-13 10:57:25 UTC
README
This library provides the support of Swoole into an BEAR.Sunday application.
🚀 Installation
Run the following to install this library:
composer require bear/swoole
composer require fastd/http 5.0.x-dev
🚀 Entry Script
Place the entry script file at bin/swoole.php
with IP address and port number.
<?php require dirname(__DIR__) . '/autoload.php'; exit((require dirname(__DIR__) . '/vendor/bear/swoole/bootstrap.php')( 'prod-hal-app', // context 'MyVendor\MyProject', // application name '127.0.0.1', // IP 8080 // port ));
🚀 Execute
You can run a BEAR.Sunday application with Swoole using the following command:
php bin/swoole.php
🚀 Benchmark
Test with MacBook Air M2 2022
- PHP 8.2
Benchmarking Tool: wrk
Apache 2.4
wrk http://127.0.0.1/
Running 10s test @ http://127.0.0.1/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 2.94ms 1.63ms 45.60ms 95.46%
Req/Sec 1.78k 85.91 1.94k 89.00%
35369 requests in 10.00s, 6.99MB read
Requests/sec: 3535.29
Transfer/sec: 715.29KB
Swoole 5.0.1
wrk http://127.0.0.1:8080/
Running 10s test @ http://127.0.0.1:8080/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 97.58us 26.76us 1.63ms 81.58%
Req/Sec 49.89k 2.31k 51.06k 95.54%
1002194 requests in 10.10s, 191.15MB read
Requests/sec: 99230.51
Transfer/sec: 18.93MB