-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
High CPU utilization when uploading a file #734
Comments
One of the culprits seems to be this line in Replacing the line let out = Array(finalBytes.map({ UInt8($0) })) with let out = Array(finalBytes) improves time to about 1.5 seconds. |
New tests File size: 20585454 bytes
Perfect (2.1.8): 605 milliseconds !!! (Perfect! :))
|
@nsleader we're seeing multiple issues related to multipart parsing. We're working on them now. Until then, you can use the raw request.body as a workaround for accessing uploaded files. |
Closing since we have a workaround and multipart is an ongoing discussion. It should be noted that there are third party multipart libraries that seem quite sufficient! |
This code uses 99-100% CPU:
How to optimize uploading file?
Update:
After upgrading Vapor to version 1.2 uploading time reduced to 10 seconds.
The server and client running on one local machine (MacBook Pro).
Tested code:
File size: 37379899 bytes
vapor 1.1.x: 110 seconds (Very long time!)
vapor 1.2: 10 seconds (Still a long! It's just a copying file on the local machine)
The text was updated successfully, but these errors were encountered: