[OpenSIPS-Users] Mediaproxy: media relay selection algorithm improvements

Dan Pascu dan at ag-projects.com
Tue Sep 14 18:43:04 CEST 2010


The original idea was to implement a pluggable system for the relay  
lookup algorithm. The existing media_relay avp that can be set from  
opensips' configuration is just something that was added to preserve  
backward compatibility and to provide a very simple means to override  
the selection logic if needed. It's by no means solution or something  
to build upon.

One of the selection algorithms I had in mind from the beginning is  
one that picks the relay based on the shortest distance to caller/ 
callee (as measured by the RTT). The re are algorithms that allow a  
number of machines to collection RTT information in realtime mapping  
the distance between them and then estimate with good accuracy the  
distance to another IP address which they have no knowledge about.  
This would allow the relay mesh to be adaptive and learn on the fly  
mapping the distances between them and the user devices using RTT and  
select the relay that is closest to the user devices.

However we never had time nor the need to implement this yet. Plus it  
needs some significant changes in the dispatcher-relay communication  
protocol, as some relays may get overloaded while others may be  
underloaded all based on the dynamic of the users that make the call  
and their location. Currently the relay has no mechanism to tell the  
dispatcher that is full and cannot take any more sessions. In order to  
avoid overloading some relays a mechanism for the relay to determine  
if it is loaded at maximum capacity and a mechanism to communicate to  
the dispatcher that it cannot take the call need to be implemented.  
Then the dispatcher can pick the next relay that is closest to the  
caller and try that, until it finds one that is not fully loaded.

One also needs to take into consideration that when the relays are  
really geographically distributed, then all the process of finding a  
suitable relay that is available can take time, during which opensips  
is blocked. IMO this cannot be properly done without the asynchronous  
design that is planned for opensips 2.0.

So in the end this is what I would like to see done. A pluggable  
mechanism where different algorithms can be selected from the  
configuration. One can be the algorithm that load balances calls over  
all available relays, that we currently have. Another can be the one I  
mentioned that uses RTT estimates to find the closest relay. And there  
can be others as well.

On 13 Sep 2010, at 16:10, John Khvatov wrote:

> Hello all!
>
> We are working on building geo-distributed VoIP solution with
> Mediaproxy.
>
> I think, that the current media relay selection algorithm is not  
> perfect
> and can be improved. In the current implementation we set IP address  
> of
> a particular media relay that will be preferred by dispatcher. But  
> what
> if the particular media relay will be unavailable? Media dispatcher  
> will
> run normal selection algorithm and does not select neighbor of the
> particular media relay.
>
> I propose to implement the groups of media relays. Each media-relay  
> can
> be registered on dispatcher with name and group. In the OpenSIPS  
> config
> we can specify preferred media relay/relays by name or group.
>
> Consider the example. Several our relays in Frankfurt registered on
> dispatchers with group=frankfurt, in Moscow -- with group=moscow. When
> we set “$avp(s:media_relay_group) to "moscow", dispatcher will
> select one of media_relay hosted in Moscow. Also, we can simply add/ 
> remove
> media_relays in run-time.
>
> What do you think about this idea? Is it difficult to implement?
>
> -- 
> WBR, John Khvatov
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users


--
Dan









More information about the Users mailing list