• Dmitriy Vyukov's avatar
    sync: less agressive local caching in Pool · 8fc6ed4c
    Dmitriy Vyukov authored
    Currently Pool can cache up to 15 elements per P, and these elements are not accesible to other Ps.
    If a Pool caches large objects, say 2MB, and GOMAXPROCS is set to a large value, say 32,
    then the Pool can waste up to 960MB.
    The new caching policy caches at most 1 per-P element, the rest is shared between Ps.
    
    Get/Put performance is unchanged. Nested Get/Put performance is 57% worse.
    However, overall scalability of nested Get/Put is significantly improved,
    so the new policy starts winning under contention.
    
    benchmark                     old ns/op     new ns/op     delta
    BenchmarkPool                 27.4          26.7          -2.55%
    BenchmarkPool-4               6.63          6.59          -0.60%
    BenchmarkPool-16              1.98          1.87          -5.56%
    BenchmarkPool-64              1.93          1.86          -3.63%
    BenchmarkPoolOverlflow        3970          6235          +57.05%
    BenchmarkPoolOverlflow-4      10935         1668          -84.75%
    BenchmarkPoolOverlflow-16     13419         520           -96.12%
    BenchmarkPoolOverlflow-64     10295         380           -96.31%
    
    LGTM=rsc
    R=rsc
    CC=golang-codereviews, khr
    https://golang.org/cl/86020043
    8fc6ed4c
Name
Last commit
Last update
..
cmd Loading commit data...
lib9 Loading commit data...
libbio Loading commit data...
liblink Loading commit data...
pkg Loading commit data...
Make.dist Loading commit data...
all.bash Loading commit data...
all.bat Loading commit data...
all.rc Loading commit data...
clean.bash Loading commit data...
clean.bat Loading commit data...
clean.rc Loading commit data...
make.bash Loading commit data...
make.bat Loading commit data...
make.rc Loading commit data...
race.bash Loading commit data...
race.bat Loading commit data...
run.bash Loading commit data...
run.bat Loading commit data...
run.rc Loading commit data...
sudo.bash Loading commit data...