• 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
.circleci Loading commit data...
.github Loading commit data...
bin Loading commit data...
doc Loading commit data...
etc Loading commit data...
include Loading commit data...
lib Loading commit data...
m4 Loading commit data...
man Loading commit data...
tools Loading commit data...
.dir-locals.el Loading commit data...
.envrc Loading commit data...
.gitignore Loading commit data...
.lgtm.yml Loading commit data...
.syntastic_c_config Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING Loading commit data...
ChangeLog Loading commit data...
INSTALL Loading commit data...
LICENSE Loading commit data...
Makefile.am Loading commit data...
README.Packaging Loading commit data...
README.rst Loading commit data...
autogen.des Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...
flint.lnt Loading commit data...
varnish-legacy.m4 Loading commit data...
varnish.m4 Loading commit data...
varnishapi-uninstalled.pc.in Loading commit data...
varnishapi.pc.in Loading commit data...