On 11/4/07, John-Paul Drawneek <[EMAIL PROTECTED]> wrote:
> apache seems to be eating all the ram.
> build 75
> sparc
> its in a zone which its memory is capped, its coolstack apache2 with apc on.
> Any one else seem this?

How is this configured?  Most likely, you have confusion between
physical and swap.  They are just the opposite from what you might

>From zonecfg(1M):

     capped-memory: physical, swap, locked

         The caps on the memory that can be used by this zone.  A
         scale  (K, M, G, T) can be applied to the value for each
         of these numbers (for example, 1M is one megabyte). Each
         of  these  properties  is optional but at least one pro-
         perty must be set when adding this resource. Only a sin-
         gle  instance of this resource can be added to the zone.
         The physical property sets the max-rss  for  this  zone.
         This will be enforced by rcapd(1M) running in the global
         zone. The swap property is the preferred way to set  the
         zone.max-swap rctl. The locked property is the preferred
         way to set the zone.max-locked-memory rctl.

>From rcapd(1M):

     When  the  resident  set  size  (RSS)  of  a  collection  of
     processes  exceeds  its  cap, rcapd takes action and reduces
     the RSS of the collection.

That is, if you set the physical cap only, this will still allow
memory allocations to continue unbounded.  However, so long as rcapd
is running in the global zone, pages of physical memory will be filled
by paging them out to swap space or other backing store.  If rcapd is
not running, it seems as though this would have no effect.

To make it so that memory allocation fails and Apache and the rest of
the zone can't use more RAM (likely crashing Apache or anything else
that tries to allocate memory above the limit), you really want to set
the swap limit.  This is counter-intuitive only because the definition
of swap in this context is poorly understood, largely because the term
has different meanings based upon the context.  In this context, swap
is the amount of physical RAM + "swap space" (swap devices + swap
files) that can be used by the zone.

In other words, if you want a zone to be able to use 1 GB of physical
memory and allow another 1 GB to be paged out, you would want to set
physical to 1 GB and swap to 2 GB.

Note that when a process requests and is granted a memory allocation,
this immediately turns into a swap reservation.  Physical memory is
not actually considered used until it is touched.  The most common
scenario I see where this pops up is when several java processes are
running with large -Xmx parameters set but don't actually use all of
this memory.

Mike Gerdts
zones-discuss mailing list

Reply via email to