Threads + thread queue length

Viktor Villafuerte viktor.villafuerte at optusnet.com.au
Thu Nov 12 03:55:01 CET 2015


>From Varnish source code:

PARAM(
        /* name */      thread_pool_add_delay,
        /* tweak */     tweak_timeout,
        /* var */       thread_pool_add_delay,
        /* min */       0.000,
        /* max */       none,
        /* default */   0.000,
        /* units */     seconds,
        /* flags */     0| EXPERIMENTAL,
        /* s-text */
        "Wait at least this long after creating a thread.\n"
        "\n"
        "Some (buggy) systems may need a short (sub-second) delay between "
        "creating threads.\n"
        "Set this to a few milliseconds if you see the 'threads_failed' "
        "counter grow too much.\n"
        "Setting this too high results in insuffient worker threads.\n",
        /* l-text */    "",
        /* func */      NULL
)

which would make the value SECONDS

BUT

>From Varnish docs:

-p thread_pool_add_delay=2 (default: 20ms, default in master: 2ms)
Reducing the add_delay lets you create threads faster which is essential
    - specially at startup - to avoid filling up the queue and dropping requests.



v




On Thu 12 Nov 2015 12:40:27, Viktor Villafuerte wrote:
> I think I might have found the problem here.. :/
> 
> thread_pool_add_delay
> 
> the doco says that the values are in milliseconds but if I set this to 2
> (which should be 2ms) it makes the server handle traffic very badly and
> only very gradually increases perfomance.. However if I set this to 0
> then everything runs immediately and well. Furthermore in the docs it
> says:
> 
> Reducing the add_delay lets you create threads faster which is
> essential - specially at startup - to avoid filling up the queue and
> dropping requests.
> 
> which would exactly fit my (sad) scenario below..
> 
> 
> Could anybody confirm that the value is in milliseconds and not in
> seconds?
> 
> thanks
> 
> v
> 
> 
> 
> On Wed 11 Nov 2015 09:52:52, Viktor Villafuerte wrote:
> > I'm bumping this 'thread' up to the top since CJ Ess has just asked a
> > question related to threads also.. I hate doing this but I'm hoping that
> > somebody could (maybe) answer this too..?
> > 
> > v
> > 
> > On Mon 12 Oct 2015 15:17:05, Viktor Villafuerte wrote:
> > > Hi all you carpenters and other Varnish using folk,
> > > 
> > > There are couple of things in the output of varnishstat that puzzle me a
> > > little..
> > > 
> > > MAIN.sess_drop               0         0.00 Sessions dropped
> > > MAIN.sess_dropped            3809332         0.32 Sessions dropped for
> > > thread
> > > MAIN.fetch_no_thread           58746         0.01 Fetch failed (no
> > > thread)
> > > MAIN.pools                         2          .   Number of thread pools
> > > MAIN.threads                    1255          .   Total number of
> > > threads
> > > 
> > > I've got 2 pools of 4000 threads set in Varnish config and
> > > man varnish-counters says:
> > > 
> > > sess_drop
> > > Count of sessions silently dropped due to lack of worker thread.
> > > 
> > > sess_dropped
> > > Number of times session was dropped because the queue were too long
> > > already. See also parameter queue_max.
> > > 
> > > fetch_no_thread
> > > beresp fetch failed, no thread available
> > > 
> > > 
> > > This tells me that there's no lack of worker threads (good!), but the
> > > thread queue length does get too long and subsequently sessions get
> > > dropped (bad!). Also backend fetch failed due to no threads being
> > > available (what?)
> > > 
> > > 
> > > Now the puzzling bit :)
> > > 
> > > 1) why would the thread queue get too long if there seems to be NO lack
> > > of threads to use?
> > > 
> > > 2) why would there be no threads if there seems to be NO lack of threads
> > > 
> > > 3) 'See also the parameter queue_max' - but I cannot find any mention of
> > > such parameter anywhere around? Where does this ellusive paramater live
> > > then?
> > > 
> > > 
> > > Could anybody shed bit of light on this for me?
> > > 
> > > 
> > > 
> > > 
> > > -- 
> > > Regards
> > > 
> > > Viktor Villafuerte
> > > Optus Internet Engineering
> > > t: +61 2 80825265
> > > 
> > > _______________________________________________
> > > varnish-misc mailing list
> > > varnish-misc at varnish-cache.org
> > > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
> > 
> > -- 
> > Regards
> > 
> > Viktor Villafuerte
> > Optus Internet Engineering
> > t: +61 2 80825265
> > 
> > _______________________________________________
> > varnish-misc mailing list
> > varnish-misc at varnish-cache.org
> > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
> 
> -- 
> Regards
> 
> Viktor Villafuerte
> Optus Internet Engineering
> t: +61 2 80825265
> 
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

-- 
Regards

Viktor Villafuerte
Optus Internet Engineering
t: +61 2 80825265



More information about the varnish-misc mailing list