编程语言
首页 > 编程语言> > java – 使用jmeter的Apache多个请求

java – 使用jmeter的Apache多个请求

作者:互联网

我正在使用Jmeter来测试对我的Web应用程序的多个请求.
我在Jmeter中使用NumberOfThread为50.

我的流程如下:

>登录页面.
>使用用户标识和密码登录.
>显示菜单页面.
>单击搜索页面.
>转到搜索页面.
>单击搜索按钮.
>单击搜索结果链接转到更新页面.
>更新数据并单击“更新”按钮.
>显示更新的结果页面.
>返回搜索页面.
>退出按钮单击.

在上面的过程中,我使用循环控制器进行5到10的进程,循环为5.
在那种情况下,如果我使用超过25个线程来运行Jmeter测试,地址已经在使用中,则发生套接字绑定异常.

我想知道如何解决这个问题.

解决方法:

看起来您的客户端用尽了短暂的端口,或者您的客户端环境存在一些问题.
你在使用Windows吗?

你至少可以做到以下几点:

> Windows:查看this article作为Windows系统的解决方案作为jmeter的主机.
>使用Linux系统代替主机来运行Jmeter负载方案.

你可能会发现this article对你的测试活动很有用(我在标签中看过Jboss).

更新:

linked article above开始:

When an HTTP request is made, an ephemeral port is allocated for the
TCP / IP connection. The ephemeral port range is 32678 – 61000. After
the client closes the connection, the connection is placed in the
TIME-WAIT state for 60 seconds.

If JMeter (HttpClient) is sending thousands of HTTP requests per
second and creating new TCP / IP connections, the system will run out
of available ephemeral ports for allocation.

. . .

Otherwise, the following messages may appear in the JMeter JTL files:

Non HTTP response code: java.net.BindException
Non HTTP response message: Address already in use

The solution is to enable fast recycling TIME_WAIT sockets.

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

Other options include TCP_FIN_TIMEOUT to reduce how long a connection
is placed in the TIME_WAIT state and TCP_TW_REUSE to allow the system
to reuse connections placed in the TIME_WAIT state.

在服务器端:

>这样可以快速回收TIME_WAIT套接字

/ sbin / sysctl -w net.ipv4.tcp_tw_recycle = 1
>这允许在TIME_WAIT状态下重新使用套接字用于新连接 – 这是tcp_tw_recycle的更安全的替代方案

/ sbin / sysctl -w net.ipv4.tcp_tw_reuse = 1

tcp_tw_reuse设置在打开许多短连接并处于TIME_WAIT状态的环境(如Web服务器)时特别有用.重用套接字可以非常有效地减少服务器负载.
>系统同时保留的最大时间等待套接字数

/ sbin / sysctl -w net.ipv4.tcp_max_tw_buckets = 30000

或者以相同的方式但以另一种方式 – 将以下行添加到/etc/sysctl.conf文件中,以便更改能够在重新启动后继续存在:

net.ipv4.tcp_max_tw_buckets = 30000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1

同样在服务器端查看ulimit -n的结果.
对于最大打开文件的限制,默认值为1024,这可以解释1000个连接处的BindExceptions的外观.

同样,您可以使用例如,在测试运行期间监视服务器和jmeter之间的连接数.

netstat -an | grep SERVER_PORT | wc -l

定义连接限制 – 如果有的话.

标签:apache,java,jmeter,jboss5-x
来源: https://codeday.me/bug/20190712/1444134.html