🚀 服务模式
概述
ripple提供了常驻内存的服务模式运行,可以将你的程序作为一个服务运行,相对于传统CGI的模式工作流程, 服务模式的工作流程能够有效的提高程序的性能,减少加载文件的无必要消耗, 在广泛的实践中,服务模式的性能要远远高于传统CGI模式。
目前该项目已经支持 ThinkPHP / Laravel / Workerman / Webman
安装方法
通过 Composer 安装
composer require cloudtay/ripple-driver
部署参考
Workerman
Worker::$eventLoopClass = \Ripple\Drive\Workerman\Driver4::class;
Worker::runAll();
Webman
修改配置文件config/server.php服务配置文件
return [
//...
'event_loop' => \Ripple\Drive\Workerman\Driver4::class,
];
Laravel
环境配置支持(ENV)
配置项 | 说明 | 默认值 |
---|---|---|
PRP_HTTP_LISTEN | HTTP服务,监听地址格式如http://127.0.0.1:8008 | http://127.0.0.1:8008 |
PRP_HTTP_WORKERS | HTTP服务,工作进程数 | 4 |
PRP_ISOLATION | 控制器隔离模式,开启后每次请求都会重新实例化Controller,适用于有状态的Controller隔离$this->request | 0 |