Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
rw.r.Intn(rw.sumOfWeights) //fmt.Printf("rand val: %d\n",randomWeight) ... } I am sorry about that I did't give the context of my code. 在 2019年6月27日星期四 UTC+8上午11:22:49,Kurtis Rader写道: > > On Wed, Jun 26, 2019 at 8:18 PM Chou Yan > wrote: > >> I fix it by : >> &g

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
ializing the RNG in a tight loop. Since > `time.Now().Unix()` has a resolution of one second you end up generating > the same initial value every time through the loop until the current time > advances to the next second. > > On Wed, Jun 26, 2019 at 7:48 PM Chou Yan > wrote:

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
,errors.New("get next err") } return no, nil } } thx 在 2019年6月27日星期四 UTC+8上午11:16:01,Chou Yan写道: > > The situation I am currently experiencing is that it only occur on my > online app. I try it at local but I can not got the result. > haha... I make a mistake. > the code i

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
6月27日星期四 UTC+8上午10:52:56,Burak Serdar写道: > > On Wed, Jun 26, 2019 at 8:48 PM Chou Yan > wrote: > > > > like this: > > r:=rand.New(rand.NewSource(time.Now().Unix())) > > for { > > r.Intn(96) > > } > > I know the same seed will generate t

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Chou Yan
o()', It will not. I suspect what this is related to the seqence rand algorithm,But I have no relevant evidence 在 2019年6月27日星期四 UTC+8上午10:32:38,Burak Serdar写道: > > On Wed, Jun 26, 2019 at 8:17 PM Chou Yan > wrote: > > > > I use: > > r:=rand.New(rand.NewSource(t

[go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now().U

2019-06-26 Thread Chou Yan
I use: r:=rand.New(rand.NewSource(time.Now().Unix())) r..Intn(96) I got: and val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand val: 82 rand

[go-nuts] Re: how to decrease the HeapIdle of Memory to free memory to Linux?

2019-06-23 Thread Chou Yan
I use 'debug.FreeOsMemory'. But it is not the certain. 在 2019年6月24日星期一 UTC+8上午10:59:06,Chou Yan写道: > > My server have 100G memory. > I limit my server 60G by cgroups. > But my app process use the momory more and more ! > even more than 50G. > my prof: > > # He

[go-nuts] Re: how to decrease the HeapIdle of Memory to free memory to Linux?

2019-06-23 Thread Chou Yan
I am use 'debug.FreeOsMemory'. But it is not the certain. 在 2019年6月24日星期一 UTC+8上午10:59:06,Chou Yan写道: > > My server have 100G memory. > I limit my server 60G by cgroups. > But my app process use the momory more and more ! > even more than 50G. > my prof:

[go-nuts] Re: how to decrease the HeapIdle of Memory to free memory to Linux?

2019-06-23 Thread Chou Yan
40585/0+297 ms cpu, 22495->22569->4643 MB, 23425 MB goal, 64 P 在 2019年6月24日星期一 UTC+8上午10:59:06,Chou Yan写道: > > My server have 100G memory. > I limit my server 60G by cgroups. > But my app process use the momory more and more ! > even more than 50G. > my prof: > >

[go-nuts] how to decrease the HeapIdle of Memory to free memory to Linux?

2019-06-23 Thread Chou Yan
My server have 100G memory. I limit my server 60G by cgroups. But my app process use the momory more and more ! even more than 50G. my prof: # HeapIdle = 27377164288 # HeapInuse = 21910396928 The Cgroup will kill the process when it use more than 60G But golang runtime gc will not release the

Re: [go-nuts] How many times gc stw ?

2019-06-21 Thread Chou Yan
thx 在 2019年6月21日星期五 UTC+8下午12:38:50,Ian Lance Taylor写道: > > On Thu, Jun 20, 2019 at 7:22 PM Chou Yan > wrote: > > > > The describe 'release the physical memory' may not be rigorous. Because > gc remand the span,obj, or big obj to heap or central area, may

Re: [go-nuts] How many times gc stw ?

2019-06-20 Thread Chou Yan
during sweep termination? 在 2019年6月21日星期五 UTC+8上午8:54:31,Ian Lance Taylor写道: > > On Thu, Jun 20, 2019 at 9:56 AM Chou Yan > wrote: > > > > I look up the doc for gctrace: > > https://godoc.org/runtime > > it show us: > > > > Currently, it is: >

Re: [go-nuts] How many times gc stw ?

2019-06-20 Thread Chou Yan
weep = scan the root span', like java cms 'gc root scan'? not the release the physical memory? 在 2019年6月21日星期五 UTC+8上午8:54:31,Ian Lance Taylor写道: > > On Thu, Jun 20, 2019 at 9:56 AM Chou Yan > wrote: > > > > I look up the doc for gctrace: > > https://god

[go-nuts] How many times gc stw ?

2019-06-20 Thread Chou Yan
I look up the doc for gctrace: https://godoc.org/runtime it show us: Currently, it is: gc # @#s #%: #+#+# ms clock, #+#/#/#+# ms cpu, #->#-># MB, # MB goal, # P where the fields are as follows: gc #the GC number, incremented at each GC @#s time in seconds s