【问题标题】:Tsung distributed load testing throwing internal server errorTsung 分布式负载测试引发内部服务器错误
【发布时间】:2018-12-26 10:32:59
【问题描述】:

我正在使用 tsung 为 mqtt 消息代理运行分布式负载测试。我已经使用 shh 键配置了节点,并检查了节点之间的 shh 是否正确发生,并且使用单个客户端测试运行成功,但是当我启动具有 2 个节点的 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:&lt;0.158.0&gt;) Can't start newbeam on host '2.3.4.6' (reason: timeout) ! Aborting!

他们是否有此问题的任何原因或如何解决错误的解决方案?

【问题讨论】:

  • 您应该编辑问题以包含错误消息,以便我们了解它是如何失败的
  • 我编辑了这个问题。看看你是否能解决这个问题。

标签: load-testing tsung


【解决方案1】:

您还没有编写您正在使用的操作系统。我假设您使用的是 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 上使用这个 tweak 脚本:

# 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

【讨论】:

    猜你喜欢
    • 2017-05-04
    • 2012-04-07
    • 2022-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多