-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用workerman加速任意项目 #818
Comments
厉害 |
Repository owner
deleted a comment
Feb 2, 2024
Repository owner
deleted a comment
Feb 2, 2024
Repository owner
deleted a comment from
rnoh96
Mar 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
项目地址
https://github.com/joanhey/AdapterMan
看源码原理:
第一、禁止 php 自带函数的同时编写新的函数。
第二、提供新的启动入口使用
workerman
,同时把框架的核心加载代码,稍作修改。这样就完美的接替了 php-fpm 。代码常驻内存,性
能提升还是肉眼可见的。当然这个里面的替换思路还是很有意思的。
第三、装上
event
扩展 ,性能提升一个量级 , I/O 通知机制有效地安排基于 I/O、时间和信号的事件,epoll
linux内核支持 io多路复用https://pecl.php.net/package/event
event
扩展安装 此处忽略php.ini 通过 disable_functions 禁用一些函数
start.php
启动文件AdapterMan 源码
https://github.com/joanhey/AdapterMan/blob/master/src/AdapterFunctions.php#L10
把session,cookies等使用封装函数代替了,是个不错的想法,但是不能全部直接移植使用,估计还需要更改一些东西
swoole4 是通过 hook 原生函数的方式去兼容各种库代码
AdapterMan
https://github.com/joanhey/AdapterMan/blob/master/src/Adapterman.php#L39
必须php8以上项目
用上workerman常驻内存 性能能提升一个量级
下图为
laravel8
提升,其他项目比如thinkphp
lumen
Yii2
Slim
等 都可用此项目基础于 workerman 加速。参考
workerman
社区https://www.workerman.net/q/9831
The text was updated successfully, but these errors were encountered: