windows上面修改最大使用端口數和time_await等待時間
注冊表需要添加兩個配置,位置:
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters
MaxUserPort :65534
TcpTimedWaitDelay:30
然而這么配置了之后,壓測一段時間任然會有connect use錯誤提示出現,懷疑是jmeter沒有重用keep alive,官方配置發現有三個配置參數比較可疑:
# 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=10000
# Check connections if the elapsed time (Milliseconds) since the last
# use of the connection exceed this value
httpclient4.validate_after_inactivity=0
# TTL (in Milliseconds) represents an absolute value.
# No matter what, the connection will not be re-used beyond its TTL.
httpclient4.time_to_live=0
這么調整了配置之后還是不靠譜,jmeter.properties,user.properties這兩個文件都修改過,任然有錯誤出現。
最好在官方發現這么一段話:
Use KeepAlive
JMeter sets the Connection:
keep-alive header. This does not work properly with the default HTTP implementation, as connection re-use is not under user-control. It does work with the Apache HttpComponents HttpClient implementations.
懷疑是jmeter使用的client的問題,把Http Request->Advanced里面的Client Implement選擇為Java之后,問題解決,1000並發跑了好久都沒有出錯㋡