[go-nuts] Re: golang cpu usage question

2017-03-28 Thread 刘桂祥
yes ,I do a str += str0 so many in my program now I change to use bytes,Buffer to solve it And I really need to do a gc monitor that notice me my code is worse now gc frequency and pause time do not notice me does the runtime gc_cpu_fraciton (the same as GODEBUG=gctrace=1 CPU occupy ) say some

[go-nuts] Re: golang cpu usage question

2017-03-28 Thread Dave Cheney
It looks like your program is generating in excess of 4gb of garbage a second. I suggest generating a memory profile with pkg/profile and looking at your allocation hotspots. gc 708 @641.202s 11%: 9.2+1025+0.50+0.31+32 ms clock, 55+1025+0+9983/0.013/9124+194 ms cpu, 8189->8363->4389 MB, 8399 M

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread 刘桂祥
my production program data: ... gc 149 @91.330s 6%: 6.8+557+0.50+1.0+10 ms clock, 20+557+0+1841/0/1304+31 ms cpu, 3694->3793->2016 MB, 3789 MB goal, 48 P gc 150 @92.012s 6%: 2.9+505+0.32+0.58+9.5 ms clock, 11+505+0+1756/0.014/1574+38 ms cpu, 3739->3805->1987 MB, 3835 MB goal, 48 P gc 151 @92.632s

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread Dave Cheney
Or to answer​ your question another way; the more allocations your program performs, the​ higher the GC overhead to clean them up. Are you asking: is there a way to limit the % CPU the GC is allowed to use? If so, the answer is no, because: 1. If the GC doesn't keep up with the garbage your pro

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread Dave Cheney
I'm not sure what you expected to see. That program does nothing but generate garbage. It's going to have a high overhead to clean up that garbage. Can you show some data from your real program? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread 刘桂祥
package main import ( "fmt" "time" ) func foo() { str := "" for i := 0; i < 1000; i++ { str += "aa" } } func main() { for i := 0; i < 200; i++ { go func() { for {

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread Dave Cheney
I suggest two things 1. Post the GODEBUG output here, someone will be able to confirm how much time they GC is using. 2. Use github.com/pkg/profile to generate an execution trace and analyse it with go tool trace. -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread 刘桂祥
now In my application 48 core set GODEBUG=gctrace=1 the gc CPU percent is 17% but my server request have many long time case want to know the CPU percent in witch percentage is hight?? 在 2017年3月27日星期一 UTC+8下午6:55:47,Dave Cheney写道: > > > > On Monday, 27 March 2017 21:12:44 UTC+11, 刘桂祥 wrote:

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread Dave Cheney
On Monday, 27 March 2017 21:12:44 UTC+11, 刘桂祥 wrote: > > Hi Dave: >very thanks your timely response >two more question >1. GODEBUG=gctrace=1 Do have some method get these quota from > runtime package apis ? > no >2. In go1.7 the concurent gc could oc

[go-nuts] Re: golang cpu usage question

2017-03-27 Thread 刘桂祥
Hi Dave: very thanks your timely response two more question 1. GODEBUG=gctrace=1 Do have some method get these quota from runtime package apis ? 2. In go1.7 the concurent gc could occupy all cpu core ?? does it have cpu usgae limit ? 在 2017年3月27日星期一