I tried to create a simple program in different languages ββ(C #, Java, C ++, PHP) to connect to the server, and they all behave the same way. Therefore, I believe that this problem is more related to the OS level.
Basically, I want the program to connect to the server using a TCP socket and send 1 byte, and then close the socket. This must be done thousands of times per second and maintained over a period of time. This is for server benchmarking.
So far, after several thousand client sockets, the system has completely stopped. It can only start creating sockets in a minute or so. I made sure that I closed every socket after the transfer.
Now this problem is familiar with servers such as Apache, where utilities (like ab / siege) recommend testing Apache using the keep-alive protocol. Ie, create a small number of TCP connections, but make a few requests with them for testing purposes. However, this is not possible in our case, since our own server does not support HTTP and does not support the HTTP 1.1 support model.
So how can this be achieved? I checked the following limitations
ulimit installed a very large numberTCP TIME_WAIT fixed by setting /proc/sys/net/ipv4/tcp_rw_recycle and /proc/sys/net/ipv4/tcp_rw_reuse to 1. (I really confirmed that netstat no TIME_WAIT sockets)- This is not due to restrictions on the number of threads / processes. I tried to restart my client application, and this is the same. When the OS refuses new sockets, nothing will help.
PS. This is NOT a server side restriction. We tested this by buying another box and running the same client code when the first client box refused to create new sockets. The server did a great job with this. We do not want to buy 5-10 boxes and rotate between them to overcome this problem.
OS: Fedora 10 Linux 2.6.24-23-xen # 1 SMP
linux networking sockets tcp
erotsppa
source share