• 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
api Loading commit data...
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...