[英]What is the cpu cores caused by GC in Golang 1.4.1
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%. 我最近遇到过这样一种情况:我们的Golang应用程序消耗了近30GB的内存,会定期吃掉所有24个CPU内核几乎100%。 This will last maybe for more than 3 seconds.
这将持续超过3秒。 Our Golang version is 1.4.1 on linux 64-bit.
我们的Golang版本在Linux 64位上是1.4.1。
I have googled for some info. 我已经google了一些信息。 Here is my assumption:
这是我的假设:
[]map[string]*list
and the instance of this type will contain more than 250K keys. []map[string]*list
,此类型的实例将包含超过250K的键。 GOMAXPROCS
parameter. GOMAXPROCS
参数有一些关系GOMAXPROCS
? 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
? []map[string][]whatever_you_are_storing
? sync.Pool
. sync.Pool
。 map[string]list
instead of map[string]*list
. map[string]list
而不是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. 那些是黑暗中的镜头。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.