[Solved] Can lighttpd response part by part when acting as a proxy?
As far as I know, when lighttpd acts as a proxy, it reads all of the response from backend, then sends it back to client. If I am right, then there will be a problem.
I know lighttpd manages the memory perfectly when sending static files on local disks. But if it works as a proxy, and the file is from another machine and cached in memory. Suppose, there are 10k clients, and everyone is requesting a file, assuming a 20M file named foo.mp3, simultaneously. It will makes lighttpd eat 10k*20M memory.
Is there any way that lighttpd can receive a part of that file and sends that part back to client immediately, then reuse the memory? So it can keep fit of memory.
I have writen a proxy. And the log reveals that read() function does not return the whole content when the socket is set to NON_BLOCK. For example, if the webpage's size is 10k, it read 2-4k each time and return, making about 3 times to finish reading. Is there any way that I can send that 2-4k content, the content returned from read() every time, back to client? So that I don't have to alloc a 10k memory.
RE: [Solved] Can lighttpd response part by part when acting as a proxy? - Added by gstrauss 9 months ago
Yes. Since lighttpd 1.4.40, see Server_stream-response-bodyDetails and use
server.stream-response-body = 2