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 请求默认值