我正在尝试使用Apache JMeter在文件上传方案中测试服务器的性能。具体来说,我正在使用HTTP测试脚本记录器来创建一个测试计划来实现这个curl命令:
$ curl -k -x localhost:8888 -XPOST -d @filename.json -H "Content-Type: application/json" "https://hostname:port"
在filename.json只有几十行之前,我已经成功使用了这个方法,但是现在当我想用大约72,000行(一个~5.1M文件)测试一个json时,我得到以下错误:< / p>
java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:431)
at sun.security.ssl.OutputRecord.write(OutputRecord.java:417)
at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:876)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:847)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
at org.apache.http.impl.io.AbstractSessionOutputBuffer.write(AbstractSessionOutputBuffer.java:181)
at org.apache.http.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:115)
at org.apache.http.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:122)
at org.apache.http.entity.StringEntity.writeTo(StringEntity.java:169)
at org.apache.http.entity.HttpEntityWrapper.writeTo(HttpEntityWrapper.java:96)
at org.apache.http.impl.client.EntityEnclosingRequestWrapper$EntityWrapper.writeTo(EntityEnclosingRequestWrapper.java:112)
at org.apache.http.impl.entity.EntitySerializer.serialize(EntitySerializer.java:117)
at org.apache.http.impl.AbstractHttpClientConnection.sendRequestEntity(AbstractHttpClientConnection.java:265)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.sendRequestEntity(ManagedClientConnectionImpl.java:216)
at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.sendRequestEntity(MeasuringConnectionManager.java:207)
at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:237)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:122)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:686)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:488)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:884)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:619)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:379)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:240)
事实上,我认为这个问题存在于JMeter某种程度上,因为原始的curl命令不涉及JMeter
curl -XPOST -d @filename.json -H "Content-Type: application/json" "https://hostname:port"
顺利上传文件。
有没有人遇到过这个问题?任何帮助将不胜感激。谢谢。
答案 0 :(得分:0)
首先检查您的文件是否在jmeter / bin文件夹中
然后检查您是否正在使用JMeter最佳实践?
并在您的测试计划和测试方法的问题中提供更多详细信息
答案 1 :(得分:0)
您是使用多个用户还是单个线程运行此测试?
检查分配给JMeter的内存,并尝试增加以防多个用户运行此内存。 确保正在挑选文件。理想情况下,要上载的文件应位于bin文件夹下。还要在上传文件时检查您要发送的标头。
同时检查是否有任何需要与文件一起传递的授权标识。 其中一个应该有助于解决您的问题。