Comments (15)
你用的是httpserver还是tcpserver
from swoole-src.
http基于TCP的,理论上支持
from swoole-src.
你是压测的过程中发现假死的吗,可以的话提供一下复现代码和压测命令
from swoole-src.
我只能提供文件数量和大小,压测命令我暂时没有,但可以提供数据
from swoole-src.
五分钟QPS:13570
文件数量:124k
大小:125G
最大文件大小:100MB左右
最小文件:64b或者是0b
from swoole-src.
你是用Swoole\Http\Response::end还是Swoole\Http\Response::sendfile方法发送文件
from swoole-src.
只有sendfile,没有end
from swoole-src.
<?php
$http = new Swoole\Http\Server('127.0.0.1', 9501, SWOOLE_PROCESS);
$http->on('start', function ($server) {
echo "Swoole http server is started at http://127.0.0.1:9501\n";
});
$http->on('request', function ($request, $response) {
$response->header('Content-Type', 'application/octet-stream');
$response->header('Content-Disposition', 'attachment; filename=recvfile.txt');
$response->sendfile('/home/sendfile.txt');
});
$http->start();
传输文件是100M的,wrk -c20000 -t4 -d120s http://127.0.0.1:9501/
压测命令
你的服务器环境是怎么样的,代码是我这样的写法吗
from swoole-src.
php -m
查看一下扩展列表,php --ri swoole
查看一下swoole信息
from swoole-src.
服务器环境:4h8g,php占用6g
php -m zstd拓展,swoole是最新版本的
from swoole-src.
另外,是Swoole\Coroutine\Http\Server
from swoole-src.
有内存泄漏,我看看是哪里的问题
from swoole-src.
我怀疑是客户端正确关闭后,没有自动释放,导致有引用计数不能为0的情况
可以看看是否客户端关闭没有通知response关闭?
from swoole-src.
因为连接数导致内存上涨和没有正确释放等问题
from swoole-src.
我测试了一下,这个应该不是内存泄漏,更有可能是因为php的内存管理机制会将小的内存块保留起来不还给操作系统。
使用Swoole\Timer::tick
设置合适的时间间隔调用gc_mem_caches()
强制php归还内存给操作系统试试看。
from swoole-src.
Related Issues (20)
- A bug occurred in Swoole-v5.1.1, please report it. HOT 19
- Websocket connection failed. SSL related Issue? HOT 1
- Swoole not supporting partitioned cookie parameter HOT 1
- Can allow_redirects be supported on the HTTP/WebSocket? HOT 7
- Alpine + Swoole + PgSQL on the host = `could not send SSL negotiation packet: Resource temporarily unavailable` HOT 16
- 已解决
- 开启一键协程化之后, `proc_open()` 似乎会受到先前空方法体的 `run(function() {});` 的影响。 HOT 1
- Worker exits without much information HOT 3
- Websocket服務,調用Task做訊息發送,出現session does not exits HOT 5
- \Swoole\Server::shutdown never gets called and signals don't seem to work with \Swoole\Process::signal() / pcntl_signal() HOT 4
- A bug occurred in Swoole-v5.1.2, please report it HOT 26
- PHP Startup Unable to load dynamic library 'swoole' HOT 2
- guzzlehttp在stream=true时,设置超时无效 HOT 5
- 协程被长时间挂起会导致内存大量增加 HOT 49
- windows swoole-cli-v4.8.13-cygwin-x64.zip 在windows上 run(function{}) 内的curl 问题 HOT 2
- 在 Swoole\Coroutine\Http\Server 中的 http server 使用 sendfile 在高并发时会导致 PHP 假死并且内存泄露 HOT 57
- windows swoole-cli-v4.8.13-cygwin-x64 使用协程监听的Channel数据然后插入数据库,插入没几条就报错了! HOT 6
- syntax error near unexpected token `SQLITE,' HOT 4
- @swoole/library/ext/sockets.php(217) E_DEPRECATED:Creation of dynamic property Swoole\Coroutine\Socket::$__ext_sockets_nonblock is deprecated HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swoole-src.