`
sillycat
  • 浏览: 2490313 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Performance Tool(1)Gatling

阅读更多
Performance Tool(1)Gatling

1. Installation and Preparation
Download the binary file, the version I am using is gatling-charts-highcharts-1.4.4-bundle.tar.gz.

I unzip and put it here /Users/carl/tool/gatling-charts-highcharts-1.4.4

link a short name for the working directory.

>sudo ln -s /Users/carl/tool/gatling-charts-highcharts-1.4.4 ./gatling-1.4.4
>sudo ln -s gatling-1.4.4 gatling

I already have JDK1.6 on my local machine, even gatling recommend JDK 1.7, but I will still use JDK1.6.

2. Running Gatling
There is a command line interface(CLI).

Add gatling to my system
>vi ~/.profile
export GATLING_HOME=/opt/gatling
export PATH=/opt/gatling/bin:$PATH 
>. ~/.profile

>gatling.sh

3. First Steps with Gatling
I will learn about simulations, scenarios, feeders, recorder, loops, scala functions, etc.

Create my own simulation directory under simulations.
>mkdir sillycat
>vi SimulationtoTaobao.scala

I just write a very first simple sample to visit one page on taobao website.
package sillycat
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import com.excilys.ebi.gatling.jdbc.Predef._
import com.excilys.ebi.gatling.http.Headers._
import akka.util.duration._
import bootstrap._
import assertions._

class SimulationtoTaobao extends Simulation {
  // your code starts here
  val scn = scenario("My First Scenario")
            .exec(http("My Page")
              .get("http://www.taobao.com/index_global.php"))

  setUp(scn.users(10))
  // your code ends here
}

Run gatling.sh
>gatling.sh

And choose sillycat.

I can spend some time to study https://github.com/excilys/excilys-bank.git this project.

4. Read the codes in Basic
Steps
     1. The user accesses to the application http://excilys-bank-web.cloudfoundry.com/public/login.html
     2. The user enters its credentials and logs in
     3. The user accesses to the details of one of its accounts
     4. The user accesses to the operations of the previous month    
     5. The user logs out

5. Gatling Recorder
We can recorder our action through gatling recorder.
>recorder.sh

Follow this document to record my actions.
https://github.com/excilys/gatling/wiki/Recorder#wiki-browser-config

6. Gatling Scenario Explained
…snip…

I will wrote more later about how I use it to stress test on my own application. And read the Explained in details.

References:
https://github.com/excilys/gatling/wiki/Getting-Started
https://github.com/excilys/gatling
http://gatling-tool.org/


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics