Varnish malloc + swap

Viktor Villafuerte viktor.villafuerte at
Mon Sep 12 02:40:59 CEST 2016

Hi Reinis,

On Mon 12 Sep 2016 03:22:36, Reinis Rozitis wrote:
> > I have changed kernel parameters for memory/swap usage but this is still
> > occuring.
> Just to check (if it's linux even), does this also include vm.swappiness = 0

Yes Linux RHEL6 and swappiness = 0. From my reading though varnish does
not follow this and it clearly appears so in my case.

> ?
> Though my own experience with older kernels is that once swap is taken it
> might never be released unless a manual swapoff is performed.
> > Any pointers to links, or wisdom learnt from experience is welcomed :)
> Is there a reason you need swap at all?
> In my mind it makes no sense having a swap on a 48G system. Even more if it
> (as it seems) is dedicated for a single service.

Yes, that was my first thought too, to get rid of swap. But currently
it's there and there's not much I can do about it now. Possibly when
Varnish upgrade happens this could be changed but for now I'm stuck with

> It takes just a bit (start with less and see at which point the ram usage
> stops growing) to tune the malloc setting so the varnish uses all the
> available ram optimally and the OOM killer doesn't kick in.
> p.s. also when making bigger caches than physical memory I have had much
> better results (on 3.0.x at least) instead of 'malloc' having a 'file'
> backend (on swapless systems) and relying on linux page cache rather than
> swap.

As speed is an important factor.. I'm assuming the file storage is
mapped to memory?

> rr




Viktor Villafuerte
Optus Internet Engineering
t: +61 2 80825265

More information about the varnish-misc mailing list