Interview practice question
Go service with a large in-memory cache has latency spikes
Backend Engineering · Language Runtimes · Experienced
Your Go service keeps a 20 GB in-memory cache made of maps with pointer-heavy values, and GC causes high CPU and latency spikes. How do you improve it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- GC must scan all pointers.
- Reduce pointers: store values as []byte, structs without pointers.
- Off-heap style caches (bigcache, freecache).
- Tune GOGC/GOMEMLIMIT.
- Consider external cache.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.