Memory usage

Martin Goldman me at mgoldman.com
Wed Jan 27 04:51:52 CET 2010


Thanks Darryl!

One follow-up about the VIRT size (mine is 55.2GB). I thought the VIRT size
includes the entire amount of VARNISH_STORAGE_SIZE (50GB in my case),
regardless of how much of the virtual memory is actually being used to store
cached objects. This seems to be the case based on a few minutes of
experimenting with that setting. So I'm not sure I understand how to
determine the amount of virtual memory I'm actually using -- in other words,
the amount of RAM I need to add for optimal performance -- from the VIRT and
RES numbers alone. Any chance I could ask you to please fill in what I'm
missing?

Thanks again,
Martin

On Tue, Jan 26, 2010 at 10:34 PM, Darryl Dixon - Winterhouse Consulting <
darryl.dixon at winterhouseconsulting.com> wrote:

> Hi Martin,
>
> > I'm running Varnish on a box with 4GB RAM. There are hundreds of
> thousands
> > of objects being served, and I'm certain that they don't all fit in that
> > relatively meager amount of RAM. I understand that Varnish's model
> > dictates
> > that the kernel will be trusted to use virtual memory as necessary if the
> > cached objects don't fit in RAM. I have a few questions about this:
> >
> > 1. How can you tell whether your Varnish objects fit in RAM?
>
> In short, `top` - the VIRT column tells you total virtual process size,
> the RES column then tells you which portion of that is currently resident
> in physical memory
>
> > 2. If I have objects residing in virtual memory, to what extent will my
> > performance be adversely affected? If I want my site to be fast, do I
> > basically need to go out and buy as much RAM as it will take so that
> > virtual memory isn't needed?
>
> Pretty much.
>
> > 3. I noticed tonight that my machine was using a few hundred megs of swap
> > space, which I've never seen happen before. Varnish is the only
> non-system
> > service running on this box. My understanding was that Varnish would get
> > only as much RAM as was available and then send the overflow into the
> > file-backed virtual memory. If that's the case, though, then why is swap
> > space being used? Is this just a side effect of how the kernel allocates
> > memory, or is something else going on here?
>
> Two things;
> 1) The varnish process itself requires memory (eg, to hold the ban list
> etc), which is not part of the file-backed object cache.
> 2) Even if the above usage were minimal, it is still entirely possibly
> that your VMM (the OS) has decided that the memory being used to cache
> objects is more important that some other system processes that have now
> been shunted out to swap. Once again, `top` VIRT versus RES will give you
> a good clue
>
> regards,
> Darryl Dixon
> Winterhouse Consulting Ltd
> http://www.winterhouseconsulting.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20100126/d4b8de2a/attachment-0001.html>


More information about the varnish-misc mailing list