This page is an occasionally updated collection of my personal bookmarks. September 2022 Quest for a lost Event banteg.mirror.xyz September 17th
This page is an occasionally updated collection of my personal bookmarks. September 2022 Quest for a lost Event banteg.mirror.xyz September 17th
An experiment with Golang and Rust FFI
GopherCon Israel 2024! What a fun day. Started by seeing lots of familiar faces! Miki Tebeka, Yarden Laifenfeld, Liri Sokol, Guy Brandwine, Itamar Knafo, Ran Bar-Zik and more. It’s a lot of fun knowing people and saying hi to everyone, and meeting new people, too. I arrived there and met some people from Orca Security (where I work right now). These are my raw notes from the event, not too much editing, mostly for my peeps from Orca’s Golang Guild. 🐋
"Why is our service slow?" "I don't know, the heap is only 200MB". "But we're allocating... wait, how much?" "12 terabytes". "...in how long?" "30 seconds …...
The work title for the v0.123.0 release has been "the million pages release", introducing a new memory limit that allows for a streaming build, shifting large objects out of memory when not in use....
This visual guide shows how slices work under the hood in Go, covers slice creation, manipulation using make and append, how capacity grows, and slicing syntax for creating new slices from existing ones.
Inspired by a seemingly unexplainable out of memory error in a service, I set out to understand how Go’s non-moving memory management works under the hood. This led to some interesting learnings about memory fragmentation, the types of workloads that are prone to this issue, and potential mitigations.
A couple of days ago when I was reading the guide to the Go garbage collector, I came across the following excerpt: When all else fails, the Go GC provides a few different specific traces that provide much deeper insights into GC behavior. These traces are always printed directly to STDERR, one line per GC cycle, and are configured through the GODEBUG environment variable that all Go programs recognize. An environment variable that all Go programs recognize, you say? I had a sneaking suspicion that I could just perform a string search for this term, given all Go programs would need to look for this environment variable definition. This way, we could guess if a binary was written in Go.
TLDR: Go doesn’t auto-detect container memory limits. Without GOMEMLIMIT, the GC lets the heap double freely until the OOM killer strikes. Read the cgroup limit at startup and set GOMEMLIMIT to ~85% of it via an entrypoint script so it adapts automatically when VPA adjusts your limits. I was investigating a pod that had been crashlooping for 25 hours. The usual suspects — liveness probe failures, connection resets, CrashLoopBackOff. After deleting the pod and watching it come back healthy on a different node, I assumed it was a flaky spot instance. But looking closer, it was OOMing.
Using less memory to look up IP addresses in Mess With DNS