Is your test request source running on the same computer? Have you disabled OS power management features?
Matt On Thursday, January 18, 2018 at 10:23:43 AM UTC-6, sotte...@gmail.com wrote: > > I developed an RPC Service with high requirements for real-time > performance. There was an unexpected delay at a small probability, and I do > not know how this happened. I suspect this is go schedule related, of > course, this may also be caused by a code bug. > > Anyone can solve this problem, it will be a great help to me! > > Following is my test process. trace.out in the attachment. > > > GO-Version:OS X go1.9.2 go1.10beta2 compile package > ::go1.10beta2.darwin-amd64.tar.gz > Net : localhost To localhost > QPS : 11K > > RT statistics > > *TestTime* > > *Test Count* > > *0-1ms* > > *1-2ms* > > *2-5ms* > > *5-10ms* > > *10-20ms* > > *20+ms* > > *2018-01-16* > > 58409 > > 99.97432% > > 0.022256844% > > 0.00342413% > > 0 > > 0 > > 0 > > 51707 > > 99.99226% > > 77358964% > > 0 > > 0 > > 0 > > 0 > > 54650 > > 99.93413 % > > > 0.027447393% > > 0.021957913% > > 0.0036596523% > > 0.0054894784% > > 0.0073193046% > > > By analyzing trace.out, in addition to the GC, I found two places that > lead to very long blocks > > - Net IO operator > - Channel operator > > > <https://lh3.googleusercontent.com/-f3CwZlmkYo8/WmBYqfozeeI/AAAAAAAAAAo/fTdh0qtEmNYSHJqLwU-RJvLFhJiOcdmRACLcBGAs/s1600/9135C3F2-C6DA-4199-A27D-0660497B553B.png> > > > <https://lh3.googleusercontent.com/-qoqFDYLVtZg/WmBYm8unb3I/AAAAAAAAAAk/-V_-ck6IqVgtuMOT6uKvC3mm_oilw1bgQCLcBGAs/s1600/9135C3F2-C6DA-4199-A27D-0660497B553B.png> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ReadLoop Code : > > for { head := c.dataBuf[0:WafBaseHeaderLen] _, err := > io.ReadFull(c.TcpConn, head) if err != nil { > log.Println("WafConn Err :", err.Error()) return nil, > err } dataLen, err := c.GetLength(head) > > //omit some exception handler _, err = > io.ReadFull(c.TcpConn, c.dataBuf[WafBaseHeaderLen: WafBaseHeaderLen+dataLen]) > if err != nil { log.Println("WafConn Err :", > err.Error()) return nil, err } > msg = &conncodec.WafMessage{ } err = > msg.Decode(c.dataBuf[:WafBaseHeaderLen + dataLen]) return msg, > err } > > > > channel init > > waf_resp := make(chan WafProxyResp, 1) > > waiting channel read event code: > > select { case result := <-waf_resp: *//do > something* case <-timer.C: //10 ms timeout > this.request_cache.DisposeRequest(request_id) > monitor.QPSStatAddWafRecvTimeout(1) return > GenWafResp(WAF_SUCCESS, "receive time out") } > > > Send Channel Code : > > select { case resp_chan <- resp: > //只使用一次,写入完成后关闭; close(resp_chan) > default: log.Print("Default fail !!!!! request id : ", > request_id) } > > > -- 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.