Jmeter和Postman的响应时间差异



当我在邮递员中为 1000 条记录运行相同的 API 时,我正在尝试测试 API Get 方法,响应时间为 4 秒(在 Windows 7 中安装了邮递员并运行测试(,而在 JMeter 中需要 22 秒,知道这可能是什么原因吗?

JMeter 运行所遵循的步骤:

  1. 图形用户界面模式
  2. 非图形用户界面模式

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

邮递员结果:

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

您需要比较类似的请求。在您的情况下,至少缺少 1 个标头。添加到 JMeter 的 HTTP 标头Accept-Encoding gzip,deflate

遵循JMeter的最佳实践以获得最佳性能,主要是不使用侦听器:

使用非 GUI 模式:jmeter -n -t test.jmx -l test.jtl

使用尽可能少的侦听器;如果使用上述 -l 标志,则可以删除或禁用它们。

最新更新