12

I'm fairly new to go and I've recently migrated a in-memory cache from node to go for concurrency improvements, but the memory usage difference between the two are huge. I've tried to read up on the map memory model in go but haven't been able to find a reason for the difference. I can't see that I'm doing anything special, so I'm looking for guidance here.

The documents that are stored are around 8 KB in size as a JSON file. In node the memory usage for 50000 documents stored as objects is 1,5 GB, and for go maps it is 10 GB.

To me, this doesn't seem reasonable but I can't find the source of the difference. Could anyone here give their take on this?

you are viewing a single comment's thread
view the rest of the comments
[-] bia@programming.dev 1 points 3 weeks ago

I'm looking at the memory reported by metrics-server in EKS, as that what I base the container resource scaling on. Maybe the go process is reporting memory in a way that doesn't represent the "actual" usage. But I'm not sure it matters here, unless I can get it to change the reported memory usage.

Please see the heap dump I added for 10000 devices. Reported memory is 1,1 GB.

this post was submitted on 15 Oct 2024
12 points (100.0% liked)

Golang

1 readers
1 users here now

This is a community dedicated to the go programming language.

Useful Links:

Rules:

founded 1 year ago
MODERATORS