Consider the following scenario:
- I am running lighttpd-1.4.19 and I am handling big uploads (hundreds of MBs but less than 1GB) through it.
- Server is running on Ubuntu 8.04 LTS.
- Files are temporarily written to /var/tmp.
- PHP5 is handling the end-result through fastcgi.
- During an upload, upload chunks are written in the temporary directory.
The weird thing is that although the chunks are written on disk, free memory on the server is reducing gradually up to the full file size during the upload. I would understand RAM diminishes by the size of each chunk (let's say 1-2MB) until they're written on disk but I don't understand why it is by the whole file size (let's say 300MB).
- Would you know why the RAM would be taken for the whole file although chunks are written on disk? Is it possible /var/tmp is mounted directly in memory? Versus /tmp?
- If not, would you know how to diagnose and how to pinpoint which process is taking up the memory? I didn't see the lighttpd nor php-cgi process increasing with ps but maybe I'm not looking at the right thing.
- Or better yet, would you have a recommendation on a good web server (Apache, Nginx, lighttpd, etc.) and config to handle big uploads without storing everything in RAM?