gregorip02/servel

Workerman 服务器适配器,适用于 Laravel

v0.0.1 2021-03-06 15:57 UTC

This package is auto-updated.

Last update: 2024-09-21 23:12:48 UTC


README

Latest Stable Version Total Downloads License

工作中:此包为您的 Laravel 应用程序提供了一个基于高性能 Workerman 服务器的 TCP 入口。

安装

# Install the package
composer require gregorip02/servel

# Publish the configuration package
php artisan vendor:publish --tag=servel-config

使用方法

php artisan servel start
php artisan servel stop
php artisan servel connections
php artisan servel restart
php artisan servel reload
php artisan servel status

基准测试

DO Droplet - CPU Dedicated
- 8GB Memory
- 50GB SSD
- 8 VCPUs

渲染默认的 welcome.blade.php 视图

wrk -t4 -c50 http://0.0.0.0/

Running 10s test @ http://0.0.0.0/
  4 threads and 50 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    27.16ms    5.74ms 124.65ms   92.53%
    Req/Sec    443.86     49.22   520.00     86.25%
  17687 requests in 10.01s, 312.24MB read
  Socket errors: connect 0, read 17687, write 0, timeout 0
Requests/sec:   1767.28
Transfer/sec:   31.20MB

一个简单的端点,响应 pong

wrk -t4 -c50 http://0.0.0.0/ping

Running 10s test @ http://0.0.0.0/ping
  4 threads and 50 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    25.62ms    5.95ms  95.00ms   89.80%
    Req/Sec    469.97     56.74   585.00     77.25%
  18724 requests in 10.01s, 18.30MB read
  Socket errors: connect 0, read 18724, write 0, timeout 0
Requests/sec:   1871.13
Transfer/sec:   1.83MB

一个端点,从 SQLite 数据库中以 JSON 格式响应 100 个用户。I/O

wrk -t4 -c50 http://0.0.0.0/users

Running 10s test @ http://0.0.0.0/users
  4 threads and 50 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   288.79ms   28.25ms 397.73ms   94.93%
    Req/Sec   41.16      17.08   101.00     63.38%
  1638 requests in 10.01s, 33.76MB read
  Socket errors: connect 0, read 1638, write 0, timeout 0
Requests/sec:    163.63
Transfer/sec:    3.37MB

待办事项

  • 添加测试
  • 添加以 "守护进程" 模式运行的支持
  • 添加对 WebSocket 的支持
  • 添加在开发模式下重启的支持
  • 添加重启服务器的命令
  • 添加停止服务器的命令
  • 添加发布配置文件的支持
  • 添加对参数、cookie、文件、头等的支持