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

Re: TMPDIR - Do we also need a drive backed TPMDIR ?



Excerpts from Gabor Gombas's message of 2016-07-21 21:22:02 +0200:
> On Thu, Jul 21, 2016 at 04:06:26PM +0300, Dmitry Bogatov wrote:
> 
> > For example, I, as happy owner of 8GB RAM, is perfectly fine with 3GB
> > in /tmp, because I actually use less then 1Gb. On other hand, would I
> > start 50 instances of Firefox, Gimp and other stuff, I would object
> > putting 3GB in my /tmp, since it would make system swap.
> 
> I don't quite buy your argument. If you want to write 3GB to disk, then
> you need to write 3GB to disk - it's the same amount of data, whether
> you call it "filesystem" or "swap". But if you use a real filesystem to
> store that data, then you will also have to deal metadata, which needs
> to be protected from crashes so you want to flush caches from time to
> time, which is expensive. tmpfs does not have such requirements, so it
> should give you better performance. I guess someone should measure it...
> 
> Gabor

The metadata is tiny and heavily optimized. That, and flushes to disk
are well tuned and optimized in the VFS layer. The elevator is well
tuned for access like this, and programs expect this performance when
dealing with te,porary files.

Swap, meanwhile, is largely synchronous, and could affect any part of
the system not locked into RAM. Programmers aren't as prepared for a
read from memory to block on paging in. So, IMO, the more swap pressure
you put on the system by filling up tmpfs mounts, the more unpredictable
your system will be, and that's far worse than being a few percentage
points slower on temp file operations.


Reply to: