• 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
..
varnishadm Loading commit data...
varnishd Loading commit data...
varnishhist Loading commit data...
varnishlog Loading commit data...
varnishncsa Loading commit data...
varnishstat Loading commit data...
varnishtest Loading commit data...
varnishtop Loading commit data...
Makefile.am Loading commit data...
flint.lnt Loading commit data...