I have recently come across a situation where one of our Golang app, consuming almost 30GB memory, will periodically eating all 24 cpu cores with nearly almost 100%. This will last maybe for more than 3 seconds. Our Golang version is 1.4.1 on linux 64-bit.
I have googled for some info. Here is my assumption:
[]map[string]*list
and the instance of this type will contain more than 250K keys. GOMAXPROCS
parameter. You've really gotta profile to figure a problem like this out.
That said you might be able to reduce the load you put on the garbage collector. Here are a couple of suggestions:
[]map[string][]whatever_you_are_storing
? sync.Pool
. map[string]list
instead of map[string]*list
. It will change the behavior of your program, but for a small struct it may make sense anyway. Those are shots in the dark.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.