tidwall/evio

CPU consuming 100%

namkazt opened this issue · 5 comments

I'm not really sure why but after a few hours of running with minimum connection ( around 100 ). CPU usage starts growing up to 100%. here is profile.

(pprof) top5 -cum
Showing nodes accounting for 9.86hrs, 79.77% of 12.36hrs total
Dropped 348 nodes (cum <= 0.06hrs)
Showing top 5 nodes out of 23
      flat  flat%   sum%        cum   cum%
         0     0%     0%   12.02hrs 97.25%  github.com/tidwall/evio.loopRun
   0.17hrs  1.40%  1.40%   12.02hrs 97.25%  github.com/tidwall/evio/internal.(*Poll).Wait
   0.08hrs  0.61%  2.01%   11.30hrs 91.41%  syscall.EpollWait
   9.57hrs 77.45% 79.46%   11.22hrs 90.80%  syscall.Syscall6
   0.04hrs  0.31% 79.77%    0.88hrs  7.13%  runtime.entersyscall

Graph:
2020-01-03 10_19_50-Window

Do you have any ideas about why it happens?

prof file in case you need it.
cpu.zip

Note: if i add this Tick event. Server immediately raise up to 100% CPU usage
on aws EC2 small ubuntu 18

events.Tick = func() (delay time.Duration, action evio.Action) {
   delay = 100 * time.Microsecond
   action = evio.None
   return
}

if not add it then after some connection. it starts raising up.

Maybe the 100 microsecond delay is too much for that instance size. Do you need the system to tick 10k times per second?

If I'm not set this then in windows version some message is freeze when calling Connection.Wake(). I'm not really sure why but enable Tick event avoid that. But in Ubuntu even not set Tick event it still raise up to 100% use after sometime.

Note: oh i was set it wrong. it should be millisecond :D

I just pushed a fix. Thanks for your help.