如何提高tcp连接性能?

时间:2013-11-13 20:09:38

标签: java performance spring spring-integration

我有以下代码:

<int-ip:tcp-connection-factory id="client"
    type="client" host="${netSocketServer}" port="${netPort}"
    single-use="true" so-timeout="${netSoTimeOut}" />

<int:channel id="input" />

<int-ip:tcp-outbound-gateway id="outGateway"
    request-channel="input" reply-channel="reply" connection-factory="client"
    request-timeout="${netRequestTimeout}" reply-timeout="${netReplyTimeout}" />


<int:channel id="reply" datatype="java.lang.String" /> 

我必须加快与其他服务器的连接速度。 我可以对该代码进行改进吗?

我记录以下连接时间,以便让我想到缓慢的连接。

Waiting time was: 5985
Waiting time was: 6015
Waiting time was: 1578, 
Waiting time was: 5610, 
Waiting time was: 5735, 
Waiting time was: 1734, 
Waiting time was: 1797, 
Waiting time was: 1515, 
Waiting time was: 1469, 
Waiting time was: 6003, 
Waiting time was: 6656

提前致谢。

1 个答案:

答案 0 :(得分:2)

您尚未提供单位。

如果它们是毫秒,则会出现与Spring-Integration配置无关的严重网络问题。

如果它们是微秒,那看起来很正常,没有错。