[Kamailio-Users] no free tcp receiver
Klaus Darilion
klaus.mailinglists at pernau.at
Tue Dec 2 11:54:18 CET 2008
Gawith schrieb:
> Hi all,
>
> My OpenSER system seems to run out of TCP handlers all the time. It
> looks to me that I need two child processes for each local IP and peer
> combination, because to and back communication do not use the same TCP
> channel.
Using different TCP connection for sending/receiving is not elegant, but
possible. Nevertheless responses should always be sent via the same TCP
connection as the request.
> I have a lot of TCP clients which would lead to more than 100 child
> processes.
To handle 1000 TCP connection you do not need 1000 processes. In
Kamailio there is one process which handles all the incoming TCP
messages. As soon as the "TCP receiver" has received enough TCP
fragments to build the whole SIP message, the SIP message is handled
over to one of the "TCP worker" processes. You can identify the
processes using "kamctl ps", e.g.:
# kamctl ps
Process:: ID=0 PID=9280 Type=attendant
Process:: ID=1 PID=9281 Type=SIP receiver udp:3.13.32.14:5060
Process:: ID=2 PID=9282 Type=SIP receiver udp:3.13.32.14:5060
Process:: ID=3 PID=9283 Type=SIP receiver udp:3.13.32.14:5060
Process:: ID=4 PID=9284 Type=SIP receiver udp:3.13.32.14:5060
Process:: ID=5 PID=9285 Type=SIP receiver udp:3.13.32.15:5060
Process:: ID=6 PID=9286 Type=SIP receiver udp:3.13.32.15:5060
Process:: ID=7 PID=9287 Type=SIP receiver udp:3.13.32.15:5060
Process:: ID=8 PID=9288 Type=SIP receiver udp:3.13.32.15:5060
Process:: ID=9 PID=9289 Type=timer
Process:: ID=10 PID=9290 Type=MI FIFO
Process:: ID=11 PID=9291 Type=TCP receiver
Process:: ID=12 PID=9292 Type=TCP receiver
Process:: ID=13 PID=9293 Type=TCP receiver
Process:: ID=14 PID=9294 Type=TCP receiver
Process:: ID=15 PID=9295 Type=TCP main
If a TCP message will be sent, a worker process will lookup for a
existing TCP connection, "put" the TCP connection, send the SIP message
on this TCP connection, and then give the TCP connection back to the "pool".
> Does it make sense to reduce tcp_connection_lifetime?
No. Especially not if TCP is used between clients and the server. Then
the proxy should set the lifetime of the TCP connection to the lifetime
of the registration.
http://www.kamailio.org/docs/modules/devel/registrar.html#id2452958
> This would
> increase TCP overhead, but would allow me to have fewer child processes,
> right?
No. As said above - with 1 TCP children you can handle lots of TCP
connections.
> Any help is welcome. Thanks guys!
btw: do you have any problems at all?
regards
klaus
More information about the Users
mailing list