Controlling memory usage
andersb at vgnett.no
Mon Jul 17 22:47:18 CEST 2006
On Jul 17, 2006, at 21:34, Dag-Erling Smørgrav wrote:
> Anders Berg <andersb at vgnett.no> writes:
>> The reason Anders N. asks about this is how Squid works today. The
>> squid.conf file leaves you with a option to specify how much RAM you
>> wanna use for Squid.
> I've worked with Squid quite a lot myself, and IIRC it normally uses
> about four times as much as you specify in the config file...
>> The problem is that Squid (probably because of
>> old design) does not really "follow" that option. If you set 256 MB
>> RAM, you can still end up using 500 MB RAM, and if you set option
>> close to max memory you will for certain overflow your physical RAM
>> and start swapping/die. Your answer was detailed Poul-Henning, but
>> what will prevent this from happpening in Varnish? Lets say you have
>> 2 applications running on a Varnish box, and both use the memory
>> model Varnish uses, what will happen in the long run with a lot of
>> traffic? Will they both adjust themselvs to match pysical RAM, how
>> would they "compete" for RAM etc? It's possible you have already
>> answered that below, but how do we "limit" RAM usage?
> We don't. The kernel takes care of it. If memory is scarce, the
> kernel will allocate less memory to the buffer cache and Varnish
> performance will decrease.
> (assuming you use file storage, not malloc storage)
> As for heap usage, which the kernel has less control over, it is
> mostly a function of the number of objects in the cache; we can take
> care of that by setting an upper limit on the number of cached
> objects, or even on the amount of heap used to track objects.
Thx for input DES. Setting an upper limit either in objects or heap
is a good way to control memory usage (And the right one I guess).
Are we gonna implement this?
> Dag-Erling Smørgrav
> Senior Software Developer
> Linpro AS - www.linpro.no
> varnish-dev mailing list
> varnish-dev at projects.linpro.no
More information about the varnish-dev