![JMeter - HTTP 请求的默认连接和响应超时是多少](https://linux22.com/image/1602088/JMeter%20-%20HTTP%20%E8%AF%B7%E6%B1%82%E7%9A%84%E9%BB%98%E8%AE%A4%E8%BF%9E%E6%8E%A5%E5%92%8C%E5%93%8D%E5%BA%94%E8%B6%85%E6%97%B6%E6%98%AF%E5%A4%9A%E5%B0%91.png)
Jmeter 中 HTTP 请求的默认连接和响应超时是多少?
我没有更改jmeter.properties
文件中的任何设置。
# set the socket timeout (or use the parameter http.socket.timeout)
# for AJP Sampler implementation.
# Value is in milliseconds
#httpclient.timeout=0
# 0 == no timeout
# Idle connection timeout (Milliseconds) to apply if the server does not send
# Keep-Alive headers (default 0)
# Set this > 0 to compensate for servers that don't send a Keep-Alive header
# If <= 0, idle timeout will only apply if the server sends a Keep-Alive header
#httpclient4.idletimeout=0
# Polling to see if process has finished its work, used when a timeout is configured on sampler
#os_sampler.poll_for_timeout=100
答案1
展望JMeter 5.1 源代码:
public int getConnectTimeout() {
return getPropertyAsInt(CONNECT_TIMEOUT, 0);
}
public void setResponseTimeout(String value) {
setProperty(RESPONSE_TIMEOUT, value, "");
}
public int getResponseTimeout() {
return getPropertyAsInt(RESPONSE_TIMEOUT, 0);
}
默认值为,0
表示“无超时”,因此 JMeter 将永远等待连接/响应。因此,为了安全起见,我建议使用以下方法定义合理的超时:HTTP 请求默认值