easySwoole

easySwoole 专为 API 而生,是一款常驻内存化的 PHP 开发框架,摆脱传统 PHP 运行模式在进程唤起和文件加载上带来的性能损失,自带服务器功能,无需依赖 Apache 或 Nginx 运行。在 web 服务器模式下,支持多层级(组模式)控制器访问与多种事件回调,高度封装了 Swool Server 而依旧维持 Swoole Server 原有特性,支持在 Server 中监听自定义的 TCP/UDP 协议,让开发者可以最低的学习成本和精力,编写出多进程,可定时,可异步,高可用的应用服务。

准确来说,easySwoole 是一个 MC 框架。easySwoole 的专注点在于 API 接口,框架本身不提供 V 层。如果需要视图层,也可以手动引入 smarty 等第三方扩展来实现。

特性

保留了 Swoole Server 中全部特性:

  • 强大的 TCP/UDP Server 框架,多线程,EventLoop,事件驱动,异步,Worker进程组,Task异步任务,毫秒定时器,SSL/TLS隧道加密。
  • EventLoop API,让用户可以直接操作底层的事件循环,将socket,stream,管道等Linux文件加入到事件循环中

保留了 easyPHP 中的全部特性:

  • 高度全局化请求对象与响应对象封装,方便二次开发。
  • 支持快速路由,请求拦截,多种事件回调,容器托管服务。
  • 遵循 PSR-4 的自动加载规范,支持动态名称加载和文件的载入。

ab 测试

测试环境

  • 系统: CentOS 7.1 桌面版
  • CPU: i5 6500
  • 内存: 8G
  • php: 5.6.30
  • Swoole: 1.8.13-stable

测试方法 :Index 控制器中输出 hello world 并发送 header "X-Server"=>""easyPHP"

测试结果 :

>>> ab -c 500 -n 500000 http://127.0.0.1:9501/ 

Server Software:        easyPHP
Server Hostname:        127.0.0.1

Server Port:            9501
Document Path:          /
Document Length:        20 bytes

Concurrency Level:      500
Time taken for tests:   30.268 seconds
Complete requests:      500000
Failed requests:        0
Write errors:           0
Total transferred:      97500000 bytes
HTML transferred:       10000000 bytes
Requests per second:    16519.16 [#/sec] (mean)
Time per request:       30.268 [ms] (mean)
Time per request:       0.061 [ms] (mean, across all concurrent requests)
Transfer rate:          3145.74 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   15   1.0     15      25
Processing:     2   15   1.3     15      37
Waiting:        1   12   2.0     12      31
Total:         17   30   1.2     30      52

Percentage of the requests served within a certain time (ms)
  50%     30
  66%     30
  75%     31
  80%     31
  90%     31
  95%     31
  98%     33
  99%     34
 100%     52 (longest request)

环境要求

  • 仅支持 Linux、FreeBSD、MacOs 系统
  • php 版 >= 5.6
  • Swoole 扩展版本 >= 1.9.11

results matching ""

    No results matching ""