├── .gitignore ├── README ├── amazonlinux.md ├── distributed.xml ├── ec2_ips.sh ├── single.xml ├── tsung.odp ├── ubuntu.txt └── websocket.xml /.gitignore: -------------------------------------------------------------------------------- 1 | 201* 2 | .* 3 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | http://www.slideshare.net/ngocdaothanh/tsung-13985127 2 | -------------------------------------------------------------------------------- /amazonlinux.md: -------------------------------------------------------------------------------- 1 | #Setup tsung for AmazonLinux 2 | 3 | This is a note for setup erlang-R16B03-1 and Tsung-1.5.0 on AmazonLinux. 4 | 5 | Reference -> http://www.slideshare.net/ngocdaothanh/tsung-13985127 (Tsung 1.4.2) 6 | 7 | ## Instance setting 8 | 9 | * Type: m1.large 10 | * SecurityGroup: Arrow TCP 0-65535 11 | 12 | --------- 13 | ## For OS setup 14 | 15 | Install gcc 16 | `sudo yum install gcc` 17 | 18 | Edit `/etc/security/limits.conf` 19 | `sudo vim /etc/security/limits.conf` 20 | 21 | * soft nofile 1024000 22 | * hard nofile 1024000 23 | 24 | Logout once and check 25 | `logout` 26 | `ulimit -n` 27 | 28 | Edit `/etc/sysctl.conf` 29 | 30 | `sudo vim /etc/sysctl.conf` 31 | 32 | # General gigabit tuning 33 | net.core.rmem_max = 16777216 34 | net.core.wmem_max = 16777216 35 | net.ipv4.tcp_rmem = 4096 87380 16777216 36 | net.ipv4.tcp_wmem = 4096 65536 16777216 37 | 38 | # This gives the kernel more memory for TCP 39 | # which you need with many (100k+) open socket connections 40 | net.ipv4.tcp_mem = 50576 64768 98152 41 | 42 | # Backlog 43 | net.core.netdev_max_backlog = 2048 44 | net.core.somaxconn = 1024 45 | net.ipv4.tcp_max_syn_backlog = 2048 46 | net.ipv4.tcp_syncookies = 1 47 | 48 | `sudo sysctl -p` 49 | 50 | --------- 51 | ## Install Erlang 52 | 53 | `mkdir ~/opt` 54 | 55 | `sudo yum install ncurses-devel` 56 | 57 | `sudo yum install openssl-devel` 58 | 59 | `wget http://www.erlang.org/download/otp_src_R16B03-1.tar.gz` 60 | 61 | `tar xzf otp_src_R16B03-1.tar.gz` 62 | 63 | `cd otp_src_R16B03-1` 64 | 65 | `./configure --prefix=$HOME/opt/erlang-R16B03-1` 66 | 67 | `make install` 68 | 69 | `sudo echo 'pathmunge /home/ec2-user/opt/erlang-R16B03-1/bin' > /etc/profile.d/erlang.sh` 70 | 71 | `sudo chmod +x /etc/profile.d/erlang.sh` 72 | 73 | --------- 74 | ## Install Tsung 75 | 76 | `wget http://tsung.erlang-projects.org/dist/tsung-1.5.0.tar.gz` 77 | 78 | `tar xzf tsung-1.5.0.tar.gz` 79 | 80 | `cd tsung-1.5.0` 81 | 82 | `./configure --prefix=$HOME/opt/tsung-1.5.0` 83 | 84 | `make install` 85 | 86 | 87 | ### Install from latest source 88 | 89 | `sudo yum install git` 90 | 91 | `sudo yum install autoconf` 92 | 93 | `git clone https://github.com/processone/tsung.git tsung-latest` 94 | 95 | `cd tsung-latest/` 96 | 97 | `./configure --prefix=$HOME/opt/tsung-latest` 98 | 99 | `make install` 100 | 101 | 102 | ### For Reporting 103 | 104 | `sudo yum install numpy` 105 | 106 | `sudo yum install scipy` 107 | 108 | `sudo yum install python-matplotlib` 109 | 110 | `sudo yum install gnuplot` 111 | 112 | `sudo yum install perl-CPAN` 113 | 114 | `sudo cpan Template` 115 | 116 | --- 117 | ### For ssh login 118 | 119 | From local PC 120 | `scp -i XXXX.key XXXX.key ec2-user@host:/home/user/ec2-user/.ssh/` 121 | 122 | From ec2 instance 123 | `mv ~/.ssh/XXXXX.key ~/.ssh/id.rsa` 124 | `ssh localhost erl` 125 | `exit` 126 | 127 | --------- 128 | ## Start Tsung test 129 | 130 | `~/opt/tsung-1.5.0/bin/tsung -f t1.xml start` 131 | 132 | `~/opt/tsung-1.5.0/bin/tsung -f status` 133 | 134 | ### Reporting 135 | 136 | Create html report 137 | `~/opt/tsung-1.5.0/lib/tsung/bin/tsung_stats.pl` 138 | 139 | Create only png files 140 | `~/opt/tsung-1.5.0/bin/tsplot "first" tsung.log -d ~/outputdir` 141 | 142 | Start simple http server 143 | `python -m SimpleHTTPServer` 144 | 145 | --------- 146 | ## For distributed test 147 | 148 | Create AMI and use it to launch new instances. 149 | 150 | Enable distributed clients 151 | 152 | http://tsung.erlang-projects.org/user_manual/faq.html#can-t-start-distributed-clients-timeout-error 153 | 154 | Disable firewall 155 | `sudo chkconfig iptables off` 156 | `sudo /etc/init.d/iptables stop` 157 | 158 | Edit `/etc/hosts` 159 | `sudo vim /etc/hosts` 160 | 161 | 127.0.0.1 localhost localhost.localdomain 162 | tsung1 163 | tsung2 164 | tsung3 165 | 166 | Confirm ssh 167 | 168 | `ssh tsung1 erl` 169 | `exit` 170 | `ssh tsung2 erl` 171 | `exit` 172 | `ssh tsung3 erl` 173 | `exit` 174 | `ssh localhost erl` 175 | `exit` 176 | 177 | Confirm distributed clients 178 | 179 | erl -rsh ssh -sname foo -setcookie mycookie 180 | Eshell V5.4.3 (abort with ^G) 181 | (foo@tsung1)1>slave:start(tsung2,bar,"-setcookie mycookie"). 182 | {ok,bar@tsung2} -------------------------------------------------------------------------------- /distributed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 44 | 45 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /ec2_ips.sh: -------------------------------------------------------------------------------- 1 | # http://about.silkapp.com/page/Multiple%20IP%20addresses%20on%20Amazon%20EC2 2 | MAC_ADDR=$(ifconfig eth0 | sed -n 's/.*HWaddr \([a-f0-9:]*\).*/\1/p') 3 | IP=($(curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/$MAC_ADDR/local-ipv4s)) 4 | for ip in ${IP[@]:1}; do 5 | echo "Adding IP: $ip" 6 | sudo ip addr add dev eth0 $ip/24 7 | done 8 | 9 | ip addr show 10 | -------------------------------------------------------------------------------- /single.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 38 | 39 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /tsung.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ngocdaothanh/tsart/414ce75356ad12fc8dd395861be274b542d0f954/tsung.odp -------------------------------------------------------------------------------- /ubuntu.txt: -------------------------------------------------------------------------------- 1 | sudo apt-get update 2 | sudo apt-get install build-essential 3 | sudo apt-get install libssl-dev 4 | sudo apt-get install libncurses5-dev 5 | sudo apt-get install git 6 | 7 | ----------------------- 8 | 9 | cd 10 | mkdir opt 11 | mkdir src 12 | cd src/ 13 | 14 | wget http://www.erlang.org/download/otp_src_R15B02.tar.gz 15 | tar xzf otp_src_R15B02.tar.gz 16 | cd otp_src_R15B02/ 17 | ./configure --prefix=/home/ubuntu/opt/erlang-R15B02 18 | make install 19 | 20 | cd .. 21 | wget http://tsung.erlang-projects.org/dist/tsung-1.4.2.tar.gz 22 | tar xzf tsung-1.4.2.tar.gz 23 | 24 | git clone git://github.com/wulczer/tsung_ws.git 25 | cp tsung_ws/tsung-1.0.dtd tsung-1.4.2 26 | cp tsung_ws/include/ts_websocket.hrl tsung-1.4.2/include/ 27 | cp tsung_ws/src/tsung_controller/ts_config_websocket.erl tsung-1.4.2/src/tsung_controller/ 28 | cp tsung_ws/src/tsung/ts_websocket.erl tsung-1.4.2/src/tsung 29 | 30 | cd tsung-1.4.2/ 31 | export PATH=/home/ubuntu/opt/erlang-R15B02/bin:$PATH 32 | ./configure --prefix=$HOME/opt/tsung-1.4.2-ws 33 | make install 34 | 35 | ----------------------- 36 | 37 | gnuplot 38 | sudo apt-get install gnuplot 39 | perl ~/opt/tsung-1.4.2-ws/lib/tsung/bin/tsung_stats.pl 40 | sudo cpan Template 41 | 42 | ----------------------- 43 | 44 | sudo vim /etc/security/limits.conf 45 | sudo vim /etc/sysctl.conf 46 | sudo sysctl -p 47 | exit 48 | 49 | ssh ... 50 | ulimit -n 51 | 52 | ----------------------- 53 | 54 | sudo vim /etc/environment 55 | > Add /home/ubuntu/opt/erlang-R15B02/bin to PATH 56 | 57 | vim ~/.ssh/id_dsa 58 | > Add SSH private key 59 | chmod 600 ~/.ssh/id_dsa 60 | 61 | ssh localhost erl 62 | 63 | ----------------------- 64 | 65 | sudo apt-get install npm 66 | sudo npm install http-server -g 67 | 68 | nohup http-server -p 8000 & 69 | -------------------------------------------------------------------------------- /websocket.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 44 | 45 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | {"seq":0,"tag":"login","userId":"%%ts_user_server:get_unique_id%%","password":"password"} 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | h 72 | 73 | 74 | 75 | 76 | --------------------------------------------------------------------------------