Increased performance of the Apache Mina connection

Source: Internet
Author: User

In using Mina, I used the XP system to test how many long connections Mina actually supports. But the odd thing is to support up to 415 at a time.

This is completely inconsistent with the performance of Mina on the web. After research, it should be the reason for the operating system. Two registry connections can be modified to more than 4,000.

Here's how to modify it:

increase the number of Windows maximum TCP connection random ports

System default TCP Random port range is: 1024-5000

Two Windows registry keys that are closely related to this error: Values for TcpTimedWaitDelay and MaxUserPort.
TcpTimedWaitDelay determines the time that TCP/IP must elapse before it can release a closed connection and reuse its resources. This interval between shutdown and release is generally known as the time_wait state or twice times the maximum segment life cycle (2MSL) state. During this time, the cost of reopening the connection to the client and server is less than establishing a new connection. Reducing this value allows TCP/IP to release closed connections more quickly and to provide additional resources for new connections.

MaxUserPort determines the maximum number of ports to be used when requesting any available user ports from the system, and the highest port number that TCP/IP can specify. If you establish a TCP connection with a maximum port connection greater than 5000, the local computer responds to the following error message Wsaenobufs (10055): Because the system lacks enough buffers or because the queue is full and cannot perform operations on the socket, the application's 10048 errors are caused.

Open Registry Editor regedit

TcpTimedWaitDelay settings:
Locate the Hkey_local_machine\system\currentcontrolset\ Services\Tcpip\Parameters registry subkey
and create a new REG_DWORD value named TcpTimedWaitDelay
Set this value to decimal 30, hexadecimal to 0x0000001e
The wait time for this value will be 30 seconds.
Default value for this entry: 0xF0 (16), wait time set to 240 seconds

MaxUserPort settings (Increase maximum port connection):
Locate the Hkey_local_machine\system\currentcontrolset\ Services\Tcpip\Parameters registry subkey
and create a new REG_DWORD value named MaxUserPort
Set this value to decimal minimum 32768
The wait time for this value will be 30 seconds.
Reboot the Windows system.
Default value for this entry: 5000 (decimal)

Close the Registry Editor and restart the Windows system.




The

is essentially an operating system that restricts the number of TCP connections, and Mina's connections are the underlying TCP protocol traffic. Share it and learn from everyone.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.