• Nils Goroll's avatar
    Yield to newly bred threads · 6e47cd6a
    Nils Goroll authored
    When we breed threads without a delay, we should make an effort to let
    them run as soon as possible and not have the cpu occupied with the
    herder code.
    
    This will increase the overhead due to additional context switching for
    the benefit of reducing latencies until new threads get to run.
    
    Effect seen with this vtc by @Dridi:
    
        varnishtest "over-breeding"
    
        varnish v1 -arg "-p thread_pools=1 -p thread_pool_min=10"
        varnish v1 -vcl {
                backend be none;
        } -start
    
        varnish v1 -expect MAIN.threads == 10
    
    Tested with the following script:
    
        ./varnishtest -i -k -j40 -n1000 tests/as_above.vtc |
        awk '/^#/ { print $5; }'|
        sort |
        uniq -c
    
    Multiple runs show a consistent drop of failed tests:
    
        before | after
        -------+------
            76 |    18
            67 |    24
            66 |    18
    6e47cd6a
Name
Last commit
Last update
..
cache Loading commit data...
common Loading commit data...
fuzzers Loading commit data...
hash Loading commit data...
hpack Loading commit data...
http1 Loading commit data...
http2 Loading commit data...
mgt Loading commit data...
proxy Loading commit data...
storage Loading commit data...
waiter Loading commit data...
Makefile.am Loading commit data...
VSC_lck.vsc Loading commit data...
VSC_main.vsc Loading commit data...
VSC_mempool.vsc Loading commit data...
VSC_mgt.vsc Loading commit data...
VSC_sma.vsc Loading commit data...
VSC_smf.vsc Loading commit data...
VSC_smu.vsc Loading commit data...
VSC_vbe.vsc Loading commit data...
builtin.vcl Loading commit data...
flint.lnt Loading commit data...
flint.sh Loading commit data...
vclflint.lnt Loading commit data...
vclflint.sh Loading commit data...