-
Notifications
You must be signed in to change notification settings - Fork 18k
sync: eliminate global Mutex in (*Pool).pinSlow operations #65567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Change-Id: I016581eb5a08d44bfed495be11a9bbd53a107da7
This PR (HEAD: 760ce2c) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/562336. Important tips:
|
Message from qiulaidongfeng: Patch Set 2: Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
Message from Go LUCI: Patch Set 2: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2024-02-07T10:44:00Z","revision":"5bbd7c0d0af405231913ac3feedbbf45b94fbeed"} Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
Change-Id: I0e12abb9bc848f6cb053f7b3d39beec65dadd967
Message from qiulaidongfeng: Patch Set 2: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
Message from Go LUCI: Patch Set 2: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
Message from Go LUCI: Patch Set 2: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
This PR (HEAD: c0329c2) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/562336. Important tips:
|
Message from qiulaidongfeng: Patch Set 3: Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
Message from Go LUCI: Patch Set 3: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2024-02-07T13:12:44Z","revision":"6217826db95e9fdcbf374c41378b334bbfe42da9"} Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
Message from qiulaidongfeng: Patch Set 3: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
Message from Go LUCI: Patch Set 3: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
Message from Go LUCI: Patch Set 3: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
Message from qiulaidongfeng: Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
Message from qiulaidongfeng: Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
Message from qiulaidongfeng: Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
Message from Ian Lance Taylor: Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/562336. |
goos: windows
goarch: amd64
pkg: sync
cpu: AMD Ryzen 7 7840HS w/ Radeon 780M Graphics
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
Pool-16 0.9467n ± 2% 0.9390n ± 3% ~ (p=0.353 n=10)
PoolOverflow-16 188.5n ± 1% 188.8n ± 1% ~ (p=0.239 n=10)
PoolStarvation-16 2.573µ ± 1% 2.619µ ± 1% +1.79% (p=0.000 n=10)
PoolSTW-16 9.140µ ± 60% 10.863µ ± 99% ~ (p=0.110 n=10)
PoolExpensiveNew-16 1.556 ± 1% 1.553 ± 1% ~ (p=0.853 n=10)
PoolpinSlow-16 494.3n ± 4% 269.8n ± 5% -45.42% (p=0.000 n=10)
geomean 3.844µ 3.583µ -6.81%
Removing the mutex in pinslow can cause this:
go test -count=100 sync
fatal error: schedule: holding locks
So don't try ShardedValue after wait for go.dev/issue/18802 to finish.
shardPoolsSize is 256 because the current size benchmark shows
that the performance improvement has not significantly affected BenchmarkPoolSTW.
Larger shardPoolsSize, for example shardPoolsSize is 512,
There are more performance improvements as follows:
goos: windows
goarch: amd64
pkg: sync
cpu: AMD Ryzen 7 7840HS w/ Radeon 780M Graphics
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
Pool-16 0.9467n ± 2% 0.9257n ± 2% -2.22% (p=0.014 n=10)
PoolOverflow-16 188.5n ± 1% 187.5n ± 1% ~ (p=0.127 n=10)
PoolStarvation-16 2.573µ ± 1% 2.610µ ± 2% +1.44% (p=0.019 n=10)
PoolSTW-16 9.140µ ± 60% 16.817µ ± 78% +84.00% (p=0.011 n=10)
PoolExpensiveNew-16 1.556 ± 1% 1.559 ± 1% ~ (p=0.123 n=10)
PoolpinSlow-16 494.3n ± 4% 253.4n ± 4% -48.74% (p=0.000 n=10)
geomean 3.844µ 3.800µ -1.16%
Because of the drastic changes in BenchmarkPoolSTW,
this CL do not shardPoolsSize is 512 to obtain a greater performance improvement.
Fixes #24479