How a Five-Minute Timer Caused a 5 GB Memory Problem in Next.js
Picture a Next.js server sitting at 5 GB of memory. It isn't crashing and it isn't spiking. It sits there, day after day. The garbage collector runs, and nothing comes back.
That's what Rohit Kashyap's team at Zepto saw, and his write-up is a great detective story. It's also long and heavy. Here's the same story in plain words: how they noticed it, how they measured it, what caused it, and how they fixed it.
The whole idea in one picture
Think of a cloakroom at a party. Every guest (a request) hands over a coat. When the guest leaves, the coat should go too.
Now picture someone pinning a 5-minute timer ticket to every coat, and a house rule: you can't clear a coat while its ticket is still ticking.Guests leave, but the coats pile up for five minutes each. With lots of guests, the rack is...
Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE