Skip to content

Instantly share code, notes, and snippets.

@alexpiezo
Last active November 23, 2017 13:42
Show Gist options
  • Save alexpiezo/2ca3e7b9cf77e23c827820d344421d22 to your computer and use it in GitHub Desktop.
Save alexpiezo/2ca3e7b9cf77e23c827820d344421d22 to your computer and use it in GitHub Desktop.
tsung setup on Ubuntu 16.04
yes | apt-get update
yes | apt-get install libtemplate-perl libhtml-template-perl erlang erlang-dev make autoconf
git clone https://github.com/processone/tsung.git
cd tsung
./configure && make && sudo make install
cd ..
echo "* soft nofile 1024000" >> /etc/security/limits.conf
echo "* hard nofile 1024000" >> /etc/security/limits.conf
sysctl -w fs.file-max=12000500
sysctl -w fs.nr_open=20000500
sysctl -w net.ipv4.tcp_mem='50576 64768 98152'
sysctl -w net.ipv4.tcp_rmem='1024 4096 16384'
sysctl -w net.ipv4.tcp_wmem='1024 4096 16384'
sysctl -w net.ipv4.ip_local_port_range="1024 64000"
sysctl -w net.core.rmem_max=16384
sysctl -w net.core.wmem_max=16384
sudo ufw disable
ulimit -n 10240
sudo sysctl -p
ssh-keygen -t rsa
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
ssh-keygen -f "/root/.ssh/known_hosts" -R t2
sed -i "8i139.59.221.163 t2" /etc/hosts
sed -i "8i139.59.221.162 t1" /etc/hosts
#wget https://gist.githubusercontent.com/AlexIzvekov/2ca3e7b9cf77e23c827820d344421d22/raw/9909a77a2a029eb68255f33948f9833ecf697448/ws.xml
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/user/share/tsung/tsung-1.0.dtd">
<tsung loglevel="debug" version="1.0">
<clients>
<client host="t1" use_controller_vm="false" maxusers="64000" cpu="12" />
<client host="t2" use_controller_vm="false" maxusers="64000" cpu="12" />
</clients>
<servers>
<server host="SERVER_HOST" port="SERVER_PORT" type="tcp" />
</servers>
<load>
<arrivalphase phase="1" duration="100" unit="second">
<users maxnumber="200000" arrivalrate="2000" unit="second" />
</arrivalphase>
</load>
<options>
<option name="ports_range" min="1025" max="65535"/>
</options>
<sessions>
<session name="websocket" probability="100" type="ts_websocket">
<request>
<websocket type="connect" path="/ws/"></websocket>
</request>
<request subst="true">
<websocket type="message" frame="text">{"tsung":"test-msg"}</websocket>
</request>
<for var="i" from="1" to="10" incr="1">
<thinktime value="10"/>
<request>
<websocket ack="no_ack" type="message" frame="text">{"event":"heartbeat"}</websocket>
</request>
</for>
</session>
</sessions>
</tsung>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment