Descriptionsync: less agressive local caching in Pool
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%
Patch Set 1 #Patch Set 2 : diff -r 2a858c0830af https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 3 : diff -r 77578375f623 https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 4 : diff -r 77578375f623 https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 5 : diff -r 77578375f623 https://dvyukov%40google.com@code.google.com/p/go/ #
Total comments: 6
Patch Set 6 : diff -r 77578375f623 https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 7 : diff -r 7af8faea95c9 https://dvyukov%40google.com@code.google.com/p/go/ #
MessagesTotal messages: 7
|