Mailing List Archive

Huge system load when starting Varnish Cache
Hello,

I am using Varnish Cache to cache IPTV (hls format) segments. It usually
works really well, serving 1-3gpbs of traffic. However, if, for some
reason, I need to restart it, then shortly after it starts it takes up all
CPU (all 24 threads) for "system" until it allocates the set memory limit
(malloc,6GB).

During that time (a few minutes), the requests from clients are served
slow. This is expected since the cache is still not populated, however, the
huge system load slows down the whole sever and makes other services slow
as well.

This problem happens with Varnish version 2.1.5 (the one in the default
repository for CentOS6) and with version 4.0.4.

If the backend is too slow for some reason, then Varnish usually just keeps
using all CPU all the time. Increasing the memory limit above 6GB makes the
startup process much longer (too long to wait for it in higher load
conditions).

Is there a way to limit the system load during this process?
Re: Huge system load when starting Varnish Cache [ In reply to ]
On a hunch: can you post your Varnish command line please (the v4 one)?
Re: Huge system load when starting Varnish Cache [ In reply to ]
/usr/sbin/varnishd -a :80 -f /etc/varnish/default.vcl -T 127.0.0.1:6082 -t
120 -p thread_pool_min=256 -p thread_pool_max=4095 -p
thread_pool_timeout=120 -u varnish -g varnish -S /etc/varnish/secret -s
malloc,6G -P /var/run/varnish.pid

On Sat, Feb 18, 2017 at 11:44 AM, Guillaume Quintard <
guillaume@varnish-software.com> wrote:

> On a hunch: can you post your Varnish command line please (the v4 one)?
>
Re: Huge system load when starting Varnish Cache [ In reply to ]
Maybe your machine is a bit slow to start threads, would you mind
changing thread_pool_min
to 4000 ?

Also, could you try 4.1 and see if you still have the problem?

--
Guillaume Quintard

On Sat, Feb 18, 2017 at 11:53 AM, Pentium100 <pentium100@gmail.com> wrote:

> /usr/sbin/varnishd -a :80 -f /etc/varnish/default.vcl -T 127.0.0.1:6082
> -t 120 -p thread_pool_min=256 -p thread_pool_max=4095 -p
> thread_pool_timeout=120 -u varnish -g varnish -S /etc/varnish/secret -s
> malloc,6G -P /var/run/varnish.pid
>
> On Sat, Feb 18, 2017 at 11:44 AM, Guillaume Quintard <
> guillaume@varnish-software.com> wrote:
>
>> On a hunch: can you post your Varnish command line please (the v4 one)?
>>
>
>
Re: Huge system load when starting Varnish Cache [ In reply to ]
Thank you, I will try it next time I need to restart Varnish on that server.

On Mon, Mar 6, 2017 at 12:17 PM, Guillaume Quintard <
guillaume@varnish-software.com> wrote:

> Maybe your machine is a bit slow to start threads, would you mind changing thread_pool_min
> to 4000 ?
>
> Also, could you try 4.1 and see if you still have the problem?
>
> --
> Guillaume Quintard
>
> On Sat, Feb 18, 2017 at 11:53 AM, Pentium100 <pentium100@gmail.com> wrote:
>
>> /usr/sbin/varnishd -a :80 -f /etc/varnish/default.vcl -T 127.0.0.1:6082
>> -t 120 -p thread_pool_min=256 -p thread_pool_max=4095 -p
>> thread_pool_timeout=120 -u varnish -g varnish -S /etc/varnish/secret -s
>> malloc,6G -P /var/run/varnish.pid
>>
>> On Sat, Feb 18, 2017 at 11:44 AM, Guillaume Quintard <
>> guillaume@varnish-software.com> wrote:
>>
>>> On a hunch: can you post your Varnish command line please (the v4 one)?
>>>
>>
>>
>
Re: Huge system load when starting Varnish Cache [ In reply to ]
On Fri, Mar 10, 2017 at 2:59 PM, Pentium100 <pentium100@gmail.com> wrote:
> Thank you, I will try it next time I need to restart Varnish on that server.

Hello,

This is a runtime parameter, you don't need to restart Varnish to tune
that one. Simply use varnishadm and update your service configuration
to persist it for future restarts.

Dridi

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc