To hibernate or not hibernate that is the question

So we are running an application where a node is actively maintaining several thousand websocket (cowboy) connections. Memory use is higher than I want so I’m thinking of putting connection handling processes that are not too busy into hibernation. Unfortunately the client sends a ping every 45 seconds which will awaken these processes.

My question is how expensive is the action of taking processes in and out of hibernation? Anyone have any experience on how latency is impacted? Getting data locally is a pain due to certain legal obligations.

Thanks

2 Likes

I had exactly this question a while ago, and I even opened an issue on Elixir’s issue tracker to help clarify the documentation. You might want to read it, for additional context.

My take on this is that, unless somehow garbage collection is very expensive for your processes, hibernating should work perfectly in a scenario where you expect a message 45 seconds after hibernation.

3 Likes

Thanks…I’ll give it a try