SlideShare uma empresa Scribd logo
1 de 34
Easy distributed load test with Tsung




                               Ngoc Dao
Source code:

     https://github.com/ngocdaothanh/tsart




                    Full doc:

http://tsung.erlang-projects.org/user_manual.html
Agenda
●   Install Tsung
●   Load test from one machine
●   Distributed load test
●   Test WebSocket
Install Tsung
How to install Tsung
1. Install Erlang
2. Install Tsung
                       Tsung is a program
                       written in Erlang language
                       (Erlang presentation next time)
Install Erlang
sudo yum install yum install gcc
                                                    For connecting to
sudo yum install openssl-devel                       other machines
                                                     to do distributed
sudo yum install ncurses-devel                    load test (later slides)


wget http://www.erlang.org/download/otp_src_R15B01.tar.gz
tar xzf otp_src_R15B01.tar.gz
                                    For Erlang
cd otp_src_R15B01                  command line



./configure –prefix=$HOME/opt/erlang-R15B01
make install

          http://www.erlang.org/download.html
Install Tsung
export PATH=$PATH:$HOME/opt/erlang-R15B01/bin


wget http://tsung.erlang-projects.org/dist/tsung-1.4.2.tar.gz
tar xzf tsung-1.4.2.tar.gz
cd tsung-1.4.2                         Need “erlc” command
                                         to compile Tsung

./configure –prefix=$HOME/opt/tsung-1.4.2
make install


export PATH=$PATH:$HOME/opt/tsung-1.4.2/bin



         http://tsung.erlang-projects.org/dist/
Load test from one machine
share/doc/tsung/examples




                                                                Load test
                                        (2)                      target
                                      Requests
test.xml                                       (3)
                (1)       Tsung             Responses



                            (4)


                                            lib/tsung/bin/tsung_stats.pl


                         Reports       sudo yum install gnuplot
                                       sudo cpan Template
To be able to create many
                  connections
●   Each connection is seen as an open file; default limit:
    Linux: limit -n => 1024
    Mac: launchctl limit => 256
●   Linux:
    Edit /etc/security/limits.conf:
    *        soft      nofile    1000000
    *        hard      nofile    1000000
●   Mac:
    sudo launchctl limit maxfiles 1000000 1000000

    Or create /etc/launchd.conf:
    limit maxfiles 1000000 1000000
●   More info on tuning:
    http://ngocdaothanh.github.com/xitrum/guide/deploy
test.xml


  https://github.com/ngocdaothanh/tsart/blob/master/single.xml


Pitfall:
<!DOCTYPE tsung SYSTEM "path/to/tsung-1.0.dtd">

The path must be correct.
Be careful if you copy the XML file from other machines.
Bypassing 30k limit
Each IP can only create about 25 thousands
connections. To bypass this problem:
  1. Create multiple IPs for one network interface
  2. Set "ports_range" option


http://tsung.erlang-projects.org/user_manual.html
http://lists.process-one.net/pipermail/tsung-users/2010-Oct
<load>...</load>

<options>
 <option name="ports_range" min="1025" max="65535"/>
</options>

<sessions>...</sessions>
Demo
●   Run test:
    tsung-1.4.2/bin/tsung -f test.xml -l . start
●   See status during test:
    tail -f tsung_controller.log
    tsung-1.4.2/bin/tsung status
●   Create reports:
    perl tsung-1.4.2/lib/tsung/bin/tsung_stats.pl
Distributed load test
Tsung
                                    worker


                                    Tsung
test.xml          Tsung                           (3)           Target
           (1)                (2)   worker
                 controller


                                    Tsung
                                    worker
                    (4)




                                      EC2 is very convenient!
                 Reports
test.xml
https://github.com/ngocdaothanh/tsart/blob/master/distributed.xml

  <clients>
    <!-- Must be hostname, can't be IP -->
    <client host="t1" cpu="8" maxusers="200000"/>
    <client host="t2" cpu="8" maxusers="200000"/>
    <client host="t3" cpu="8" maxusers="200000"/>
  </clients>


                    Distributed test is easy:
                     Just add more clients
(1)
                           ssh machine2 erl
                               (port: 22)
    Tsung                                                     Tsung
  controller                      (2)                         worker
(Erlang node)         Erlang node – Erlang node           (Erlang node)
 machine1              standard communication               machine2
                         (port: 4369 and ???)




                          http://linux.die.net/man/1/epmd
            http://www.erlang.org/doc/apps/erts/erl_dist_protocol.html
Should not be 127.0.0.1
  =>
● /etc/hosts on t1:

  <ip1> t1
  <ip2> t2
  <ip3> t3
● /etc/hosts on t2, t3:

  <ip1> t1
=>
● Add erl to PATH:

  sudo echo 'pathmunge
  /home/ngoc/opt/erlang-R15B01/bin' >
  /etc/profile.d/erlang.sh

  sudo chmod +x /etc/profile.d/erlang.sh
● Or edit /etc/environment:

  PATH=”/home/ngoc/opt/erlang-R15B01/bin...”
Install once, copy everywhere
Basically, you only have to install on one
machine, then copy to others:
●   /etc/hosts
●   /etc/environment
●   /etc/sysctl.conf
●   /etc/security/limits.conf
●   Erlang
●   Tsung
Confirm
From the controller machine (t1):
ssh t1 erl
ssh t2 erl                                         Pitfall:
                                             Remember to run
ssh t3 erl                              this command to confirm,
                                                if you use
ssh localhost erl                   <client host="localhost"/>



Trouble shooting:
http://tsung.erlang-projects.org/user_manual.html
> Frequently Asked Questions
Demo
Test WebSocket


This one is good:
https://github.com/onlychoice/tsung/tree/websocket

This one may be better:
https://github.com/wulczer/tsung_ws
Example
https://github.com/wulczer/tsung_ws/blob/master/websocket.xml
Pitfall
●   I installed tsung-1.4.2 on t1, t2, t3. Then installed
    tsung-1.4.2-with-websocket-plugin on t1, but forgot to
    install it on t2 and t3.
    =>
    Install same version of Erlang and Tsung on all
    machines, at same paths
●   Tsung by default only creates 800 connections on
    each Erlang VM. It will spawn more Erlang nodes to
    create more connections. But Tsung will stop working
    when there are too many nodes (~100)
    =>
    Set maxusers to a large number (~200K/client).
<clients>
  <client host="t1" cpu="8" maxusers="200000">
    <ip scan="true" value="eth0"/>
  </client>
</clients>
Amazon EC2
●   Good: There is no Data Transfer charge between Amazon EC2
    and other Amazon Web Services within the same region
    http://aws.amazon.com/ec2/pricing/
    => Use private DNS address or IP instead of public ones
●
    m1.xlarge can create about 200 new connections/s
●
    Use Amazon VPC (Virtual Private Cloud) feature to create multiple
    virtual IPs for one network interface
●
    Pitfall: IP addresses of machines change after each restart =>
    Need to update /etc/hosts of the controller machine
Bypassing 30k limit on EC2
1. Create VPC
2. Use admin page to add instance to the VPC
3. Use admin page to add virtual IPs
4. Assign virtual IPs to network inteface eth0
5. Confirm
MAC_ADDR=$(ifconfig eth0 | sed -n
's/.*HWaddr ([a-f0-9:]*).*/1/p')

IP=($(curl http://169.254.169.254/latest/meta-
data/network/interfaces/macs/$MAC_ADDR/local-
ipv4s))

for ip in ${IP[@]:1}; do
     echo "Adding IP: $ip"
     sudo ip addr add dev eth0 $ip/24
done

ip addr show

http://about.silkapp.com/page/Multiple%20IP%20addresses%2
More topics
●   tsung-recorder:
    Use normal browsers to create test.xml
●   tsplot:
    Merge various tsung_stats.pl graphs into one
●   Monitoring:
    Erlang, SNMP, Munin
●   Loops, variables etc.

http://tsung.erlang-projects.org/user_manual.html

Mais conteúdo relacionado

Mais procurados

오픈소스컨설팅 클러스터제안 V1.0
오픈소스컨설팅 클러스터제안 V1.0오픈소스컨설팅 클러스터제안 V1.0
오픈소스컨설팅 클러스터제안 V1.0sprdd
 
Windows IOCP vs Linux EPOLL Performance Comparison
Windows IOCP vs Linux EPOLL Performance ComparisonWindows IOCP vs Linux EPOLL Performance Comparison
Windows IOCP vs Linux EPOLL Performance ComparisonSeungmo Koo
 
Les dessous du framework spring
Les dessous du framework springLes dessous du framework spring
Les dessous du framework springAntoine Rey
 
Transparent Hugepages in RHEL 6
Transparent Hugepages in RHEL 6 Transparent Hugepages in RHEL 6
Transparent Hugepages in RHEL 6 Raghu Udiyar
 
mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교Woo Yeong Choi
 
[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기NHN FORWARD
 
Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?Jérôme Petazzoni
 
MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용I Goo Lee
 
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.NAVER D2
 
Fault Tolerance 패턴
Fault Tolerance 패턴 Fault Tolerance 패턴
Fault Tolerance 패턴 YoungSu Son
 
High Performance Scaling Techniques in Golang Using Go Assembly
High Performance Scaling Techniques in Golang Using Go AssemblyHigh Performance Scaling Techniques in Golang Using Go Assembly
High Performance Scaling Techniques in Golang Using Go AssemblyMinio
 
Json in Postgres - the Roadmap
 Json in Postgres - the Roadmap Json in Postgres - the Roadmap
Json in Postgres - the RoadmapEDB
 
간단한 게임을 쉽고 저렴하게 서비스해보자! ::: AWS Game Master 온라인 시리즈 #1
간단한 게임을 쉽고 저렴하게 서비스해보자! ::: AWS Game Master 온라인 시리즈 #1간단한 게임을 쉽고 저렴하게 서비스해보자! ::: AWS Game Master 온라인 시리즈 #1
간단한 게임을 쉽고 저렴하게 서비스해보자! ::: AWS Game Master 온라인 시리즈 #1Amazon Web Services Korea
 
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱PgDay.Seoul
 
실전 서버 부하테스트 노하우
실전 서버 부하테스트 노하우 실전 서버 부하테스트 노하우
실전 서버 부하테스트 노하우 YoungSu Son
 
Proxysql use case scenarios fosdem17
Proxysql use case scenarios    fosdem17Proxysql use case scenarios    fosdem17
Proxysql use case scenarios fosdem17Alkin Tezuysal
 
중앙 서버 없는 게임 로직
중앙 서버 없는 게임 로직중앙 서버 없는 게임 로직
중앙 서버 없는 게임 로직Hoyoung Choi
 

Mais procurados (20)

오픈소스컨설팅 클러스터제안 V1.0
오픈소스컨설팅 클러스터제안 V1.0오픈소스컨설팅 클러스터제안 V1.0
오픈소스컨설팅 클러스터제안 V1.0
 
Windows IOCP vs Linux EPOLL Performance Comparison
Windows IOCP vs Linux EPOLL Performance ComparisonWindows IOCP vs Linux EPOLL Performance Comparison
Windows IOCP vs Linux EPOLL Performance Comparison
 
Les dessous du framework spring
Les dessous du framework springLes dessous du framework spring
Les dessous du framework spring
 
Transparent Hugepages in RHEL 6
Transparent Hugepages in RHEL 6 Transparent Hugepages in RHEL 6
Transparent Hugepages in RHEL 6
 
mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교mongodb와 mysql의 CRUD 연산의 성능 비교
mongodb와 mysql의 CRUD 연산의 성능 비교
 
why we need ext4
why we need ext4why we need ext4
why we need ext4
 
[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기
 
Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?
 
MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용
 
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
[135] 오픈소스 데이터베이스, 은행 서비스에 첫발을 내밀다.
 
Fault Tolerance 패턴
Fault Tolerance 패턴 Fault Tolerance 패턴
Fault Tolerance 패턴
 
Namespaces in Linux
Namespaces in LinuxNamespaces in Linux
Namespaces in Linux
 
High Performance Scaling Techniques in Golang Using Go Assembly
High Performance Scaling Techniques in Golang Using Go AssemblyHigh Performance Scaling Techniques in Golang Using Go Assembly
High Performance Scaling Techniques in Golang Using Go Assembly
 
Json in Postgres - the Roadmap
 Json in Postgres - the Roadmap Json in Postgres - the Roadmap
Json in Postgres - the Roadmap
 
Galera Cluster DDL and Schema Upgrades 220217
Galera Cluster DDL and Schema Upgrades 220217Galera Cluster DDL and Schema Upgrades 220217
Galera Cluster DDL and Schema Upgrades 220217
 
간단한 게임을 쉽고 저렴하게 서비스해보자! ::: AWS Game Master 온라인 시리즈 #1
간단한 게임을 쉽고 저렴하게 서비스해보자! ::: AWS Game Master 온라인 시리즈 #1간단한 게임을 쉽고 저렴하게 서비스해보자! ::: AWS Game Master 온라인 시리즈 #1
간단한 게임을 쉽고 저렴하게 서비스해보자! ::: AWS Game Master 온라인 시리즈 #1
 
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
[pgday.Seoul 2022] POSTGRES 테스트코드로 기여하기 - 이동욱
 
실전 서버 부하테스트 노하우
실전 서버 부하테스트 노하우 실전 서버 부하테스트 노하우
실전 서버 부하테스트 노하우
 
Proxysql use case scenarios fosdem17
Proxysql use case scenarios    fosdem17Proxysql use case scenarios    fosdem17
Proxysql use case scenarios fosdem17
 
중앙 서버 없는 게임 로직
중앙 서버 없는 게임 로직중앙 서버 없는 게임 로직
중앙 서버 없는 게임 로직
 

Semelhante a Easy distributed load test with Tsung

OpenNebula 5.4 Hands-on Tutorial
OpenNebula 5.4 Hands-on TutorialOpenNebula 5.4 Hands-on Tutorial
OpenNebula 5.4 Hands-on TutorialOpenNebula Project
 
Steps to build and run oai
Steps to build and run oaiSteps to build and run oai
Steps to build and run oaissuser38b887
 
Docker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12XDocker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12XJérôme Petazzoni
 
CoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love SystemdCoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love SystemdRichard Lister
 
Plone deployment made easy
Plone deployment made easyPlone deployment made easy
Plone deployment made easyKim Chee Leong
 
Deep Dive on Amazon EC2 Instances (March 2017)
Deep Dive on Amazon EC2 Instances (March 2017)Deep Dive on Amazon EC2 Instances (March 2017)
Deep Dive on Amazon EC2 Instances (March 2017)Julien SIMON
 
Run Run Trema Test
Run Run Trema TestRun Run Trema Test
Run Run Trema TestHiroshi Ota
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopLorin Hochstein
 
Docker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQ
Docker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQDocker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQ
Docker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQJérôme Petazzoni
 
Docker Introduction + what is new in 0.9
Docker Introduction + what is new in 0.9 Docker Introduction + what is new in 0.9
Docker Introduction + what is new in 0.9 Jérôme Petazzoni
 
LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager Alison Chaiken
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time OptimizationKan-Ru Chen
 
Proactive monitoring with Monit
Proactive monitoring with MonitProactive monitoring with Monit
Proactive monitoring with MonitOSOCO
 
Summit demystifying systemd1
Summit demystifying systemd1Summit demystifying systemd1
Summit demystifying systemd1Susant Sahani
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013dotCloud
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Docker, Inc.
 

Semelhante a Easy distributed load test with Tsung (20)

CoreOS Intro
CoreOS IntroCoreOS Intro
CoreOS Intro
 
OpenNebula 5.4 Hands-on Tutorial
OpenNebula 5.4 Hands-on TutorialOpenNebula 5.4 Hands-on Tutorial
OpenNebula 5.4 Hands-on Tutorial
 
Steps to build and run oai
Steps to build and run oaiSteps to build and run oai
Steps to build and run oai
 
Docker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12XDocker and Containers for Development and Deployment — SCALE12X
Docker and Containers for Development and Deployment — SCALE12X
 
CoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love SystemdCoreOS, or How I Learned to Stop Worrying and Love Systemd
CoreOS, or How I Learned to Stop Worrying and Love Systemd
 
AEO Training - 2023.pdf
AEO Training - 2023.pdfAEO Training - 2023.pdf
AEO Training - 2023.pdf
 
Dev ops
Dev opsDev ops
Dev ops
 
Plone deployment made easy
Plone deployment made easyPlone deployment made easy
Plone deployment made easy
 
Deep Dive on Amazon EC2 Instances (March 2017)
Deep Dive on Amazon EC2 Instances (March 2017)Deep Dive on Amazon EC2 Instances (March 2017)
Deep Dive on Amazon EC2 Instances (March 2017)
 
Driver_linux
Driver_linuxDriver_linux
Driver_linux
 
Run Run Trema Test
Run Run Trema TestRun Run Trema Test
Run Run Trema Test
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
 
Docker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQ
Docker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQDocker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQ
Docker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQ
 
Docker Introduction + what is new in 0.9
Docker Introduction + what is new in 0.9 Docker Introduction + what is new in 0.9
Docker Introduction + what is new in 0.9
 
LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 
Proactive monitoring with Monit
Proactive monitoring with MonitProactive monitoring with Monit
Proactive monitoring with Monit
 
Summit demystifying systemd1
Summit demystifying systemd1Summit demystifying systemd1
Summit demystifying systemd1
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
 

Mais de Ngoc Dao

Model with actors and implement with Akka
Model with actors and implement with AkkaModel with actors and implement with Akka
Model with actors and implement with AkkaNgoc Dao
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettextNgoc Dao
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumNgoc Dao
 
BIG DATA サービス と ツール
BIG DATA サービス と ツールBIG DATA サービス と ツール
BIG DATA サービス と ツールNgoc Dao
 
How to write a web framework
How to write a web frameworkHow to write a web framework
How to write a web frameworkNgoc Dao
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Ngoc Dao
 
Actor-based concurrency and Akka Fundamentals
Actor-based concurrency and Akka FundamentalsActor-based concurrency and Akka Fundamentals
Actor-based concurrency and Akka FundamentalsNgoc Dao
 
Xitrum HOWTOs
Xitrum HOWTOsXitrum HOWTOs
Xitrum HOWTOsNgoc Dao
 
Xitrum @ Scala Conference in Japan 2013
Xitrum @ Scala Conference in Japan 2013Xitrum @ Scala Conference in Japan 2013
Xitrum @ Scala Conference in Japan 2013Ngoc Dao
 
SockJS Intro
SockJS IntroSockJS Intro
SockJS IntroNgoc Dao
 
How to start using Scala
How to start using ScalaHow to start using Scala
How to start using ScalaNgoc Dao
 
Cloud Erlang
Cloud ErlangCloud Erlang
Cloud ErlangNgoc Dao
 
Xitrum internals
Xitrum internalsXitrum internals
Xitrum internalsNgoc Dao
 
Những lỗi bảo mật web thường gặp ở phần application
Những lỗi bảo mật web thường gặp ở phần applicationNhững lỗi bảo mật web thường gặp ở phần application
Những lỗi bảo mật web thường gặp ở phần applicationNgoc Dao
 
Erlang Web
Erlang WebErlang Web
Erlang WebNgoc Dao
 
Nitrogen Web Framework
Nitrogen Web FrameworkNitrogen Web Framework
Nitrogen Web FrameworkNgoc Dao
 
スポイトができるまで
スポイトができるまでスポイトができるまで
スポイトができるまでNgoc Dao
 
Camellia General
Camellia GeneralCamellia General
Camellia GeneralNgoc Dao
 
Nhập môn BDD
Nhập môn BDDNhập môn BDD
Nhập môn BDDNgoc Dao
 
何でRuby
何でRuby何でRuby
何でRubyNgoc Dao
 

Mais de Ngoc Dao (20)

Model with actors and implement with Akka
Model with actors and implement with AkkaModel with actors and implement with Akka
Model with actors and implement with Akka
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettext
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and Xitrum
 
BIG DATA サービス と ツール
BIG DATA サービス と ツールBIG DATA サービス と ツール
BIG DATA サービス と ツール
 
How to write a web framework
How to write a web frameworkHow to write a web framework
How to write a web framework
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
 
Actor-based concurrency and Akka Fundamentals
Actor-based concurrency and Akka FundamentalsActor-based concurrency and Akka Fundamentals
Actor-based concurrency and Akka Fundamentals
 
Xitrum HOWTOs
Xitrum HOWTOsXitrum HOWTOs
Xitrum HOWTOs
 
Xitrum @ Scala Conference in Japan 2013
Xitrum @ Scala Conference in Japan 2013Xitrum @ Scala Conference in Japan 2013
Xitrum @ Scala Conference in Japan 2013
 
SockJS Intro
SockJS IntroSockJS Intro
SockJS Intro
 
How to start using Scala
How to start using ScalaHow to start using Scala
How to start using Scala
 
Cloud Erlang
Cloud ErlangCloud Erlang
Cloud Erlang
 
Xitrum internals
Xitrum internalsXitrum internals
Xitrum internals
 
Những lỗi bảo mật web thường gặp ở phần application
Những lỗi bảo mật web thường gặp ở phần applicationNhững lỗi bảo mật web thường gặp ở phần application
Những lỗi bảo mật web thường gặp ở phần application
 
Erlang Web
Erlang WebErlang Web
Erlang Web
 
Nitrogen Web Framework
Nitrogen Web FrameworkNitrogen Web Framework
Nitrogen Web Framework
 
スポイトができるまで
スポイトができるまでスポイトができるまで
スポイトができるまで
 
Camellia General
Camellia GeneralCamellia General
Camellia General
 
Nhập môn BDD
Nhập môn BDDNhập môn BDD
Nhập môn BDD
 
何でRuby
何でRuby何でRuby
何でRuby
 

Último

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Último (20)

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Easy distributed load test with Tsung

  • 1. Easy distributed load test with Tsung Ngoc Dao
  • 2. Source code: https://github.com/ngocdaothanh/tsart Full doc: http://tsung.erlang-projects.org/user_manual.html
  • 3. Agenda ● Install Tsung ● Load test from one machine ● Distributed load test ● Test WebSocket
  • 5. How to install Tsung 1. Install Erlang 2. Install Tsung Tsung is a program written in Erlang language (Erlang presentation next time)
  • 6. Install Erlang sudo yum install yum install gcc For connecting to sudo yum install openssl-devel other machines to do distributed sudo yum install ncurses-devel load test (later slides) wget http://www.erlang.org/download/otp_src_R15B01.tar.gz tar xzf otp_src_R15B01.tar.gz For Erlang cd otp_src_R15B01 command line ./configure –prefix=$HOME/opt/erlang-R15B01 make install http://www.erlang.org/download.html
  • 7. Install Tsung export PATH=$PATH:$HOME/opt/erlang-R15B01/bin wget http://tsung.erlang-projects.org/dist/tsung-1.4.2.tar.gz tar xzf tsung-1.4.2.tar.gz cd tsung-1.4.2 Need “erlc” command to compile Tsung ./configure –prefix=$HOME/opt/tsung-1.4.2 make install export PATH=$PATH:$HOME/opt/tsung-1.4.2/bin http://tsung.erlang-projects.org/dist/
  • 8. Load test from one machine
  • 9. share/doc/tsung/examples Load test (2) target Requests test.xml (3) (1) Tsung Responses (4) lib/tsung/bin/tsung_stats.pl Reports sudo yum install gnuplot sudo cpan Template
  • 10. To be able to create many connections ● Each connection is seen as an open file; default limit: Linux: limit -n => 1024 Mac: launchctl limit => 256 ● Linux: Edit /etc/security/limits.conf: * soft nofile 1000000 * hard nofile 1000000 ● Mac: sudo launchctl limit maxfiles 1000000 1000000 Or create /etc/launchd.conf: limit maxfiles 1000000 1000000
  • 11. More info on tuning: http://ngocdaothanh.github.com/xitrum/guide/deploy
  • 12. test.xml https://github.com/ngocdaothanh/tsart/blob/master/single.xml Pitfall: <!DOCTYPE tsung SYSTEM "path/to/tsung-1.0.dtd"> The path must be correct. Be careful if you copy the XML file from other machines.
  • 13. Bypassing 30k limit Each IP can only create about 25 thousands connections. To bypass this problem: 1. Create multiple IPs for one network interface 2. Set "ports_range" option http://tsung.erlang-projects.org/user_manual.html http://lists.process-one.net/pipermail/tsung-users/2010-Oct
  • 14. <load>...</load> <options> <option name="ports_range" min="1025" max="65535"/> </options> <sessions>...</sessions>
  • 15. Demo ● Run test: tsung-1.4.2/bin/tsung -f test.xml -l . start ● See status during test: tail -f tsung_controller.log tsung-1.4.2/bin/tsung status ● Create reports: perl tsung-1.4.2/lib/tsung/bin/tsung_stats.pl
  • 17. Tsung worker Tsung test.xml Tsung (3) Target (1) (2) worker controller Tsung worker (4) EC2 is very convenient! Reports
  • 18. test.xml https://github.com/ngocdaothanh/tsart/blob/master/distributed.xml <clients> <!-- Must be hostname, can't be IP --> <client host="t1" cpu="8" maxusers="200000"/> <client host="t2" cpu="8" maxusers="200000"/> <client host="t3" cpu="8" maxusers="200000"/> </clients> Distributed test is easy: Just add more clients
  • 19. (1) ssh machine2 erl (port: 22) Tsung Tsung controller (2) worker (Erlang node) Erlang node – Erlang node (Erlang node) machine1 standard communication machine2 (port: 4369 and ???) http://linux.die.net/man/1/epmd http://www.erlang.org/doc/apps/erts/erl_dist_protocol.html
  • 20. Should not be 127.0.0.1 => ● /etc/hosts on t1: <ip1> t1 <ip2> t2 <ip3> t3 ● /etc/hosts on t2, t3: <ip1> t1
  • 21. => ● Add erl to PATH: sudo echo 'pathmunge /home/ngoc/opt/erlang-R15B01/bin' > /etc/profile.d/erlang.sh sudo chmod +x /etc/profile.d/erlang.sh ● Or edit /etc/environment: PATH=”/home/ngoc/opt/erlang-R15B01/bin...”
  • 22. Install once, copy everywhere Basically, you only have to install on one machine, then copy to others: ● /etc/hosts ● /etc/environment ● /etc/sysctl.conf ● /etc/security/limits.conf ● Erlang ● Tsung
  • 23. Confirm From the controller machine (t1): ssh t1 erl ssh t2 erl Pitfall: Remember to run ssh t3 erl this command to confirm, if you use ssh localhost erl <client host="localhost"/> Trouble shooting: http://tsung.erlang-projects.org/user_manual.html > Frequently Asked Questions
  • 24. Demo
  • 25. Test WebSocket This one is good: https://github.com/onlychoice/tsung/tree/websocket This one may be better: https://github.com/wulczer/tsung_ws
  • 27. Pitfall ● I installed tsung-1.4.2 on t1, t2, t3. Then installed tsung-1.4.2-with-websocket-plugin on t1, but forgot to install it on t2 and t3. => Install same version of Erlang and Tsung on all machines, at same paths ● Tsung by default only creates 800 connections on each Erlang VM. It will spawn more Erlang nodes to create more connections. But Tsung will stop working when there are too many nodes (~100) => Set maxusers to a large number (~200K/client).
  • 28. <clients> <client host="t1" cpu="8" maxusers="200000"> <ip scan="true" value="eth0"/> </client> </clients>
  • 29. Amazon EC2 ● Good: There is no Data Transfer charge between Amazon EC2 and other Amazon Web Services within the same region http://aws.amazon.com/ec2/pricing/ => Use private DNS address or IP instead of public ones ● m1.xlarge can create about 200 new connections/s ● Use Amazon VPC (Virtual Private Cloud) feature to create multiple virtual IPs for one network interface ● Pitfall: IP addresses of machines change after each restart => Need to update /etc/hosts of the controller machine
  • 30.
  • 31.
  • 32. Bypassing 30k limit on EC2 1. Create VPC 2. Use admin page to add instance to the VPC 3. Use admin page to add virtual IPs 4. Assign virtual IPs to network inteface eth0 5. Confirm
  • 33. MAC_ADDR=$(ifconfig eth0 | sed -n 's/.*HWaddr ([a-f0-9:]*).*/1/p') IP=($(curl http://169.254.169.254/latest/meta- data/network/interfaces/macs/$MAC_ADDR/local- ipv4s)) for ip in ${IP[@]:1}; do echo "Adding IP: $ip" sudo ip addr add dev eth0 $ip/24 done ip addr show http://about.silkapp.com/page/Multiple%20IP%20addresses%2
  • 34. More topics ● tsung-recorder: Use normal browsers to create test.xml ● tsplot: Merge various tsung_stats.pl graphs into one ● Monitoring: Erlang, SNMP, Munin ● Loops, variables etc. http://tsung.erlang-projects.org/user_manual.html