Tuning TIME_WAIT

来源:互联网 发布:linux mmap 匿名映射 编辑:程序博客网 时间:2024/06/03 08:01

Optimizing TCP/IP Networking for API Clients

All Essbase C-API based clients communicate with the Essbase server by means of a network layer. A request from a client C-API based application to Essbase involves opening a TCP/IP socket at the start of the request and closing it at the end of the request. A socket is a resource managed by the operating system, and there are a fixed number of such resources - the number of which is operating-system specific. When a socket is closed, it enters a dormant state, referred to as TIME_WAIT state, for a duration that is operating-system specific and configurable. At the end of that time period, the socket can be reaped by the operating system for reuse. Whether a call to open a socket succeeds or not is a function of how rapidly the operating system is able to reap the closed sockets for reuse.

Problems may occur in cases where an API client is designed to make and conclude so many connections, so rapidly, that the fixed number of available ports (about 64,000) is at or near exhaustion. Because the used ports are still resting in TIME_WAIT state, available ports cannot be harvested fast enough by the operating system, and the result is that connections are denied or the program runs sluggishly. If a deployment expects highly concurrent processing and these symptoms are occurring, we recommend decreasing the TIME_WAIT delay for the operating system. For example, a significant performance improvement can result from decreasing the delay from four minutes to 30 seconds.

This situation can be detected by running the command netstat on the command prompt. The output shows the number of sockets that are in TIME_WAIT state. The higher the number, the larger the probability that certain subsequent API requests will fail.

To get around this situation, consider reducing the TIME_WAIT value on your operating system.

On Windows, the TIME_WAIT value is found in the Windows registry.

On UNIX, system tools such as ndd (Solaris & HPUX), no (AIX), and echo (Linux) are used to manipulate kernel parameters.

To view and adjust the TIME_WAIT value on Solaris and HP-UX,

ndd -get /dev/tcp tcp_time_wait_interval     ndd -set /dev/tcp tcp_time_wait_interval 30000

On AIX, the following command gives a value for all parameters:

/usr/sbin/no -a 

Issue the following command on AIX to set TCP_TIMEWAIT state to 30 seconds (but do not adjust it if is already below 30):

/usr/sbin/no -o tcp_timewait =2/usr/sbin/no -o tcp_ephemeral_low = 32768/usr/sbin/no -o    tcp_ephemeral_high = 65535

On Linux, issue the following command to set the timeout_timewait parameter to 30 seconds:

echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout


转自:http://docs.oracle.com/cd/E10530_01/doc/epm.931/html_esb_api/tcpip.htm


0 0
原创粉丝点击