Hi there, 

We are running a large scale recommendation system using Golang and we are 
working on some GC related improvement recently. One of the changes we are 
trying to apply is to use soft memory limit with GOGC=off as suggested 
here: https://github.com/golang/go/issues/48409.

But during our testing, the memory usage never reaches the memory limit we 
set. For example, we have 100GB memory available and we set the memory 
limit to 90GB, but the actual memory usage is very low like <50GB. We also 
observed the GC is actually very frequent which cost a lot of CPU time.

We had another tweak to set GOGC to a high value like 200, and the memory 
usage is quite close to the memory limit.

I have two questions here:

   1. Is it expected behavior that the memory usage is much lower than 
   memory limit when GOGC is set to off? From the official doc 
   (https://github.com/golang/go/issues/48409), it claims " by setting 
   GOGC=off, the Go runtime will always grow the heap to the full memory 
   limit"?
   2. How is the GC frequency decided when using soft memory limit + 
   GOGC=off? Is there some internal defalut value for GOGC in this case to 
   decide when to GC?


Thanks!

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/81d76570-9c09-4583-b900-fcfd19023f28n%40googlegroups.com.

Reply via email to