Re: Moving /tmp to tmpfs makes it useless
- To: firstname.lastname@example.org
- Subject: Re: Moving /tmp to tmpfs makes it useless
- From: Goswin von Brederlow <email@example.com>
- Date: Fri, 01 Jun 2012 13:15:38 +0200
- Message-id: <firstname.lastname@example.org>
- In-reply-to: <email@example.com> (Nikolaus Rath's message of "Fri, 25 May 2012 21:20:07 -0400")
- References: <CAOVenEo+CT6Ou_vHq8HvuCz1NdW0Ogq5UqxMZh-4Qkw4e01CsA@mail.gmail.com> <20120525003051.GA1497@jwilk.net> <firstname.lastname@example.org> <CAOVenEqx1VLBmn4eJdFJ29PUj5ebJp9DHrMea7gprF8+GZd5Fg@mail.gmail.com> <20120525072204.GC11341@debian> <4FBF4C1A.email@example.com> <4FBF51D6.firstname.lastname@example.org> <4FBFE095.email@example.com> <firstname.lastname@example.org>
Nikolaus Rath <Nikolaus@rath.org> writes:
> Thomas Goirand <email@example.com> writes:
>> On 05/25/2012 05:33 PM, Mehdi Dogguy wrote:
>>>> What if we're installing Debian on a very small system, and that we
>>>> need operations with big files in /tmp?
>>> Increase your swap?
>> So, in this case, we will have the following scenario:
>> - An app writes in /tmp
>> - There's not enough space, so the system starts swapping,
>> including some apps.
Which happens regardless wether tmp is tmpfs or a real filesystem. The
more IO there is the more likely some app gets swapped out.
>> - The file gets written to /tmp, then gets read
>> - Finally, the file gets deleted
With tmps that instantly frees up all the memory and swap used by the
file. With a real FS the file data remains in the dirty cache until such
a time as the disk has cought up with writing it all and then it is
thrown away. So potentially memory is freed up much later.
>> - Then we have randomly very sloppy reaction of apps
>> that were swapped out so that the file could be written
>> in /tmp.
Which, without tmpfs, then has to additionaly first wait for the dirty
cached data to be written out causing huge delays because you get two
seeks per page, 4k read/writes and no read-ahead.
> I believe tmpfs memory is swapped out preferentially, so your scenario
> doesn't have to play out like that. However, paging being a complex
> process, it's not impossible either. Is that something people are
> actually seeing? Because I haven't encountered this.
It happens. But that isn't to say it doesn't equally (or worse) happen
with a real FS.
Paging is a complex process and there are so many factors involved that
predicting the behaviour becomes pure guesswork. I would say both Thomas
and my scenario are equally likely to occur. No matter what the default
is there will be some users that hit the worst case.