NetBSD-Users archive

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

Re: create /tmp with ffs vs. tmpfs ?



Steve Rikli <sr%genyosha.net@localhost> writes:

> 1) is my understanding correct? I.e. does tmpfs use main memory for
>    backing, rather than swap or something else?

It uses virtual memory which can be paged.  So if you have swap space
configured, it can be bigger than physical memory.  However, things in
/tmp will compete with other memory usage.

> 2) can I configure /tmp as ffs rather than tmpfs?

Absolutely.   tmpfs is relatively new in the history of unix and having
tmp as a real filesystem is entirely reasonable.

> Seems like I should be able to (manually?) configure /tmp as ffs during
> initial sysinst, or leave some unallocated disk space to do it later.

As Martin said you can leave it on /.  Original unix tradition was to
have separate / and /usr, which let you boot if / was ok.  And it
protects / from becoming full from runaway activities in /usr, like
actual users on a multiusers system.  So you can make a 4GB /tmp
separately so that when /tmp is full / is still ok.  Or you can just
have one giant partition and take your chances, with more efficiency.
128G isn't that big a disk.

Definitely add swap, maybe even more then 4G depending on what you want
to do.   But 4G is probably enough for anything you want to put up with
waiting for anyway.

> My main thoughts were to avoid using RAM for tmpfs and simply configure
> a larger swap partition, or add a swap file, etc.

There is a really good question here.  Which is, for some reasonable
workloads, building programs that use 100M of /tmp and 1.5 GB of /tmp, how
things go with

  both system 4 GB swap

  A) big / with tmp just part of /

  B) big / with 2GB tmpfs

I am really not sure what is better.  I suspect tmpfs performance is
better for the times when /tmp is only 100-200 MB or so.  I am really
not sure how it would go with larger.

When building packages, some are ridiculous, e.g. thunderbird, which I
think needs around 19 GB of $WRKDIR space.  I have code in mk.conf.local
to flip from /tmp/work to /nfs/ztmp/work-$hostname where the latter is
over NFS and a zfs filesystem on a big disk.  It's slow but the builds
finish.  So you may be able to use a smallish tmpfs and point specific
big jobs elsewhere.  That's more work but higher performance - after you
get it right.


Home | Main Index | Thread Index | Old Index