Hi Andrew, Can you be more specific? We use GOMEMLIMIT to set the soft memory limit.
On Tuesday, December 5, 2023 at 4:30:49 AM UTC-8 Harris, Andrew wrote: > Might be worth looking into GOMEMLIMIT. > ------------------------------ > *From:* golan...@googlegroups.com <golan...@googlegroups.com> on behalf > of Zhihui Jiang <coboy...@gmail.com> > *Sent:* Monday, December 4, 2023 10:05:52 PM > *To:* golang-nuts <golan...@googlegroups.com> > *Subject:* [go-nuts] Low memory utilization when using soft memory limit > with GOGC=off > > 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...@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 > > <https://groups.google.com/d/msgid/golang-nuts/81d76570-9c09-4583-b900-fcfd19023f28n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/976f0bd7-161b-4dcd-9235-40e11d1a25c0n%40googlegroups.com.