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

Re: Moving /tmp to tmpfs makes it useless



2012/5/25 Miles Bader:

> I can't say whether it's a good default or not (though it seems to
> work pretty well in practice)

It dosn't always work in practice. Among the problems I faced myself...
I wasn't able to watch a web presentation (from something like
vimeo/youtube), because there was not enough free space in /tmp for flash
player to download and show it. Also mc was not able to open archives
(IIRC it partially opened them, not showing most of the files) because of
the same reason. I'm not sure how a database server would handle the case
when it's unable to do a filesort to complete SELECT. Anyway, it really
causes problems in practice.

> But the OP's argument is completely silly.  Most apps use /tmp not for
> "reducing memory usage", but for communicating with other apps (of
> course, often, such as in a shell script, or indeed the user himself,
> the choice of /tmp is not done by the app itself, but by the invoker) --
> it's a common namespace.

Ok, I agree. There're two main /tmp usages. Some applications use it to
save memory (databases, archive managers, cd burners, image processors,
science software, the flash player after all). Other apps use it for
communication (browsers, mail clients). But in both cases these files may
be large and should be still stored on real disk, not on tmpfs.
And having /tmp on tmpfs makes it useless for both usages.

> Of course it's the rare exceptions to this that cause problems;

The matter is that exceptions are *not rare*. A simple 2-hours-long
video presentation may cause you problems. Pressing Enter in `mc` on
linux-kernel-src.tar.bz2 may cause you problems.

On the other hand it gives no real benefits. Making a small tmpfs will
break apps. Making a large tmpfs may slow down the system because of
high memory/swap usage. Moving sockets from disk to tmpfs also gives no
benefits. The only case when you theoretically could benefit from having
/tmp on tmpfs is when you have a software, that creates a lot of files
there that are guaranteed to be small. Actually I can't think of any
software, creating a lot of small-only files in /tmp.

-- 
  Serge


Reply to: