[Pkg-samba-maint] Default size limits for /run (/var/run) and /run/lock (/var/lock)
rleigh at codelibre.net
Wed Apr 13 09:32:42 UTC 2011
On Tue, Apr 12, 2011 at 12:38:03PM +0100, Roger Leigh wrote:
> On Mon, Apr 11, 2011 at 08:01:42PM +0100, Roger Leigh wrote:
> > With the transition to /run and /run/lock as tmpfs filesystems, it
> > would be desirable to provide sensible default size limits. Currently,
> > we default to the tmpfs default of ½ RAM. But with several tmpfs
> > filesystems, this does have the potential for the system to be OOMed
> > by a user filling up more than one of the filesystems. A sensible
> > default size limit would be useful here, for at least some of the
> > filesystems.
> > We currently allow specification of size limits for:
> > /run (RUN_SIZE)
> > /run/lock (LOCK_SIZE, optional)
> > /dev/shm (SHM_SIZE)
> > /tmp (TMP_SIZE, optional)
> > [from temporary git repo at http://git.debian.org/?p=collab-maint/sysvinit;a=summary]
> > In order to default to a sensible size, I would appreciate it if I
> > could have some figures for the useage of these filesystems: e.g.
> > % sudo du -sk /var/run /var/lock /dev/shm
> OK, some results:
> /var/run /var/lock /dev/shm
> Min 9 0 0
> 5% percentile 60 0 0
> Mean 886 9 599
> Median 120 8 0
> 95% percentile 612 17 310
> Max 47696 52 80744
Following the discussion yesterday, I'd like to propose doing
something like the example below. It's possible to size a tmpfs
as a percentage of core memory, the default being -o size=50%.
Rather than setting an absolute value, we can size e.g. /run
as a percentage of total memory, which should scale with /run
usage better than a fixed value.
Switch the default for all tmpfs mounts from 50% to 20%; it's
still very large, but you have to mount many more to be able to
break your system.
/run: Use 10% core. This gives 102MiB on 1GiB system; the largest
observed user used 50MiB. Even a system with 512MiB would not have
hit the observed maximum, and that was a very large system with
presumably more memory than this.
/run/lock and /lib/init/rw: 5MiB each. More than plenty, but far
less than current usage.
/run/shm: No default (use general tmpfs default of 20%)
/tmp: No default (use general tmpfs default of 20%)
# Defaults for tmpfs filesystems mounted in early boot, before
# filesystems from /etc/fstab are mounted.
# _SIZE variables are the maximum size (in bytes) that tmpfs
# filesystems can use. The size will be rounded down to a multiple of
# the page size, 4096 bytes. If no size is set, TMPFS_SIZE will be
# used as the default. _MODE variables are the initial access
# permissions for the root of the tmpfs mount. If no mode is set,
# TMPFS_MODE will be used as the default.
# TMPFS_SIZE: maximum size for all tmpfs filesystems if no specific
# size is provided. If no value is provided here, the kernel default
# will be used.
# RUN_SIZE: maximum size of /run (/var/run)
# Defaults to 10% core memory; the size required varies widely
# depending upon the demands of the software being run; this heuristic
# scales /run usage on system size. Samba in particular has been seen
# to use at least 50MiB in a large heavily used server. Typical usage
# is hundreds of KiB, maximum is tens of MiB.
# LOCK_SIZE: maximum size of /run/lock (/var/lock)
# Typical usage: tens of KiB; maximum hundreds of KiB. Default of
# 5MiB should ensure the limit is never reached.
LOCK_SIZE=5242880 # 5MiB
# SHM_SIZE: maximum size of /run/shm (/dev/shm)
# No default size; the size required varies widely depending upon the
# demands of the software being run.
# TMP_SIZE: maximum size of /tmp
# No default size.
# RW_SIZE: maximum size of /lib/init/rw
# Note /lib/init/rw is deprecated and programs using is are migrating
# to use /run. It will be removed once all users have migrated to
# Typical usage: tens of KiB. Default of 5MiB should ensure the limit
# is never reached.
RW_SIZE=5242880 # 5 MiB
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the Pkg-samba-maint