[Mongrel] Mongrel and memory usage

Dave Cheney dave at cheney.net
Mon Nov 5 22:34:25 EST 2007

Hi Kirk,
	I'm wondering if we're being hit by this issue in our application. We  
generate a lot of thumbnails on the fly and use send_file to transfer  
the data back to the browsers.

	Checking the rails docks for send_file it indicates, that unless you  
use the option :stream => false, the file will be read into a 4096  
byte buffer and streamed to the client.


	Is this a bug in send_file?



On 06/11/2007, at 8:39 AM, Kirk Haines wrote:

> This falls under the category of creating http responses.  If you are
> using send_file within Mongrel, then the response object that is
> created will contain all of the file contents.  If your file is small
> to moderately sized, that's no big deal, but if you start pushing
> large files around, it will have an impact on your RAM usage.  Pushing
> huge files via send_file necessarily implies huge RAM usage.
> Don't do that.  x_send_file is one way to avoid doing that.

More information about the Mongrel-users mailing list