I have a server that receives a file in a HTTP request, I'd like to make that file available to another process but I don't want the I/O overhead of writing that file to disk.
Are there any directories in linux that are actually mapped to RAM, so the process I start can access a path as is were a normal file?
I know that if I do this in a normal file, then there is a good chance that the file wont actually be flushed to disk because of cache, but that's not what I'm looking for.
There are no guaranteed locations that are backed by RAM, but it's not particularly hard to convert /tmp to be backed by RAM if you have enough of RAM to spare. Given that /tmp is cleaned out on boot anyway, it's an ideal choice for a RAM disk, since data loss due to power loss doesn't matter; the data would have been cleaned on boot anyway.
You can use the following to create a RAM disk (as per these instructions):
mkdir /mnt/ramdisk
mount -t ramfs -o size=512m ramfs /mnt/ramdisk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With