[Mongrel] Temporary files / Uploads

Thomas Worm usenet at s4r.de
Tue Aug 14 10:26:25 EDT 2007


how can I influence, where mongrel stores temporary files like uploads. 
As far as I can see, int honours the TMP or TEMP environment. Can I also 
set it in the configuration file for mongrel? I have not found something 
about it in the docs.

Another thing:

When I upload a file, the file is stored 3-4 times:
In the TMP by mongrel as

mongrel.3400.0  and then as

I currently examine the rails application boxroom (I do not expect any 
answers in this group specific to boxroom), which then itself stores the 
file twice again for some reason. So at the end I have the same file 4 
times on disk (before one of the boxroom files will be deleted by 

I wonder who is responsible for cleaning this up and when? For the two 
boxroom files, it is clear, it is boxroom. The CGI-File also seems to be 
cleaned up (I guess by boxroom, I will find out later ;-)). But the 
mongrel-file persists in the TMP-directory (when something goes wrong, 
then both files are kept).

While the fileupload takes place, the ruby process which runs mongrel 
uses up to 4 times as much memory as the uploaded file is big (plus what 
was ruby was using before the request). I now wonder a little bit, why? 
As far as I can see, boxroom copies the file in 4k-chunks, but I still 
have not yet fully understood the application. Does mongrel keep the 
entire file in mem, before it stores it into tmp?

The reason, why I ask those questions is, I am planning to build a new 
platform for our clients to exchange files with our company and I am now 
examining, how to do this. From the past I know, we have a few clients, 
which upload files in the size of 1-3 GB (in the future maybe even 
bigger). But I cannot have 12GB of mem per process, and even on the 
harddrive an upload should succeed as long as the file fits onto disk.

So are there any issues concerning mongrel, which I should take into 

Currently I am testing on WinXP with ruby-1.8.6 and mongrel-1.0.1-mswin32 
and rails 1.2.3. The final application will run on linux.


BTW: mongrel is great! Without I would have stopped using rails just 
after the first project I did because deployment on windows is a mess 
without mongrel and as far as I could read not much better on linux.

More information about the Mongrel-users mailing list