Asterisk performance for version 13+ is worse than 1.8.x

Hi Guys

I found that if I use asterisk 13 or higher, the performance is far more behind asterisk 1.8.x
I did test with a simple context on a cloud server(2 cores 4g memory)

exten => _X.,1,Answer()
same => n,MusicOnHold(default,60)
same => n,hangup

I generated 75 calls from another box, when using asterisk 1.8, system load is about 0.2, almost nothing, but when I changed to asterisk 13, 14 or 15 tried both chan sip or pjsip, system load went to 0.5 or higher, I’d like to know if you have similar experience? Is this normal?

Actually I did this test because my new system (asterisk 14 based) has bad performance compared my old system (asterisk 1.8 based), I want to figure out if it’s my script or asterisk itself.

Any suggestion how to debug what’s the bottleneck or is this normal?

I would say it was expected, although I wouldn’t know how to quantify it and would suggest a cloud server is not a reliable way of making quantitative performance tests.

The code considers more cases, in order to behave more correctly and also there has been an increase in the abstraction of some of the interfaces, e.g. channel data structure fields used to be accessed directly but now the pure C equivalent of object oriented attribute type access are used.

Also, there has been a move to reference count handling of memory, although I think a lot of hat was already in 1.8.

That is indeed correct. A major thing has been the move to using a message bus internally, which uses a snapshot mechanism - that snapshotting and moving stuff around incurs a penalty, but the benefits have been quite nice (ARI, statsd, better ability to hook into events, and other things). Ultimately though the specific scenario has to be examined to see what the impact truly is. Making things scale as far as possible hasn’t really been a goal of anyone explicitly, personally I focus on making things that people want to use or improving things that they use without realizing it to make their lives better.