-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Upload file huge memory consumption #103
Comments
First you could switch to For the time being, both HTTP servers that Prologue supports don't provide streaming body. nim-lang/Nim#13147 has tried to solve the problem of And I will switch to https://github.com/iocrate/netkit in the future and hope to solve this problem. |
Here are some tests for uploading a 105MB file:
I added some timestamp:
Actually, the time spent is before the first |
is this the same issue i'm seeing when serving any file from disk, such as an image via img tag or video via html5 video tag? If i serve a 92k image in an html page, and load the page 5 times, the ram usage climbs from 3.4MB to 4.1MB. Do i need to open another issue or is the issue i'm seeing caused by this body streaming issue? |
May be related to this issue. If serving same file, I think you could use some memory cache tables instead of reading files. |
please use directory path match serve static file like common web application does, like public directory,media, static |
Thanks, i opened #106 |
@xflywind so since nim-lang/Nim#13147 got reverted and they were concerned with breaking changes being introduced does that mean that nim web development will not have usable file upload capability until nim 2.0, or maybe until prologue moves to netkit? i'm trying to decide if i can use nim for some upcoming projects. |
When using It saves the entire file to the body string variable / in memory. It will be hard to fix this without breaking all the frameworks. Perhaps nim-lang/Nim#13147 where the socket doesn't read anything and defers to the framework can be changed to not break anything by default (by using a flag like Another possibility that I think would be most backwards compatible is letting |
Hello,
This web framework is amazing, we have to push it further to be prod ready !
I used the blog example to complete it with file uploading / downloading.
I made it work with the code at the bottom, but had issue with memory consumption. When uploading a 170MB zip file, the memory went up to 2.4GB for the app process (on windows). It was 10MB stable before.
It seems like the Context.getUploadFile() write the body as string. Is there a way to use a write stream to avoid using lots of memory?
The code used:
karax:
Prologue view:
Thank you guys :)
The text was updated successfully, but these errors were encountered: