Tsung分布式负载测试引发内部服务器错误

时间:2018-12-26 10:33:00

标签: load-testing tsung

我正在使用tsung为mqtt消息代理运行分布式负载测试。我已经为节点配置了shh键,并检查了shh在节点之间是否正确进行,并且使用单个客户端,测试是否成功运行,但是当我使用两个节点启动tsung.xml文件时,遇到了内部服务器错误。

我检查了两个节点中安装的erlang和tsung的版本和路径。它们甚至具有相同的版本和路径。

<clients>
    <client host="1.2.3.4" cpu="1" maxusers="300"/>
    <client host="2.3.4.6" cpu="1" maxusers="100"/>
</clients>
<servers>
    <server host="1.2.3.4" port="1883" type="tcp" />
</servers>

我在1.2.3.4:8091运行tsung进行报告时

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator unknown@unknown, and inform them of the time the error occurred and anything you might have done that may have caused the error.

tsung_controller@1.2.3.4.log说

ts_config_server:(0:<0.158.0>) Can't start newbeam on host '2.3.4.6' (reason: timeout) ! Aborting!

是这个问题的原因还是解决错误的方法?

1 个答案:

答案 0 :(得分:0)

您尚未编写所使用的操作系统。我假设您正在使用Linux。我轻松地重现了该错误(我刚刚从另一个节点的〜/ .ssh / authorized_keys文件中删除了ssh-key行)。

我描述了我的经验(Linux Debian):

  • 您需要在每个节点上正确安装Tsung 。我的意思是,您必须能够从主目录启动Tsung。
  • 节点之间必须有有效的 ssh-key连接(当然没有密码)。重要!当您以root用户使用Tsung时,您的节点将使用root用户连接到另一个节点。
  • 我的节点仅在注册的主机名
  • 下工作
  • Linux内核需要一些调整

我有一个 Tsung 1.6的Debian安装脚本

wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
yes | sudo apt-get update
yes | sudo apt-get install elixir esl-erlang build-essential git gnuplot libtemplate-perl
wget http://tsung.erlang-projects.org/dist/tsung-1.6.0.tar.gz
tar -xvf tsung-1.6.0.tar.gz
cd tsung-1.6.0/
./configure
make
sudo make install
cd ..

ssh密钥认证https://debian-administration.org/article/530/SSH_with_authentication_key_instead_of_password

将这些行复制到每个节点上的 / etc / hosts 文件的末尾。

1.2.3.4    n1
2.3.4.6    n2

您的配置应如下所示:

<clients>
    <client host="**n1**" cpu="1" maxusers="300"/>
    <client host="**n2**" cpu="1" maxusers="100"/>
</clients>
<servers>
    <server host="1.2.3.4" port="1883" type="tcp" />
</servers>

这就是我开始的方式:

tsung -k -f tsung.xml start

我在Linux上使用以下调整脚本:

# Increase system file descriptor limit
sudo sysctl -w fs.file-max=300000

# Discourage Linux from swapping idle processes to disk (default = 60)
# vm.swappiness = 10

# Increase Linux autotuning TCP buffer limits
# Set max to 16MB for 1GE and 32M (33554432) or 54M (56623104) for 10GE
# Don't set tcp_mem itself! Let the kernel scale it based on RAM.
sudo sysctl -w net.core.rmem_max=16777216
sudo sysctl -w net.core.wmem_max=16777216
sudo sysctl -w net.core.rmem_default=16777216
sudo sysctl -w net.core.wmem_default=16777216
sudo sysctl -w net.core.optmem_max=40960
sudo sysctl -w net.ipv4.tcp_rmem='4096 87380 16777216'
sudo sysctl -w net.ipv4.tcp_wmem='4096 65536 16777216'

# Make room for more TIME_WAIT sockets due to more clients,
# and allow them to be reused if we run out of sockets
# Also increase the max packet backlog
sudo sysctl net.core.netdev_max_backlog=50000
sudo sysctl net.ipv4.tcp_max_syn_backlog=30000
sudo sysctl net.ipv4.tcp_max_tw_buckets=2000000
sudo sysctl net.ipv4.tcp_tw_reuse=1
sudo sysctl net.ipv4.tcp_fin_timeout=10

# Disable TCP slow start on idle connections
sudo sysctl net.ipv4.tcp_slow_start_after_idle=0

# Disable source routing and redirects
sudo sysctl net.ipv4.conf.all.send_redirects=0
sudo sysctl net.ipv4.conf.all.accept_redirects=0
sudo sysctl net.ipv4.conf.all.accept_source_route=0

# Log packets with impossible addresses for security
sudo sysctl net.ipv4.conf.all.log_martians=1