Τη Σάββατο, 29 Απριλίου 2017 - 7:33:00 π.μ. UTC+3, ο χρήστης Nikos 
Anastopoulos έγραψε:
>
> Either through the /proc/PID/tasks entries, or using 
> GODEBUG=schedtrace=1000.I get consistent results with both ways


 With some experimentation more I did, I tend to believe this behavior has 
somehow to do with the number of CPUs of the platform; or to be more 
precise, to the number of CPUs made available to the Go app through the CPU 
affinity mask. When reducing the available CPUs from 88 to 44, 22, 11, and 
so on, the total number of threads after a 4-min run decreases as well, as 
you can see from the detailed results below (look at the "threads" field). 
So it is quite possible that if you try to reproduce the test on a 
low-count CPU environment you won't see anything weird. 

Here are my results on my 88-CPU platform: 

export GODEBUG=schedtrace=1000

1. [default, 88-cpus]: ./bench 
//after 4 min
SCHED 240224ms: gomaxprocs=88 idleprocs=88 threads=29 spinningthreads=0 
idlethreads=27 runqueue=0 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

2. [44-cpus]: $ taskset -ca 0-43 ./bench
//after 4 min
SCHED 240143ms: gomaxprocs=44 idleprocs=44 threads=26 spinningthreads=0 
idlethreads=24 runqueue=0 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

3. [22-cpus]: $ taskset -ca 0-21 ./bench
//after 4 min
SCHED 240248ms: gomaxprocs=22 idleprocs=22 threads=23 spinningthreads=0 
idlethreads=21 runqueue=0 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

4. [11-cpus]: $ taskset -ca 0-10 ./bench
//after 4 min
SCHED 240189ms: gomaxprocs=11 idleprocs=11 threads=12 spinningthreads=0 
idlethreads=10 runqueue=0 [0 0 0 0 0 0 0 0 0 0 0]
239 81393

5. [8-cpus]: $ taskset -ca 0-7 ./bench 
//after 4 min
SCHED 240201ms: gomaxprocs=8 idleprocs=8 threads=9 spinningthreads=0 
idlethreads=7 runqueue=0 [0 0 0 0 0 0 0 0]

6. [4-cpus]: $ taskset -ca 0-3 ./bench
//after 4 min
SCHED 240184ms: gomaxprocs=4 idleprocs=4 threads=5 spinningthreads=0 
idlethreads=3 runqueue=0 [0 0 0 0]

7. [2-cpus]: $ taskset -ca 0,1 ./bench 
//after 4 min
SCHED 240171ms: gomaxprocs=2 idleprocs=2 threads=4 spinningthreads=0 
idlethreads=2 runqueue=0 [0 0]

8. [1-cpu]: $ taskset -ca 0 ./bench 
//after 4 min
SCHED 239437ms: gomaxprocs=1 idleprocs=1 threads=4 spinningthreads=0 
idlethreads=2 runqueue=0 [0]


I also checked if GOMAXPROCS is directly related, but I don't think so. For 
example, on a 2-CPU VM, I can perfectly set GOMAXPROCS=88 and run the app, 
but after the 4-min period the threads have reached a total count of 6: 
$ GOMAXPROCS=88 GODEBUG=schedtrace=1000 ./bench 
SCHED 240298ms: gomaxprocs=88 idleprocs=88 threads=6 spinningthreads=0 
idlethreads=4 runqueue=0 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
239 81393

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to