Use of socket_info and local_contact columns in the active_watcher table

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Use of socket_info and local_contact columns in the active_watcher table

surya
I was wondering what is the use of socket_info and local_contact columns in the active_watcher table.

My concern is that if I have two opensips server using the shared db does these columns pose any problem. For example the initial subscribe is received on server 1 and the next one is received on server 2, will the second server able to send the NOTIFY or it fails.

I googled for answers  but could not find any. However, there are few similar questions here.

Any help will be appreciated.

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Use of socket_info and local_contact columns in the active_watcher table

Bogdan-Andrei Iancu-2
Hi,

When the second SUBSCRIBE is received, the watcher info in DB will be
updated accordingly  (or a new record will be added, depending if a
re-SUBSCRIBE).
So, server 2 will use this new info in order to generate the NOTIFY's

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 25.08.2015 05:20, surya wrote:

> I was wondering what is the use of socket_info and local_contact columns in
> the active_watcher table.
>
> My concern is that if I have two opensips server using the shared db does
> these columns pose any problem. For example the initial subscribe is
> received on server 1 and the next one is received on server 2, will the
> second server able to send the NOTIFY or it fails.
>
> I googled for answers  but could not find any. However, there are few
> similar questions here.
>
> Any help will be appreciated.
>
> Thanks.
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Use-of-socket-info-and-local-contact-columns-in-the-active-watcher-table-tp7598639.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Use of socket_info and local_contact columns in the active_watcher table

surya
Hi,

Thanks for the reply.

I was checking the code but I don't see update to socket_info and local_contact colums while there's a subscription within dialog. The flow I understood is:

Receive SUBS:
Check etag and set init_req
if init_req==0
 get_stored_info
 update_subscription
 update_subs_db

The update_subs_db method is not updating those two columns.

Those are being updated by update_db_subs method which is being called from timer_db_update method.

Sorry, If I missed something. I am using version 1.8.3

Thanks,
Surya
Reply | Threaded
Open this post in threaded view
|

Re: Use of socket_info and local_contact columns in the active_watcher table

Bogdan-Andrei Iancu-2
Hi Surya,

Actually none of the functions update_subs_db (used in fallback2db mode)
and update_db_subs (used by timer), when comes to updating, are not
pushing the socket and the local contact fields.

Those 2 columns are also not loaded by get_database_info() when
get_stored_info() (in fallback2db mode) is looking up for existing
subscriptions.

I guess the code assumes that those elements do preserve across the same
subscription.

In your case, subscriptions to same user may land on different presence
servers right ?

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 26.08.2015 17:23, surya wrote:

> Hi,
>
> Thanks for the reply.
>
> I was checking the code but I don't see update to socket_info and
> local_contact colums while there's a subscription within dialog. The flow I
> understood is:
>
> Receive SUBS:
> Check etag and set init_req
> if init_req==0
>   get_stored_info
>   update_subscription
>   update_subs_db
>
> The update_subs_db method is not updating those two columns.
>
> Those are being updated by update_db_subs method which is being called from
> timer_db_update method.
>
> Sorry, If I missed something. I am using version 1.8.3
>
> Thanks,
> Surya
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Use-of-socket-info-and-local-contact-columns-in-the-active-watcher-table-tp7598639p7598684.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Use of socket_info and local_contact columns in the active_watcher table

surya
Hi Bogdan,

Thanks for giving time to this.

Yes, we are planning to test it in HA mode. Keeping 2 opensips and a single DB. So, SUBSCRIBE can go to any of the two.

So, if it is never retrieved by any query while notifying then does it mean that it uses whatever it receives in the SUBSCRIBE request?

But, I see the problem when the server startups and it restores the db subscriptions in hash tables. In this case one of the server will have wrong socket_info.

BTW, I really do not understand the use of these two columns, because what I see in my table is socket_info and local_contact columns have values udp:192.168.254.134:5060 and sip:192.168.254.134:5060 respectively. And, obviously 192.168.254.134 is the server on which opensips is running. But, on some other question in the forum I found these two columns having different values of ip.

Thanks,
Surya
Reply | Threaded
Open this post in threaded view
|

Re: Use of socket_info and local_contact columns in the active_watcher table

Bogdan-Andrei Iancu-2
Hi Surya,

The 2 columns contains the SIP and the IP coordinates of OpenSIPS (as
end point in the subscription dialog) - the local_contact is the SIP
contact used by OpenSIPS in the dialog, while the local_socket is the IP
address used by OpenSIPS in the dialog.

Now, on the multi presence-servers - how do you disperse the SIP traffic
across these servers ?

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 28.08.2015 06:28, surya wrote:

> Hi Bogdan,
>
> Thanks for giving time to this.
>
> Yes, we are planning to test it in HA mode. Keeping 2 opensips and a single
> DB. So, SUBSCRIBE can go to any of the two.
>
> So, if it is never retrieved by any query while notifying then does it mean
> that it uses whatever it receives in the SUBSCRIBE request?
>
> But, I see the problem when the server startups and it restores the db
> subscriptions in hash tables. In this case one of the server will have wrong
> socket_info.
>
> BTW, I really do not understand the use of these two columns, because what I
> see in my table is socket_info and local_contact columns have values
> *udp:192.168.254.134:5060* and *sip:192.168.254.134:5060* respectively. And,
> obviously 192.168.254.134 is the server on which opensips is running. But,
> on some other question in the forum I found these two columns having
> different values of ip.
>
> Thanks,
> Surya
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Use-of-socket-info-and-local-contact-columns-in-the-active-watcher-table-tp7598639p7598727.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Use of socket_info and local_contact columns in the active_watcher table

surya
Hi Bogdan,

Thanks for the clarification on the columns but I doubt I understood correctly. Does local_contact goes into contact header and which header uses socket_info? My doubt is because I see same address in both columns. May be I can look more into the code. But still, as you mentioned these values are not retrieved from the tables so these ones are not used as in table. Does this mean values from the current server processing the requests are used, meaning it's IP.

We haven't yet done the deployment of multi presence but it will be a load balancer in front which will disperse the requests to another server on some threshold load on first server. Is there any guideline about how to use opensips in HA that can be helpful.


Thanks,
Surya


Reply | Threaded
Open this post in threaded view
|

Re: Use of socket_info and local_contact columns in the active_watcher table

surya
surya wrote
Hi Bogdan,

Thanks for the clarification on the columns but I doubt I understood correctly. Does local_contact goes into contact header and which header uses socket_info? My doubt is because I see same address in both columns. May be I can look more into the code. But still, as you mentioned these values are not retrieved from the tables so these ones are not used as in table. Does this mean values from the current server processing the requests are used, meaning it's IP.

We haven't yet done the deployment of multi presence but it will be a load balancer in front which will disperse the requests to another server on some threshold load on first server. Is there any guideline about how to use opensips in HA that can be helpful.


Thanks,
Surya
Regarding multi presenence... I was thinking about HTTP load balancing but frankly speaking I do not yet know about sip load balancing. I still need to look at that side but surely we are going to do that.
Can we use opensips load balancer for presence server?
Reply | Threaded
Open this post in threaded view
|

Re: Use of socket_info and local_contact columns in the active_watcher table

Bogdan-Andrei Iancu-2
Hi Surya,

Not sure if you can use a HTTP LB for SIP.

Nevertheless, OpenSIPS (being a multi-purpose SIP server) can act both
as a Presence Server/Agent and as a Load Balancer.

You can have a from OpenSIPS doing dispatching to a set of OpenSIPS
acting as Presence Servers. As you have full control over the LB logic,
you actually can do more than LB, you can actually do kind of clustering
of presence entities, so all traffic relevant to a presence entity (all
its PUBLISHs and all SUBSCRIBEs to it) will hit the same presence
server. So there will be no need to actually share anything between the
presence servers.

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 29.08.2015 03:18, surya wrote:

> surya wrote
>> Hi Bogdan,
>>
>> Thanks for the clarification on the columns but I doubt I understood
>> correctly. Does local_contact goes into contact header and which header
>> uses socket_info? My doubt is because I see same address in both columns.
>> May be I can look more into the code. But still, as you mentioned these
>> values are not retrieved from the tables so these ones are not used as in
>> table. Does this mean values from the current server processing the
>> requests are used, meaning it's IP.
>>
>> We haven't yet done the deployment of multi presence but it will be a load
>> balancer in front which will disperse the requests to another server on
>> some threshold load on first server. Is there any guideline about how to
>> use opensips in HA that can be helpful.
>>
>>
>> Thanks,
>> Surya
> Regarding multi presenence... I was thinking about HTTP load balancing but
> frankly speaking I do not yet know about sip load balancing. I still need to
> look at that side but surely we are going to do that.
> Can we use opensips load balancer for presence server?
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Use-of-socket-info-and-local-contact-columns-in-the-active-watcher-table-tp7598639p7598757.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Use of socket_info and local_contact columns in the active_watcher table

surya
Hi Bogdan,

When I said HTTP LB, I had altogether different project in mind. Anyways, I'll try to use the SIP load balancer. But, still I see the same problem because the opensips instances will be instantiated as per the load, which means 1 instance initially and >1 when load increases and again 1 as load decreases.

I'll get back to you once I start the LB setup.
For now I am stuck in something rather simple, performance testing using SIPp.

Thanks for you help.
Surya
Reply | Threaded
Open this post in threaded view
|

Re: Use of socket_info and local_contact columns in the active_watcher table

Bogdan-Andrei Iancu-2
Hi Surya,

You mean you want to spin out new opensips instances on demand, based on
the load of the existing opensips presence servers ?

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 03.09.2015 16:22, surya wrote:

> Hi Bogdan,
>
> When I said HTTP LB, I had altogether different project in mind. Anyways,
> I'll try to use the SIP load balancer. But, still I see the same problem
> because the opensips instances will be instantiated as per the load, which
> means 1 instance initially and >1 when load increases and again 1 as load
> decreases.
>
> I'll get back to you once I start the LB setup.
> For now I am stuck in something rather simple, performance testing using
> SIPp.
>
> Thanks for you help.
> Surya
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Use-of-socket-info-and-local-contact-columns-in-the-active-watcher-table-tp7598639p7598842.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Use of socket_info and local_contact columns in the active_watcher table

surya
Hi Bogdan,

Yes, this is what exactly we want; add remove instances on demand.

Regards,
Surya