【发布时间】:2017-12-27 06:39:35
【问题描述】:
我一直致力于在 jmeter 上执行每秒 500 个用户的负载测试。我正在使用 JMeter。在运行负载测试时,我不断收到登录 API 错误。 以下是我发送和接收超时的请求和响应。
样品申请
POST https://example.com//9000/v1/api/user/login
POST data:
{
"email":"xyz@yopmail.com",
"password":"abcdef"
}
[no cookies]
Request Headers:
Connection: keep-alive
Content-Type: application/json
:
Content-Length: 79
Host: botstest.smartbothub.com
User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_151)
示例响应
Thread Name: Thread Group 1-310
Sample Start: 2017-12-27 11:30:06 IST
Load time: 61422
Connect Time: 1148
Latency: 61422
Size in bytes: 363
Sent bytes:286
Headers size in bytes: 171
Body size in bytes: 192
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 504
Response message: Gateway Time-out
Response headers:
HTTP/1.1 504 Gateway Time-out
Server: nginx/1.10.3 (Ubuntu)
Date: Wed, 27 Dec 2017 06:01:07 GMT
Content-Type: text/html
Content-Length: 192
Connection: keep-alive
HTTPSampleResult fields:
ContentType: text/html
DataEncoding: null
服务器的 nginx 配置文件如下所示。 https://drive.google.com/file/d/1_XWYeqSAWZz6dtnTTCeLOEMzDwvEWwY1/view
【问题讨论】:
-
A 504 可能表示 nginx(或上游应用)负载过高,无法正常响应。
-
那么如何解决这个问题,我需要更改我的 nginx 配置吗?
-
配置?可能没有太多可做的。您可以查看tuning guide。但我的猜测是,您正在运行的物理服务器可能已经超载。检查服务器的 CPU 使用率。
-
你需要在 ngynx 中增加超过 60 秒的超时时间