Τη Κυριακή, 30 Απριλίου 2017 - 2:36:15 π.μ. UTC+3, ο χρήστης Ian Lance Taylor έγραψε: > > On Sat, Apr 29, 2017 at 3:09 AM, Nikos Anastopoulos <n.an...@gmail.com > <javascript:>> wrote: > > Τη Σάββατο, 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. > > All else being equal, which it never is, the number of threads used by > Go will tend to level out at about GOMAXPROCS plus a bit. If you have > 88 available CPUs, GOMAXPROCS will default to 88, and over time you > should expect to see your program using around 92 threads. > > If you see the number of threads growing significantly beyond > GOMAXPROCS, without an obvious explanation like blocking C threads, > then there may be a problem. > > Ian >
Thanks for your feedback. As a last question, what is the application aspect (or other factors) that determines how quickly new threads are being employed over time? For example, in my scenario above, if I choose to do the parsing using plain regexp rather than xml.Unmarshal, the threads will reach a count of ~8 within the same period (4 mins), vs 28 when using xml.Unmarshal. In some other Go apps, threads will remain constant (i.e., 4) forever. Where is this difference attributed? -- 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.