|
|
Log in / Subscribe / Register

/tmp and /var/tmp

/tmp and /var/tmp

Posted Apr 1, 2011 21:23 UTC (Fri) by Wol (subscriber, #4433)
In reply to: /tmp and /var/tmp by Cyberax
Parent article: Introducing /run

tmpfs can cope with huge amounts of data no problem.

BUT it *defaults* to "half available ram".

I got bitten by this when I put /var/tmp into tmpfs on gentoo, and then wondered why OpenOffice wouldn't compile :-)

I always set swap to (at least) twice available ram, which on my system is 32Gb (kernel 2.4 proved that the "twice ram" rule was NOT obsolete, and nobody has yet given me any reason to believe things have changed since then).

I think my tmpfs partitions are all set to about 10-16Gb in size. They're all fine. If you use enough space on the partition, it will simply spill into swap.

Cheers,
Wol


to post comments

/tmp and /var/tmp

Posted Apr 2, 2011 14:28 UTC (Sat) by dtlin (subscriber, #36537) [Link] (2 responses)

Spinning disk filesystems try hard to keep data contiguous; swap does a relatively poorer job of it. So if you're constantly swapping your tmpfs, it's likely slower than if you just used a dedicated filesystem.

/tmp and /var/tmp

Posted Apr 2, 2011 23:05 UTC (Sat) by Wol (subscriber, #4433) [Link]

:-)

But with 8Gb of ram, my system hardly ever swaps, even with /tmp as tmpfs.

However, portage occasionally chews up large amounts of temporary space. Compiling OOo, it recommends you have 10Gb of disk space free in /var/tmp/portage. Chances are, if anything ever gets flushed to swap, it'll never be wanted again, which is why I stick it in tmpfs rather than have it chew up real space in a real partition.

And with 1.5Tb disk across two drives, why should I care about losing 32Gb to swap? :-) It's there if it's needed - which it hardly ever is.

Cheers,
Wol

You 100% right - and still wrong :-)

Posted Apr 3, 2011 14:59 UTC (Sun) by khim (subscriber, #9252) [Link]

Yes, if you're constantly swapping your tmpfs you are slowing everything down. But more often then not it's not the case. 80/20> rules is valid for temporary files too. Most temporary files are accessed rarely, but few are accessed constantly - and they don't ever hit the disk with tmpfs. I know that incremental Chromium build is faster on tmpfs then on real fs if you have beefy system (16GB of RAM, 100GB of temporary files in tmpfs).


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds