Java.net.SocketException .net 应用程序中的连接重置错误
Java.net.SocketException connection reset error in .net application
我们有一个 n 层 (.net) Web 应用程序,其中我们有一个 Web 层 -> App 层 -> 数据库。
一切正常,直到我们进行负载测试(使用 jmeter)。 当我们模拟 100 个并发用户时,3 -4 分钟后。 jmeter 开始记录 SocketException,连接重置 。当我们检查应用程序日志(我们记录应用程序内部的所有异常)和系统事件时,我们找不到任何东西。
我们没有对 Web 层的性能采取任何特殊措施。但是在作为 wcf 应用程序的 App 层上,我们使用了 per-call/multiple 并发。我们在应用层使用了以下配置:
<serviceThrottling
maxConcurrentCalls = "200"
maxConcurrentSessions = "200"
maxConcurrentInstances = "200"/>
。
.
.
<binding name="defaultNetTcpBinding" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00" openTimeout="00:10:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647"
maxConnections="200" listenBacklog="200">
除了这个问题,我们的应用层使用率也偏高 (50-60%)。以下是我们 3 个虚拟机的配置(每层一个)
Web 服务器(数量 = 1) 处理器 Intel Xeon CPU X5675 @3.07 GHz 2.19 GHz
Number of Cores (Virtual) 8
RAM 8GB
Operating System Windows Sever 2012 Standard
Processor Type 64 Bit
Softwares Installed NET Framework 4.5
应用程序服务器(数量 = 1)
处理器 Intel Xeon CPU X5675 @3.07 GHz 3.07 GHz
Number of Cores (Virtual) 8
RAM 8GB
Operating System Windows Sever 2012 Standard
Processor Type 64 Bit
Softwares Installed NET Framework 4.5
数据库服务器(数量=1)
处理器 Intel Xeon CPU E7-4830v2 @ 2.20 GHz 2.19 GHz
Number of Cores (Virtual) 8
RAM 8GB
Operating System Windows Sever 2012 Standard
Processor Type 64 Bit
Softwares Installed Microsoft SQL Sever 2014
您的服务器很可能由于负载测试而过载。
因此它开始拒绝显示为连接重置错误的连接。
所以 3 个选项:
根据实际流量,您的负载配置文件过于激进
您的负载配置文件正常,您的服务器配置不正确或容量不足
您的应用程序无法处理此负载
您可以通过放慢速度来检查这一点,看看您何时开始遇到问题。
如果您绝对确定您的服务器没有问题并且问题出在 JMeter 端,您可以尝试按照 Connection Reset since JMeter 2.10 ? wiki 页面中的步骤操作,即:
- 更改所有 HTTP Request samplers to
HTTPClient4
. The best way to do it is via HTTP Request Defaults 的实现。
将接下来的两行添加到 user.properties 文件(位于 JMeter 安装的 /bin 文件夹下):
httpclient4.retrycount=1
hc.parameters.file=hc.parameters
在 hc.parameters 文件中(相同位置 - JMeter 安装的 /bin 文件夹)添加下一行:
http.connection.stalecheck$Boolean=true
重新启动 JMeter 实例,以便它可以读取更新的属性并重新启动您的测试。
IIS 日志有助于挖掘根本原因。我们发现所有遇到Socket问题的请求都存在网络连接异常
如果我正在执行分布式测试,我是否也应该在我的所有从属系统上执行以下步骤,而不是得到 "connection reset" 错误..?
将接下来的两行添加到 user.properties 文件(位于 的 /bin 文件夹下JMeter 安装):
httpclient4.retrycount=1
hc.parameters.file=hc.parameters
在 hc.parameters 文件中(相同位置 - JMeter 安装的 /bin 文件夹)添加下一行:
http.connection.stalecheck$Boolean=true
我们有一个 n 层 (.net) Web 应用程序,其中我们有一个 Web 层 -> App 层 -> 数据库。
一切正常,直到我们进行负载测试(使用 jmeter)。 当我们模拟 100 个并发用户时,3 -4 分钟后。 jmeter 开始记录 SocketException,连接重置 。当我们检查应用程序日志(我们记录应用程序内部的所有异常)和系统事件时,我们找不到任何东西。
我们没有对 Web 层的性能采取任何特殊措施。但是在作为 wcf 应用程序的 App 层上,我们使用了 per-call/multiple 并发。我们在应用层使用了以下配置:
<serviceThrottling
maxConcurrentCalls = "200"
maxConcurrentSessions = "200"
maxConcurrentInstances = "200"/>
。 . .
<binding name="defaultNetTcpBinding" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00" openTimeout="00:10:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647"
maxConnections="200" listenBacklog="200">
除了这个问题,我们的应用层使用率也偏高 (50-60%)。以下是我们 3 个虚拟机的配置(每层一个)
Web 服务器(数量 = 1) 处理器 Intel Xeon CPU X5675 @3.07 GHz 2.19 GHz
Number of Cores (Virtual) 8
RAM 8GB
Operating System Windows Sever 2012 Standard
Processor Type 64 Bit
Softwares Installed NET Framework 4.5
应用程序服务器(数量 = 1) 处理器 Intel Xeon CPU X5675 @3.07 GHz 3.07 GHz
Number of Cores (Virtual) 8
RAM 8GB
Operating System Windows Sever 2012 Standard
Processor Type 64 Bit
Softwares Installed NET Framework 4.5
数据库服务器(数量=1) 处理器 Intel Xeon CPU E7-4830v2 @ 2.20 GHz 2.19 GHz
Number of Cores (Virtual) 8
RAM 8GB
Operating System Windows Sever 2012 Standard
Processor Type 64 Bit
Softwares Installed Microsoft SQL Sever 2014
您的服务器很可能由于负载测试而过载。
因此它开始拒绝显示为连接重置错误的连接。
所以 3 个选项:
根据实际流量,您的负载配置文件过于激进
您的负载配置文件正常,您的服务器配置不正确或容量不足
您的应用程序无法处理此负载
您可以通过放慢速度来检查这一点,看看您何时开始遇到问题。
如果您绝对确定您的服务器没有问题并且问题出在 JMeter 端,您可以尝试按照 Connection Reset since JMeter 2.10 ? wiki 页面中的步骤操作,即:
- 更改所有 HTTP Request samplers to
HTTPClient4
. The best way to do it is via HTTP Request Defaults 的实现。 将接下来的两行添加到 user.properties 文件(位于 JMeter 安装的 /bin 文件夹下):
httpclient4.retrycount=1 hc.parameters.file=hc.parameters
在 hc.parameters 文件中(相同位置 - JMeter 安装的 /bin 文件夹)添加下一行:
http.connection.stalecheck$Boolean=true
重新启动 JMeter 实例,以便它可以读取更新的属性并重新启动您的测试。
IIS 日志有助于挖掘根本原因。我们发现所有遇到Socket问题的请求都存在网络连接异常
如果我正在执行分布式测试,我是否也应该在我的所有从属系统上执行以下步骤,而不是得到 "connection reset" 错误..?
将接下来的两行添加到 user.properties 文件(位于 的 /bin 文件夹下JMeter 安装):
httpclient4.retrycount=1
hc.parameters.file=hc.parameters
在 hc.parameters 文件中(相同位置 - JMeter 安装的 /bin 文件夹)添加下一行:
http.connection.stalecheck$Boolean=true