Thanks Andrei for the clear answer... I might stick with the UDP then.<br><br>It seems clear that it would be better choice to use UDP for clients. I'm just wondering, since I've understood that TCP is sort of recommenend transport for SIP, but would this only be the case in the perfect world where no NATs exists and no persistent connections would be needed?
<br><br>- Teemu<br><br><div><span class="gmail_quote">2006/2/1, Andrei Pelinescu-Onciul &lt;<a href="mailto:andrei@iptel.org">andrei@iptel.org</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Feb 01, 2006 at 09:20, Teemu Harju &lt;<a href="mailto:teemu.harju@gmail.com">teemu.harju@gmail.com</a>&gt; wrote:<br>&gt; Hi,<br>&gt;<br>&gt; This is a question that has been bugging me for some time now. If I use SER
<br>&gt; and the clients connected to it use only TCP, will there be a problem with<br>&gt; the number of sockets that can be open at the same time, if these clients<br>&gt; are behind NAT? I mean that for NAT bindings to stay open, each client has
<br>&gt; to keep open TCP connection to SER all the time after registration. What is<br>&gt; the maximum number of open sockets that Linux can handle at the same time?<br><br>First of all if you can, use UDP. tcp is more resource demanding (CPU
<br>wasted looking for the Content-Length, CPU wasted snychronizing writes<br>to reuse the same connection, file descriptors and kernel tcp memory<br>wasted to keep all the connections) and more DOS-prone (it's much easier to
<br>use tcp to try to DOS your sip server).<br>If you have to use tcp, then if you use ser 0.9.x, it cannot handle more<br> then 1024 connections (in fact it's a little less then 1024).<br>&gt;<br>&gt; I've changed the maximum number of open files to 65535 (ulimit -n 65535).
<br>&gt; Doesn't this also mean the maximum number of sockets? Is this the absolute<br>&gt; maximum? Also, does this mean the maximum number of clients that can connect<br>&gt; to my proxy?<br><br>No, it's not that easy :-)
<br>You would need to use ser unstable (CVS HEAD), set<br>tcp_max_connections=65535, start ser with a lot of shared memory<br> and/or decrease TCP_BUF_SIZE to something smaller (e.g. 10k) and<br> recompile ser.<br>You should also watch for /proc/sys/fs/file-max (should be &gt;=65535).
<br>If you have lots of disconnects (clients closing connections) you might<br>also want to enable /proc/sys/net/ipv4/tcp_tw_recycle.<br><br>I was able to open 50K connections on the same machine (and if you have<br>lots of RAM you could go further).
<br><br><br>Andrei<br>P.S.: if you want to use unstable, then better wait a few weeks, I'm<br>currently working on the tcp code<br><br></blockquote></div><br><br clear="all"><br>-- <br>Teemu Harju<br><a href="http://www.teemuharju.net">
http://www.teemuharju.net</a>