jmeter pressure test problem

jmeter pressure test problem

————

————

java.net.BindException: Address already in use: connect

reason:

The operating system will reserve a temporary port for the TCP/IP service. When running a concurrent test, Jmeter will occupy a temporary port every time it starts a thread (new socket operation). If the TCP/IP port is fully occupied and not released in time ( The socket.close() operation cannot release the bound port immediately. Instead, it sets the port to the TIME_WAIT state, which will be released after a period of time (the default is 240s). Java.net.BindException: Address already in use: connect this situation

Solution (operate on the server where jmeter is located):

From the analysis of the cause of the problem, there are two solutions. One is to increase the number of temporary ports reserved for TCP/IP services, and the other is to speed up the release of occupied ports.

Increase the number of ports reserved for TCP/IP services.

1.1 If the running platform of Jmeter is Windows.

In Microsoft Windows XP or Windows Server 2003, the maximum value of the temporary TCP or UDP port number assigned to an application by Windows Sockets is controlled by the registry setting MaxUserPort, which has a default value of 5000. Ephemeral ports are numbered starting from port number 1025. Therefore, by default, Windows XP or Windows Server 2003 assigns an application that performs wildcard binding a number ranging from 1025 to 5000.

To change the maximum value of ephemeral ports on a computer running Windows XP or Windows Server 2003:

1. In cmd, use the regedit command to open the registry

2、在 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

3. Right-click Parameters

4. Add new DWORD named MaxUserPort and TcpTimedWaitDelay

5. Enter the numerical data as 65534 and 30 respectively, and select decimal as the base; to increase the number of assignable tcp connection ports and reduce the survival time of connections in the TIME_WAIT state

6. After modifying the configuration, remember to restart the machine for it to take effect.

TcpTimedWaitDelay : Determines the time that must elapse before TCP/IP can release a closed connection and reuse its resources. This time interval between closing and releasing is commonly known as the TIME_WAIT state or the twice maximum segment lifetime (2MSL) state. During this time, reopening connections to clients and servers costs less than establishing new connections. Reducing the value of this entry allows TCP/IP to release closed connections more quickly, making more resources available for new connections. Adjust this parameter if you are running an application that needs to release and create new connections quickly and is experiencing low throughput due to many connections in TIME_WAIT.

1.2 Increase the maximum number of connection threads of your web server to 1024 or 2048. Taking resin as an example, modify thread-pool.thread_max in resin.conf. If you adopt the architecture of apache connecting to resin, don’t forget to adjust it again. apache;

https://blog.csdn.net/gzh0222/article/details/6911676

java.net.NoRouteToHostException: The requested address cannot be specified

linux

Solution:

  1. Reduce the waiting time after port release, the default is 60s, change it to 15~30s

​ echo 15 > /proc/sys/net/ipv4/tcp_fin_timeout

  1. Modify the tcp/ip protocol configuration, by configuring /proc/sys/net/ipv4/tcp_tw_resue, the default is 0, change it to 1, and release the TIME_WAIT port for new connections.

​ echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse

  1. Modify the tcp/ip protocol configuration to quickly recycle socket resources. The default is 0, and it is modified to 1.

​ echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle

Enter sysctl -p to take effect

Linux TCP connection number modification: https://www.cnblogs.com/clicli/p/5856486.html, https://www.cnblogs.com/cwp-bg/p/8377742.html

Check the port occupancy netstat -natp | grep 9000 | grep ESTABLISHED | wc -l

optimization

net.ipv4.ip_local_port_range=1024 65535
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_max_syn_backlog = 40000
net.core.somaxconn = 40000
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_keepalive_time = 1200

java.net.SocketException: Socket closed

https://www.cnblogs.com/yiyaxuan/p/12673496.html

If Use KeepAlive is checked in Basic of HTTP Request Sampler, it is recommended to do the following under the Advanced tab:

1. Implementation is selected as HttpClient4

2. Connect in Timeouts is generally set to a value of 10 to 60 seconds, indicating the idle timeout of the connection to avoid disconnection due to the Keep-Alive header not receiving the response from the end under stress test.

The unit of this value is milliseconds: 15s*1000=15000s

img

After setting up through the above method, this error will still occur when the pressure is tested again.

img

java.net.SocketException: Connection reset

In user.properties file add the next 2 lines:

httpclient4.retrycount=1
hc.parameters.file=hc.parameters
In hc.parameters file add the following line:

http.connection.stalecheck$Boolean=true
Both files live in JMeter’s bin folder.

linux run

jmeter -n -t ./testcase/rsa.jmx -l ./testcase/rsa.jtl

Dynamic modification

(jmeter.bat -help | jmeter.sh -help can see the help), use the __P() function to obtain the attribute value specified in the command.

jmeter -JthreadCount=2 -JRanpup=1 -Jcycle=2 -Jtime=40 -Durl=www.baidu.com -Dport=80 -n -t baidu.jmx -l baidu.jtl

illustrate:

threadCount=2 is the number of threads to be specified in the baidu.jmx test plan

-Jcycle=2 is the number of iterations for each thread to be specified in the baidu,jmx test plan

-JRanpup=1 is the thread startup time to be specified in the baidu,jmx test plan

Use ${__P(threadCount,)} in the baidu.jmx test plan to get the value of threadCount

${__P(cycle,)} to get the value of cycle

${__P(time,)} gets the duration

${__property(url,)} Get server ip

img img

login returns without cookies

decorator.go(71) invoke err: rpc error: code = Unknown desc = delete session failed

rsa came back without the public key

Locate sync.map

http://c.biancheng.net/view/34.html

Test sync.map

Threads Cycles total sample size Response times
200 200 40000 40000
200 300 60000 60000
200 400 80000 63008
400 400 16000 79949
500 400 20000 101823
1000 400 400000 182616
1200 400 480000 240249

Guess you like

Origin blog.csdn.net/flowerqt/article/details/128954089