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

Re: Moving /tmp to tmpfs makes it useless

On Sat, May 26, 2012 at 04:27:01PM -0400, Joey Hess wrote:
> Josselin Mouette wrote:
> > Oh stop, there is a difference: in a tmpfs the system doesn’t need to
> > commit the data on disk, and therefore can write it to disk whenever it
> > likes, especially when the disk is not too used. There is no need to
> > keep a journal nor to access the disk several times to update metadata.
> > Only unused data is written to disk. Which means a *huge* performance
> > improvement. Do the measurements yourself, it works with basically
> > anything that makes heavy use of /tmp.
> I'm looking foward to a report from systems instrumented to track all
> accesses to /tmp, that analizes the frequency of accesses and gives
> numbers about just how huge this performance improvement is.
> Until we have such a report, why are we engaging in premature optimisation?

Recently, I had a pile of over a hundred snapshots of a project in tarballs
and zips, all with random extra junk, never having the same capitalization
of file names, etc.  I wanted to put all non-junk data into git.  Cue ad-hoc
scripts to unzip, fix newlines, check encoding and convert to UTF-8 if
needed, etc, etc.  Lots of churn but at any given time the working set was a
small fraction of memory.

Every iteration took 60ish seconds of I/O -- damn frustrating when
interspersed with manual work.  I then tried it on /tmp/, and suddenly
everything went down to well below a second.

So don't tell me real filesystems are "almost as good" as tmpfs when memory
is not tight so there's no need for writeouts.  And on modern systems,
memory is hardly ever tight.

I think that box had jfs, but other filesystems are no different: for
example, ext* will fsync() during a rename() call behind your back even if
you don't request it, forcing every file to hit the disk platters even
though they'll immediately get changed again.  For files outside /tmp/ that
makes sense: the system has to guarantee you won't lose data during a crash.
But why should I care about not losing temp files?

I was born an ugly, dumb and work-loving child, then an evil midwife
replaced me in the crib.

Attachment: signature.asc
Description: Digital signature

Reply to: