GithubHelp home page GithubHelp logo

prient-swoole's Introduction

prient-swoole

prient-swoole基于Swoole扩展的分布式持久内存PHP框架。它是专门为restful风格API创建的,旨在消除与流程调用和文件加载相关的性能损失。 框架封装了Swoole服务器,并且仍然保持Swoole服务器的原始功能。

  • 基于Swoole扩展
  • 内置HTTP协程服务器
  • 协程和异步任务传递
  • 自定义用户流程
  • 支持RESTful
  • 高性能路由器
  • 服务热重启
  • AB测试

    namespace App\Controllers;
    
    use Framework\Http\Http;
    
    class IndexController extends Http {
        function index(\swoole_http_request $req,\swoole_http_response $rep,$parameter = null){
            $query_string = isset($req->server['query_string'])?$req->server['query_string']:null;
            //路由地址
            $rep->end(json_encode($parameter));
        }
    }
    

    本地mac机子测试结果

    Server Software:        swoole-http-server
    Server Hostname:        127.0.0.1
    Server Port:            9503
    
    Document Path:          /index/index/1/1
    Document Length:        9 bytes
    
    Concurrency Level:      100
    Time taken for tests:   0.578 seconds
    Complete requests:      10000
    Failed requests:        0
    Total transferred:      1560000 bytes
    HTML transferred:       90000 bytes
    Requests per second:    17309.33 [#/sec] (mean)
    Time per request:       5.777 [ms] (mean)
    Time per request:       0.058 [ms] (mean, across all concurrent requests)
    Transfer rate:          2636.97 [Kbytes/sec] received
    

    ###比较 同样环境下看看 easyswoole的ab测试

    Server Software:        EasySwoole
    Server Hostname:        127.0.0.1
    Server Port:            9501
    
    Document Path:          /
    Document Length:        1502 bytes
    
    Concurrency Level:      100
    Time taken for tests:   0.873 seconds
    Complete requests:      10000
    Failed requests:        0
    Total transferred:      16440000 bytes
    HTML transferred:       15020000 bytes
    Requests per second:    11460.88 [#/sec] (mean)
    Time per request:       8.725 [ms] (mean)
    Time per request:       0.087 [ms] (mean, across all concurrent requests)
    Transfer rate:          18400.09 [Kbytes/sec] received
    
    

    快速开始

    前提安装了swoole.so拓展
    方法① 
    [email protected]:whr-helen/prient-swoole.git
    
    php server.php
    
    方法②
    composer require whr-helen/prient-swoole=v1.x
    
    php server.php
    

    打开网页 http://127.0.0.1:9503 预览效果

  • 未完待续... QQ交流:850388667
  • prient-swoole's People

    Contributors

    prient avatar

    Stargazers

     avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

    Watchers

     avatar

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❤️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.