Gentoo Archives: gentoo-user

From: Rich Freeman <rich0@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] tmp on tmpfs
Date: Wed, 24 May 2017 09:34:20
Message-Id: CAGfcS_mNnhQ-Ek71FOpCTFGFdG7yN+eDG6ACz3H9k9=W2xXf+w@mail.gmail.com
In Reply to: [gentoo-user] tmp on tmpfs by Ian Zimmerman
1 On Wed, May 24, 2017 at 1:16 AM, Ian Zimmerman <itz@×××××××.net> wrote:
2 >
3 > I have long been in the camp that thinks tmpfs for /tmp has no
4 > advantages (and may have disadvantages) over a normal filesystem like
5 > ext3, because the files there are normally so small that they will stay
6 > in the page cache 100% of the time.
7 >
8
9 The file being in the page cache only speeds up reads of the file. On
10 a conventional filesystem the file will still be forced to be
11 committed to disk within 30 seconds, or whatever you've set your max
12 writeback delay to. That means guaranteed disk write IO. If the
13 drive is mostly idle it will have no impact on performance, but if the
14 disk is fairly busy then it will, especially for spinning disks. For
15 an SSD /tmp would be a source of erase cycles (which also have
16 performance implications, but there it is more of a wear issue). When
17 the file is removed that would also generate write IO.
18
19 The flip side is that on most systems /tmp probably doesn't get THAT much IO.
20
21 On Gentoo doing your builds in tmpfs definitely has a large
22 performance impact, because there are a lot of files created during
23 the build process that are sizable but which don't end up getting
24 installed (object files mostly). Plus you have the extraction of the
25 source itself. For a typical build that is many MB of data being
26 extracted and then deleted after maybe a minute, which is a lot of
27 useless IO, especially when the actual install is probably creating a
28 fairly sizable IO queue on its own.
29
30 To avoid a reply, I'll also note that tmpfs does NOT require swap to
31 work. It does of course require plenty of memory, and as with any
32 situation where lots of memory is required swap may be useful, but it
33 is not a requirement.
34
35 Others have mentioned zram. I've used it, but unless something has
36 changed one of its limitations is that it can't give up memory. That
37 is less of an issue if you're using swap since it can be swapped out
38 if idle. However, if you're not using swap then you're potentially
39 giving up a chunk of RAM to do it, though less RAM than a tmpfs if it
40 is full most of the time (which I doubt is typically the case).
41
42 --
43 Rich

Replies

Subject Author
Re: [gentoo-user] tmp on tmpfs gentoo-user@××××.de
Re: [gentoo-user] tmp on tmpfs Andrew Savchenko <bircoph@g.o>