Summary:ASTERISK-16646: iterate through all ao2_sip dialogs on every subscribe is slow, and not needed
Reporter:Stefan Schmidt (schmidts)Labels:
Date Opened:2010-09-03 07:10:26Date Closed:2010-10-01 04:42:25
Versions:Frequency of
Description:on my time compares i have seen that the while loop in handle_request_subscribe tooks even 2 ms on the first subscribe and this counts up to at least 20ms with more than 1000 subscribes.
I´ve talked with Olle johansson and Klaus Darillion about this problem and both said its not correct handling of a subscribe without a tag to search for old subscribes from this peer for the exten and context. This will cause old subscribes from the same peer to be present until the expires and also the notifys will be send to this old subscribe too.

on a heave loaded system (> 1000 sip dialogs) this will make subscribe handling even 20 times faster.


i´ve tried this patch with subscribing 2500 hints using a sipp scenario and without this patch the last subscribe will took about 40ms to be handled, which causes asterisk to lock and drop many sip packages. With my patch every subscribe takes around 400 usec so i was ablte to subscribe 2500 hints with 50 subs / second without loosing a single packet.

when my testsystem is under heavy sip load (20k peer registered with qualify=yes, 2500 subscriptioins and 375 concurrent calls) i got every notify in time.
Comments:By: Stefan Schmidt (schmidts) 2010-09-03 08:55:42

could be closed.

By: Leif Madsen (lmadsen) 2010-09-07 12:45:50

I'm not sure what you mean by "could be closed" -- are you saying this is not an issue?

By: Stefan Schmidt (schmidts) 2010-09-07 12:56:33

it is an issue, but after i have put the review request into the reviewboard i realise there might be no need to let this issue stay open.

By: Leif Madsen (lmadsen) 2010-09-07 13:09:38

Was the reviewboard issue closed? Typically we want to keep the mantis issue open until the reviewboard issue has a "ship it" or it is closed out as something that doesn't need to be fixed.

My instinct is that I need to keep this open :)

By: Stefan Schmidt (schmidts) 2010-09-07 13:17:50

ok so then it should stay open ;)

By: Digium Subversion (svnbot) 2010-10-01 04:42:24

Repository: asterisk
Revision: 289622

U   branches/1.4/channels/chan_sip.c
U   branches/1.6.2/channels/chan_sip.c
U   branches/1.8/channels/chan_sip.c

r289622 | schmitds | 2010-10-01 04:42:23 -0500 (Fri, 01 Oct 2010) | 11 lines

don't iterate through all dialogs to find and delete old subscribes

On every incoming subscribe there is a iteration through all dialogs to find old subscribes and delete them. This is slow and not RFC conform. This was only needed in 1.2 cause a subscribe was not deleted when a dialog was destroyed, after 1.4 a subscribe get removed when its dialog is destroyed.

(closes issue ASTERISK-16646)
Reported by: schmidts
Tested by: schmidts

Review: https://reviewboard.asterisk.org/r/901/