[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mounting /tmp on ram disk





Iftach Hyams wrote:

> I am trying to squeeze better performance using the /tmp directory.
> 
> The first option : "ln -s /home/tmp /tmp" so it will be in the same file
> system as
> the home directories and so all the operations that create a temporal file
> the then
> move it will really move inodes and not copy the file.
> 
> The second option (as seen on SunOS) - mount the /tmp on a virtual files
> system
> resident in the swap. It actually a ram disk that can extend to the swap
> partition
> when needed.
> 
> Do you know which one is best ?

Using a RAM disk as /tmp is really useless on Linux  and will actually 
buy worse perfomance, not better.

The reason for this is that RAM drives in Linux are implemtned using the 
same mechanism that does VFS caching, the only different being that the 
cache pages for the RAM disk always stay "dirty".

Now, the Linux caching mechanisms are actualy so good, that keeping all 
the pages in memory is actually less efficient then letting the cache 
manager do it's thing, assuming you have less then infinite memoryu, of 
course... ;-)

For those of you wondering where on earth I got this, I ran into a guy 
once (name withheld to protect the guilty ;-) who tried to make a better 
web server by putting a bunch of files on a RAM disk (the system had 
lots of RAM...). when he tested the solution he found out he got worse 
performace, not better and I helped him investigate why.

My best advice for you is simply then: "buy more RAM". Since in Linux 
every available RAM space is used for buffers and cache this will most 
likely be the best bet to increase performance. Also, RAm is cheap 
nowdays ;-)

Gilad.




-- 
Gilad Ben-Yossef <gilad@benyossef.com>
http://benyossef.com :: +972(54)756701
"Anything that can go wrong, will go wrong, while interrupts are disabled. "
	-- Murphey's law of kernel programing.


=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il