I built a simple TCP server using Netty and I want to benchmark it with JMeter. I'm using a JMeter TCP Sampler, using the BinaryTCPClientImpl class name to send bytes. I have checked "no delay" and "reuse connection". I assume these are for SO_NODELAY and SO_REUSEADDR. I'm running 75 threads, each doing 1000 TCP requests. I consistently see about 11% of the requests fail with:
我使用Netty构建了一个简单的TCP服务器,我想用JMeter对它进行基准测试。我正在使用JMeter TCP采样器,使用BinaryTCPClientImpl类名来发送字节。我检查了“没有延迟”和“重用连接”。我假设这些是SO_NODELAY和SO_REUSEADDR。我正在运行75个线程,每个线程执行1000个TCP请求。我一直看到大约11%的请求失败了:
500 java.net.SocketException: Software caused connection abort: socket write error
500 java.net.SocketException:软件导致连接中止:套接字写入错误
If I uncheck "reuse connection" then all 75,000 requests succeed without a single error, but the throughput is only ~33% of what it was.
如果我取消选中“重用连接”,那么所有75,000个请求都会成功而没有一个错误,但吞吐量只有它的33%。
Is there something I need to do with my Netty server to prevent these errors?
我需要用Netty服务器来防止这些错误吗?
1 个解决方案
#1
0
I should note my server works like this: accepts connection, receives some data, sends some data, once the data is sent closes the connection. JMeter docs say TCP Sampler closes the connection unless "reuse socket" is checked, so I guess this is not SO_REUSEADDR. I assume in some cases the client sends data, receives data, and before the server closes the socket, the client tries to send data again, then the server closes the socket and JMeter thinks the request failed.
我应该注意我的服务器是这样的:接受连接,接收一些数据,发送一些数据,一旦发送数据关闭连接。 JMeter文档说TCP Sampler会关闭连接,除非选中“重用套接字”,所以我猜这不是SO_REUSEADDR。我假设在某些情况下客户端发送数据,接收数据,在服务器关闭套接字之前,客户端尝试再次发送数据,然后服务器关闭套接字,JMeter认为请求失败。
So, the solution is to not check "reuse address". Closing the socket each request is expected behavior, as my clients communicate relatively infrequently.
因此,解决方案是不检查“重用地址”。关闭套接字每个请求都是预期的行为,因为我的客户端相对不频繁地进行通信。
#1
0
I should note my server works like this: accepts connection, receives some data, sends some data, once the data is sent closes the connection. JMeter docs say TCP Sampler closes the connection unless "reuse socket" is checked, so I guess this is not SO_REUSEADDR. I assume in some cases the client sends data, receives data, and before the server closes the socket, the client tries to send data again, then the server closes the socket and JMeter thinks the request failed.
我应该注意我的服务器是这样的:接受连接,接收一些数据,发送一些数据,一旦发送数据关闭连接。 JMeter文档说TCP Sampler会关闭连接,除非选中“重用套接字”,所以我猜这不是SO_REUSEADDR。我假设在某些情况下客户端发送数据,接收数据,在服务器关闭套接字之前,客户端尝试再次发送数据,然后服务器关闭套接字,JMeter认为请求失败。
So, the solution is to not check "reuse address". Closing the socket each request is expected behavior, as my clients communicate relatively infrequently.
因此,解决方案是不检查“重用地址”。关闭套接字每个请求都是预期的行为,因为我的客户端相对不频繁地进行通信。