Monday, September 17, 2007

Out of resource - TCP ports

In A SOA solution we want to create a client that loads the server with many requests
we wrote too clients :
  • java client - runs on linux with AXIS toolkit
  • c# client - runs on windows using .net FCL and WSE 3.0

both clients crashed after a while with the error : "too many open files" of "out of resources"
the problem is the use of many TCP ports without release (that managed automatically by OS)
The OS allow you to use limited number of port concurrently and free the unused ports once in a while - if you want more ports in the interval it will fail

2 solutions

  • Set HTTP keep-alive both on client and server that means that you use the same port for each request (this can be problem if using built in load balancing feature)
  • Raise the port number limit

To raise the port number:

On Windows Registry: set the following
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"TCPTimedWaitDelay"=dword:0000001e
"MaxUserPort"=dword:0000fffe

On Linux:
open the file etc/security/limits.conf and set nofiles=N

for help and other learning materials
visit our site: Bina

No comments: