Summary:ASTERISK-09540: With realtime users Chan_sip makes causeless load on database server
Reporter:Denes Dolhay (denke)Labels:
Date Opened:2007-05-29 12:57:43Date Closed:2007-07-11 19:59:24
Versions:Frequency of
If I use a sip 'peer' or 'friend' which registrates to asterisk
asterisk uses unneseseary munber of query-es to check if the client's
registration has expired, or not. ((in my system a few thousand query / sec) / client)
Bechause of the regseconds field is the unix time, and is stored in seconds, it would enough to check all the clients only once in a second.

****** STEPS TO REPRODUCE ******

map a sip friend / peer to realtime, and register with it to asterisk.


I see this message in the console a few thousand times / sec / client:

[May 29 19:42:52] DEBUG[4933]: res_config_mysql.c:650 mysql_reconnect: MySQL RealTime: Everything is fine.
[May 29 19:42:52] DEBUG[4933]: res_config_mysql.c:138 realtime_mysql: MySQL RealTime: Retrieve SQL: SELECT * FROM sip_realtime WHERE name = 'Denke'

If I fake the database, and set an expiration time far to the future, it dose not change anything.
If I fake the database, and set the expiration time in the past, the actual client was plugged from the network (without unregister), then asterisk inmediatley stops querying the database and says, that the client registration has been expired.
Comments:By: Olle Johansson (oej) 2007-05-29 14:10:34

I have never seen that. If you are right, that's a bad design. What are your settings for realtime in sip.conf? We should not bother to check regseconds unless there is a reason, like a call or a subscription or something else happening.

By: Denes Dolhay (denke) 2007-05-29 18:18:22

Hello Oej!
Thank you for the fast answer!
In the realtime section i only have one active option:

all other optinos in the realtime section are commented out, so the default values are used.

If you wish, I can upload the full sip.conf, the database, or whatever you need.

Bye: Denke.