[SR-Users] TCP stack is not doing load distribution among children for SIP
Daniel-Constantin Mierla
miconda at gmail.com
Tue Mar 7 23:18:32 CET 2017
Hello,
On 07/03/2017 08:50, Surendra Pullaiah wrote:
> Dear Daniel,
>
>
> A small concern in kamailio, existing TCP stack is not doing load distribution among children for SIP messages. For example UE-->kamailio1 (TCP listen (4 children)) ----->kamailio2 (TCP Listen 4 children)
>
> As per stack if UE opens a connection with kamailio1 based on free children it is sharing the FD, so no problem towards from UE to kamailio1, then need requirement to forward same sip message to kamailio2, here kamailio1 is opening connection with kamailio2 and then forwarding. Suppose if we forward two requests to kamailio2, only one children is getting used among four. With this design suppose if we want to run our kamailio as two sip servers we may not achieve good results when performance matters.
>
>
> Please suggest something on this to move further.
>
as I haven't implemented myself the tcp client/server in kamailio, it
may require source code checking to safety prove my next statements ...
So, I expect kamailio wil reuse the connection between kamailio1 and
kamailio2. The tcp manager process selects the least loaded tcp worker
when a new connection is accepted, and the worker start consuming the
packets on it until there is nothing to be read on it. The reason behind
this approach is that a proxy is typically sending back a 100 trying or
some other provisional response while handling the request. If the
connection is very busy, so there are always packets to read, then
practically the selected tcp workers keeps processing the traffic and
never release the tcp connection back to the tcp manager.
If kamailio1 and kamailio2 are very close to each other, so tcp connect
is very fast, you can try setting the option to close the connection as
soon as the request is forwarded, via set_forward_close(), then each
request will be on a different connection.
An alternative would be to listen on 4 ports in kamailio2 and do round
robin forwarding to each of these ports.
Of course, it is open source, there is the option of patching the c code
add an option to release back the tcp connection to the tcp manager as
soon as reading the sip request.
Cheers,
Daniel
--
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Mar 6-8 (Europe) and Mar 20-22 (USA) - www.asipto.com
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com
More information about the sr-users
mailing list