Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Aug 2000 08:47:06 -0700 (PDT)
From:      Matt Dillon <dillon@earth.backplane.com>
To:        "Allen Pulsifer" <pulsifer@mediaone.net>
Cc:        <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: RE: what to do about /tmp
Message-ID:  <200008181547.IAA55501@earth.backplane.com>
References:   <NBBBJNDFEKPEHPFCLNLHMEIDHNAA.pulsifer@mediaone.net>

next in thread | previous in thread | raw e-mail | index | archive | help

:
:Matt,
:
:I noticed /tmp and /var/tmp are used slightly differently, for example, the
:contents of /tmp are not expected to survive a reboot, while /var/tmp is
:used for files you might need after a crash, like vi recovery files.

    This may have been true at one time in the past, but these days 
    /tmp and /var/tmp tend to be used interchangeably.  You can't make
    those sorts of assumptions.

:One advantage of mounting /tmp with MFS is that you don't have use up another
:disk partition.  Performance-wise, I would think data moves something
:like this:
:
:/tmp on MFS:
:   application data --> kernel VM --> paged to disk
:
:/tmp on FFS:
:   application data --> kernel file buffer --> flushed to disk
:
:Is that basically correct?  What makes MFS less efficient than FFS?
:What would be the implications of creating a 512 MB swap partition
:and mounting an MFS /tmp?
:
:Thanks,
:
:Allen

    There are several problems with MFS:

	* The active data set is cached in memory TWICE rather then just
	  once.  That is, for each page of file data two pages is taken up
	  of memory.  

	* While it is true that MFS will swap unused data, performance under
	  heavy load will go to pot because MFS does not in any way attempt
	  to sequence the data to swap.  

	  MFS may appear fast under light loads, but performance degrades
	  drastically (to much worse then what you get with FFS) under
	  heavy memory loads.

	* MFS eats a 'random' amount of swap, up to the size of the MFS
	  disk.  Under medium loads where paging is taking place, the
	  swap backing store for MFS becomes fragmented and performance
	  goes to pot.

    There are two solutions:

	* First, you can use vnconfig to create a swap-backed filesystem
	  and you can reserve the necessary swap wspace contiguously,
	  resulting in performance which will be as good or better then
	  a normal FFS filesystem (because your swap space may be striped
	  across several disks).

	* Second, you can use a normal FFS partition.

	In either case enabling softupdates on the vnconfig or normal 
	FFS partition should result in good overall peformance without
	the load penalty.

	With both solutions it is a good idea to make /var/tmp the partition
	and make /tmp a softlink to /var/tmp.

    Using MD instead of MFS is typically not a great choice.  While it is
    true that MD only caches data once, the data is not swap-backed so
    what data MD does allocate is allocated permanently.  This is useful
    in certain system configurations but not useful in the general case.

					-Matt



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008181547.IAA55501>