[erlang-questions] Process scheduling and punishment

David Mercer <>
Fri Jul 15 13:30:05 CEST 2011


On Friday, July 15, 2011, Knut Nesheim wrote:

Is it possibly related to the 

> We have a case where a gen_server gets "slow" after it has handled
> many messages, while what it does stays exactly the same. We suspect
> the scheduling of the process changes. I was hoping someone on the
> list could shed some light on why this happens and if there is any way
> to avoid it.
. . .
>  * Around 10 times per second, from the gen_server we send a message
> containing roughly 1000 words to a logging process.
. . .
>  * At no point do we see the logging process having messages in the
> queue. It is using the same amount of cpu in both states.
> 
> Is it the case that our gen_server is "punished" due to overloading
> the logging process? Is there any way to measure if the VM considers
> our logging process to be overloaded? Is there any general form of
> "punishment" for very busy processes that might cause starvation for
> our gen_server?
> 
> In our live system we have many of these gen_servers, but the request
> rate is much lower and they do very little logging(if at all).

I'm guessing this is related to the cost of sending being proportional to
the receiver's message queue.  (Ref. last bullet point on
http://www.erlang.org/documentation/doc-4.9.1/erts-4.9.1/notes.html.)  You
do say that you don't see messages accumulating in the logging process's
queue, but I still have the feeling it is related to this.

Cheers,

DBM




More information about the erlang-questions mailing list