On Thursday, October 04, 2012 09:09:26 PM Loic d'Anterroches wrote: > On 2012-10-04 19:33, Carlo Pires wrote: > > Hi, > > > > Mongrel2 is great in receiving large uploads. It just stream them to > > disk and notify the handler. > > > > But the inverse seems to be problematic. How can I stream a big file > > (>4G) to be served by mongrel2 without compromising the memory? > > In a way or another you will to kind of evaluate what size is the pipe > between mongrel2 and the client (the control port can help you), then > you send your file in many parts, each part in a single message. For > example, you could send ~4000 messages, each being 1MB in size. This > way, you never allocate a lot of memory.
I'd like to see a credits-based flow control added to the protocol, so that Mongrel2 can throttle handlers, at least optionally. Since PUB sockets never block, IMO it is not very appropriate to use it for large streaming responses without some kind of out of band flow control. This is how I deal with the problem in Zurl. Justin
