Megaco simple Media Gateway bleeds memory under load.

Peter-Henry Mander <>
Tue Aug 27 16:05:49 CEST 2002


Hi everyone,

I hope you're not going to tire of my questions, as I have yet another one.

In megaco_messenger.erl the receive_message/4 function spawns a process 
for each received message. The problem I have with this scheme is that 
memory is being consumed by processes spawned in receive_message/4 and 
garbage-collected at a crippling rate, leading to a bottleneck in the 
Media Gateway.

The MG Controller and MG run on separate machines. The MGC is only 
consuming 50%-60% CPU and has a small stable memory footprint while 
issuing over 300 add-modify-subtract request cycles each second, whereas 
the MG is struggling at 99% and has a huge and ever expanding memory 
footprint.

I managed to streamline the MGC by reusing processes instead of spawning 
new ones. This has made it efficient enough to potentially achieve over 
500 call cycles a second, and I wonder if it were possible to use a 
similar scheme in receive_message/4 and use a pool of "process received 
message" processes instead of continually spawning new ones?

Are there any issues I must be aware of before I start "hacking" 
megaco_messenger.erl? Is there a better way than my (possibly naive) 
proposal?

Pete.






More information about the erlang-questions mailing list