RFC on Cloud Images: Make /tmp a tmpfs

Martin Pitt martin.pitt at ubuntu.com
Wed Jan 20 08:17:10 UTC 2016

Clint Byrum [2016-01-19 23:52 -0800]:
> But that's all nice-to-haves. The real reason I'm still skeptical
> is simply that I don't see /tmp usage being a major factor on cloud
> instances.

FTR, I agree that it is much more desirable on real-iron (the
performance difference with my use cases is *dramatic*, mostly due to
fsync() not taking any time on tmpfs). With the (usually) virtualized
file systems and memory of cloud instances it should make much less

> This sounds great on the surface, however, what real thing does this
> benefit? Giant git merges? Sort file usage? If somebody is developing
> an app that uses /tmp, they're using /tmp because of these reasons:
> a) They are processing data in an unpredictable way where using RAM
> directly may be too costly.

Given that /tmp is a tmpfs on a lot of existing machines out there, if
your data can become potentially huge you are really better off with
using /var/tmp/.

> or b) They're using a tool that only operates on files on disk.

By far the most common reason that I've seen is that files are the
Unix way for exchanging little pieces of data with other programs,
like flag files, named pipes, Unix sockets, editors, or in general
things you need to call external programs on. I think the latter is
what you meant as well with b). But in all but corner cases these are
tiny. And in these corner cases it doesn't really matter much whether
your program overflows RAM or your root partition -- it's buggy and
needs to be fixed, or as a user you just tried to do something
unreasonable which your computer is too small to do.

So the case where a program dumped 50 GB of logs into /tmp/ -- that's
clearly a bug in that program. At that rate it would quickly
overflow/DoS any real file system too, apart from the fact that it
causes a huge performance drag. I think it's unreasonable to cite this
example as a reason why we should not do this.

Using /var/tmp/ for big temporary files might work better on some
installs (particularly those with small or r/o root and big /var,
which is actually fairly common), but I realize it's far from
guaranteed to work; but then again, nothing ever is :-)



Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

More information about the ubuntu-devel mailing list