IAX2 Performance

As a part of the latest Asterisk security release, the IAX2 channel driver in Asterisk got various changes to make it more difficult to abuse IAX2 in Asterisk in a traffic amplification attack. IAX2 uses call numbers to specify which packets are associated with which call. One of the changes that I made for the security issue was to have Asterisk randomly choose call numbers where it previously chose the lowest one that it could.

This change had an unfortunate side effect. It highlighted a part of chan_iax2 that was extremely inefficient. The higher the call number, the worse this piece of code performed. By choosing a very high call number, the performance of the server would plummet. On a small embedded platform, this may have meant that it couldn’t handle a single call. On my Intel Core 2 Duo machine @ 2.33 GHz, this meant that I couldn’t handle much more than about 16 IAX2 channels. That is terrible.

So, this got me motivated to fix up this code once and for all. I reworked some of the IAX2 code in Asterisk to index calls in a hash table in such a way that the lookup that previously had such terrible performance could be performed very quickly.

Testing my new code against chan_iax2 with my security fixes yielded a 3600% concurrent IAX2 channel increase! However, even when compared with the code before the security fixes, the IAX2 channel driver is still able to handle a lot more calls. On my machine, the most recent code can handle 55% more concurrent IAX2 channels than the code could handle before the security changes.

Asterisk 1.4.20 will contain these changes. Normally I would not put enhancements like this in the 1.4 release version of Asterisk. However, this was a special situation. So, enjoy!

There has been criticism of IAX2 performance in the past. However, during the 1.4 release series, I have put a lot of work into re-doing a lot of data structure management. Most of the changes were inspired by bugs that came up, but had nice performance impacts as a beneficial side effect.

At this point, I can not see any reason that the IAX2 channel driver in Asterisk would perform any worse than SIP. It would be interesting to do some more IAX2 versus SIP comparisons with the most recent code. In Asterisk trunk, a lot of work has gone into the data structures supporting both protocols. All critical data structures have been carefully converted to be indexed in hash tables using the astobj2 object model. Not only are lookups much faster with the hash tables, but the astobj2 object model has a lot of very nice locking features which provide even more performance improvements.

Anyway, thank you all for your continued support of Asterisk!

Asterisk 1.4.20-rc1 Now Available

The Asterisk development team has released Asterisk version 1.4.20-rc1.

This release is a release candidate for the upcoming official release of 1.4.20. It contains a large number of bug fixes over the previous release, 1.4.19. We would like to encourage the community to assist us in testing before we release 1.4.20.

The release candidate is available on the download site.


Please provide release candidate testing feedback to the asterisk-dev mailing list, or the issue tracker, http://bugs.digium.com/.

Thank you for your continued support of Asterisk!