cpuguy83 / docker-log-driver-test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Log Driver memory usage and the sync.Pool message pool

nathanlcarlson opened this issue · comments

Builtin Docker loggers, such as the json-file logger used in this repo, call this function: https://github.com/moby/moby/blob/master/daemon/logger/logger.go#L40 for each .Log(msg) call. What are the memory and CPU implications of this? I've tried using both the msg allocation strategy in this repo as well as using logger.NewMessage for each log entry in consumeLog's loop, each result in a ballooning of CPU and Memory usage over time.

I'm not sure if it is sync.Pool causing this or if it is just the Go runtime using more and more resources until there is some amount of resource pressure. Or it could be something else entirely, any tips would be great by anyone who happens to see this. Thanks!

Oh, I just realized you, @cpuguy83 , are the one who committed all the messagePool code. In addition to the above questions is there a particular reason you don't use logger.NewMessage in this example driver? Thanks for making it by the way!

No reason, just built this quickly for running tests, not sustained usage.