Another method would be to change the operation under test, to touch and read a large memory block - turning off the timer while this happens - so that only the concurrency ops are timed - I think then you will no longer see the 'super high performance' with the low routine counts. That is, do 'more work' yet constant that destroys the cache - and back into the concurrency times.
-- -----Original Message-----
From: changkun
Sent: Aug 26, 2019 2:23 PM
To: golang-nuts
Subject: Re: [go-nuts] sync.Mutex encounter large performance drop when goroutine contention more than 3400Your cache theory is very reasonable, but this was clear in the beginning post: "before or after the massive increase, performance drops linearly".Your hypothesis is reasonable, but how can you prove your hypothesis? By host machine cache usage monitoring?Matching of a concept is still not persuasive.
On Monday, August 26, 2019 at 8:08:27 PM UTC+2, Robert Engels wrote:Which is what I would expect - once the number of routines exhaust the cache, it will take the next level (or never since its main memory) to see an massive increase in time. 4800 is 30% slower than 3600 - so it is increasing linearly with the number of Go routines.-----Original Message-----
From: changkun
Sent: Aug 26, 2019 11:49 AM
To: golang-nuts
Subject: Re: [go-nuts] sync.Mutex encounter large performance drop when goroutine contention more than 3400According to your formula let's sample three points:--2400 goroutines: 2.508s/(50000000*2400) = 2.09 × 10^-11 s 3600 goroutines: 12.219s/(50000000*3600) = 6.78833333 × 10-11 seconds 4800 goroutines: 16.020s/(50000000*4800) = 6.67500 × 10^-11 sOne can observe that 3600 and 4800 mostly equal to each other, but they both three times slower than 2400.
goos: linuxgoarch: amd64BenchmarkMutexWrite/goroutines-2400-8 50000000 46.5 ns/op PASSok _/home/changkun/dev/tests 2.508s
goos: linuxgoarch: amd64BenchmarkMutexWrite/goroutines-3600-8 50000000 240 ns/op PASSok _/home/changkun/dev/tests 12.219sgoos: linuxgoarch: amd64BenchmarkMutexWrite/goroutines-4800-8 50000000 317 ns/op PASSok _/home/changkun/dev/tests 16.020s
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/6dd6ec66- .b0cc-4c8e-a341-94bff187214f% 40googlegroups.com
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/495e22e8-4a5f-4a1d-88f8-59ff2b0a4006%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/1337692853.6137.1566847685814%40wamui-albus.atl.sa.earthlink.net.