当我在邮递员中为1000条记录运行相同的API时,我尝试测试API Get方法,响应时间为4秒(在Windows 7中安装postman并运行测试),而在JMeter中它正在服用22秒,任何想法可能是什么原因?
JMeter运行的步骤:
Postman和JMeter都在同一系统/网络中。
以下是Jmeter结果:
Thread Name: Test/TestAPI 1-1
Sample Start: 2018-05-22 17:15:00 IST
Load time: **21406** // this is the issue , same in postman taking only 4712 ms
Connect Time: 425
Latency: 1990
Size in bytes: 3962439
Sent bytes:1130
Headers size in bytes: 175
Body size in bytes: 3962264
Sample Count: 1
Error Count: 0
Data type ("text"|"bin"|""): text
Response code: 200
Response message: OK
Response headers:HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
api-supported-versions: 1
Date: Tue, 22 May 2018 11:45:06 GMT
Content-Length: 3958179
Server: Web Server
HTTPSampleResult fields:
ContentType: application/json; charset=utf-8
DataEncoding: utf-8
Post Man结果:
api-supported-versions →1
content-encoding →gzip
content-type →application/json; charset=utf-8
date →Tue, 22 May 2018 12:00:11 GMT
server →Web Server
transfer-encoding →chunked
vary →Accept-Encoding
答案 0 :(得分:2)
您需要比较类似的请求。在您的情况下,至少缺少1个标题。添加到JMeter的HTTP标头Accept-Encoding gzip,deflate
按照JMeter的Best Practices获得最佳性能,主要的不是使用听众:
使用非GUI模式:jmeter -n -t test.jmx -l test.jtl
使用尽可能少的听众;如果使用上面的-l标志,则可以删除或禁用它们。