代码之家  ›  专栏  ›  技术社区  ›  Candy

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

  •  0
  • Candy  · 技术社区  · 7 年前

    tsung.xml 包含2个节点的文件我遇到内部服务器错误。

    我已经检查了两个节点中安装的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 回复  |  直到 7 年前
        1
  •  0
  •   z5ottu    7 年前

    您还没有编写正在使用的操作系统。我猜你在用Linux。我很容易复制了这个bug(我刚刚从另一个节点的~/.ssh/authorized_key s文件中删除了ssh密钥行)。

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

    • 你需要 正确安装Tsung 在每个节点上。我是说,你必须能从你的主目录启动Tsung。
    • 一定有工作 ssh密钥连接 在节点之间(当然没有密码)。重要!将Tsung与根用户一起使用时,节点将使用根用户连接到另一个节点。
    • 主机名
    • 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

    将这些行复制到 每个节点上的文件。

    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