-
Notifications
You must be signed in to change notification settings - Fork 296
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
Swoole: Doubled memory use of request input data #959
Comments
Hello, your meaning is that after uploading the file, there is a memory leak? |
I don't think it's a leak, but it is an excessive memory usage. With Octane a request needs twice as much memory as for Laravel without Octane. I can only guess that swoole server keeps the input in memory and Laravel Request keeps another copy of the input. It should not create a copy if that's possible. EDIT: BTW, this is not peak usage, |
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
Swoole will keeps a copy of the request data in memory, allowing you to get the raw http message through |
You can try setting the 'swoole' => [
'options' => [
'package_max_length' => 1 * 1024 * 1024,
'upload_max_filesize' => 5 * 1024 * 1024
],
], Because |
Thank you. I confirm that what you suggested works with files uploaded using |
Octane Version
2.5.6
Laravel Version
10.48.22
PHP Version
8.1.29
What server type are you using?
Swoole
Server Version
5.1.4
Database Driver & Version
No response
Description
I noticed that octane+swoole consumes much more memory than standard
artisan serve
. For example I'm testing file uploads (using raw POST request) with files of different sizes. Results:So, looks like with swoole the file is copied twice in memory.
Steps To Reproduce
Create a POST route that does nothing but logs/returns
memory_get_peak_usage()
and runcurl -k --data-binary "@file" -H "Expect:" -H "Content-Type: text/plain" https://host/path/to/route
. Make the file "./file" of appropriate size.Swoole configuration from
config/octane.php
:The text was updated successfully, but these errors were encountered: