During the last week i spent quite some time testing several Asterisk versions in terms of memory usage. My test scenario involves an Asterisk server which receives SIP calls from a call generator (based on sofia-sip) and runs a very simple dialplan:
exten => _+.,1,Wait(15)
exten => _+.,n,Ringing
exten => _+.,n,Wait(10)
exten => _+.,n,Hangup
The call generator will terminate the call right after receiving the Ringing. It is configured to use 1000 SIP channels and has a caps limit of 100. With this dialplan however a caps value of about 66 can be reached. All tests were done “signalling only” without any RTP being transmitted.
This test generates about 1 to 2 MBit/s of IP traffic. Here are the results:
Asterisk starts dropping calls and fails to respond on numerous INVITEs after processing about 3.5M calls. SIP registrations time out.
Right after the start it is using 204m of memory! That is almost 20x as much as 1.4 or 1.6 used!
After around 300k calls Asterisk segfaulted and left a 1.2 GB core file, because it could not allocate memory:
#2 0×0000000000523131 in __ast_str_helper (buf=0x7faca3d93948, max_len=8192, append=<value optimized out>, fmt=0×552938 “Memory Allocation Failure in function %s at line %d of %s\n”, ap=0x7faca3d93900) at strings.c:72
Executive summary (memory consumption):
Asterisk 1.4 –> BAD
Asterisk 1.6 –> GOOD
Asterisk 1.8 –> WORST