[erlang-questions] Is gen_server behavior in R14B hibernate friendly?

Ulf Wiger ulf.wiger@REDACTED
Sun Nov 7 16:03:44 CET 2010


Hi Zvi,

Actually, nowadays, gen_server supports 'hibernate' as a special
value of the internal timeout, so your server callbacks can instruct
the main loop to go into hibernation between messages.

It is true that hibernate/3 doesn't have a timeout, but OTOH, it is 
easy enough to start a timer that will send a message, bringing 
you out of hibernation, after a specified time.

BR,
Ulf W

On 6 Nov 2010, at 15:51, Zvi wrote:

> Hi,
> I re-reading Erlang at Facebook slides. And found this. Is this still
> an issue?
> 
> Zvi
> 
> "Hibernation
>> Drastically shrink memory usage with erlang:hibernate/3
> ▪ Throws away the call stack
> ▪ Minimizes the heap
> ▪ Enters a wait state for new messages
> ▪ “Jumps” into a passed-in function for a received message
> ▪ Perfect for a long-running, idling HTTP request handler
> ▪ But ... not compatible with gen_server:call (and gen_server:reply)
> ▪ gen_server:call has its own receive() loop
> ▪ hibernate() doesn’t support have an explicit timeout
> ▪ Fixed with a few hours and a look at gen.erl"
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
> 

Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com





More information about the erlang-questions mailing list