With the Azul VM (and I believe the G1 collector in Java), the VM is definitely 
aware of memory pressure as it approaches the maximum limit - then it will 
increase the concurrent GC activity trying to avoid a potential huge pause if 
the limit was reached - so throughput is lowered.

I would think the Go GC needs to do this as well in order to limit pause times.

> On Sep 12, 2018, at 8:46 AM, Ian Lance Taylor <i...@golang.org> wrote:
> 
> On Tue, Sep 11, 2018 at 11:48 PM, Leigh McCulloch <leigh...@gmail.com> wrote:
>> 
>> Does anyone here know how Go interacts with memory limits inside containers? 
>> (e.g. Kubernetes, Docker)
>> 
>> Does the Go runtime have similar problems as the Java runtime, in that it 
>> doesn't know what the container limit is, and only knows what the physical 
>> limit is for the entire instance?
>> 
>> Or is Go aware of limits placed on the container?
>> 
>> (I've witnessed the Go runtime package say the NumCPU is the total physical 
>> count when the app has been limited to many less CPUs, so it seems like it 
>> doesn't have visibility into the CPU limitations.)
> 
> As far as I know, the current implementations of Go don't pay
> attention to memory limits at all, whether running inside a container
> or not.  You may be interested in following
> https://golang.org/issue/23044 which could be a first step toward
> fixing this.  In some sense the core issue is that using memory limits
> in a garbage collected language is close to useless if the program
> doesn't have a way to react when heap size is nearing the memory
> limit.
> 
> On the other hand, on GNU/Linux systems, the CPU count is determined
> by calling the sched_getaffinity system call, which as far as I know
> is aware of container limits.  What leads you to believe otherwise?
> 
> Ian
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to