Memory usage

Michael Fischer michael at dynamine.net
Wed Jan 27 06:23:34 CET 2010


On Tue, Jan 26, 2010 at 7:23 PM, Martin Goldman <me at mgoldman.com> wrote:

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?
>

You can't guarantee that they will unless you set your cache size at or
below the amount of RAM you have installed.


> 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?
>

Technically, it's "go out and buy as much RAM as it will take to avoid being
swamped by paging".  But yes.


> 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?
>

Is your backing store file-based, or malloc-based?  If the latter, that
would explain the swap space being consumed.  Or, as Darryl said, the
housekeeping overhead of a VERY large file-backed cache could make the
Varnish process very large.

--Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20100126/aca49acd/attachment-0001.html>


More information about the varnish-misc mailing list