Am 31.01.2017 um 16:48 schrieb Viallard Anthony:
On Tue, 31 Jan 2017 15:26:24 +0100 Reindl Harald <h.reindl@xxxxxxxxxxxxx> wrote:normally large static files should not make it to the memory at all https://linux.die.net/man/2/sendfileActually, I send the file in a "multipart/form-data" http message because I need to send other informations at the same time. So, I fill an evbuffer with differents values and the file separated by a delimiter. I open the file and I read/write 5KB to the evbuffer. Therefore, I don't think I use sendfile() and this is why I have this memory problem. Maybe if I use an other kind of http message instead of "multipart/form-data", put the values from the http body to the query string and use the function evbuffer_add_file(), I can hope not having this issue ?
not sure about the internals and specific case but even if it needs to create tempfiles you really need to avoid holding the whole file in memory, that won't scale in most environments not only embedded when you consider a webserver which has 20 parallel requests to a 500 MB file which also would mean that these buffers are last very long until the clients have received and finished the request while other clients still connect to the machine
Am 31.01.2017 um 14:11 schrieb Ryan Daum:You could implement range support if your client supports them. I don't believe there is content-range support built into libevent, but I wrote my own (can't share, company IP) implementation for libevent. It wasn't that difficult to write. The RFC is pretty clear.
*********************************************************************** To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with unsubscribe libevent-users in the body.