First Load Test

In order to load test a server, the player needs a playbook that describes the requests to be done, as well as the injection parameters (how many users, at what rate, for what duration, ... ?).

Start the proxy mode

Of course, you will need to learn the syntax to create your own playbooks, but the easier way to start is to make the player generate a playbook skeleton for you ! It's a simple as launching the player in proxy mode, like this:

$ player proxy --proxy-domain www.mysite.com
INFO[0000] Starting Web Proxy on address: 127.0.0.1:12345
INFO[0000] Proxied Domain: www.mysite.com
INFO[0000] Ignored Suffixes: .gif,.png,.jpg,.jpeg,.css,.js,.ico,.ttf,.woff,.pdf

By default, the proxy listens on TCP port 12345 but you can change it using the --listen-addr option. You also need to provide the website name you want to create the playbook for. The website name is given by the --proxy-domain option. As you may notice, some requests will be ignored in the playbook, depending on the request prefixes. You can change the prefix values with the --proxy-ignore-suffixes option.

Navigate to the website and get your playbook !

Configure your favorite browser to use the proxy previously launched and navigate to the target website. Every intercepted request is displayed by the proxy:

INFO[0648] Going to proxy request: GET https://www.mysite.com:443/
INFO[0706] Going to proxy request: GET https://www.mysite.com:443/page1.php
INFO[0712] Going to proxy request: GET https://www.mysite.com:443/chaingun/page1.php
INFO[0782] Going to proxy request: GET https://www.mysite.com:443/chaingun/page5.php?address=the_world
^C
Do you want to (e)xit, (c)ontinue, (d)isplay the Playbook, (r)eset the Playbook ? [e/c/d/r] d
INFO[0808] Dump the Playbook...

When you're done navigating, just type Ctrl-C in the terminal where you launched the proxy. You are then asked to exit the proxy, to continue intercepting requests, to display the current playbook or to reset the current playbook. Here we chose d (display playbook). The following lines are then displayed by the proxy:

iterations: 1
users: 1
rampup: 1
default:
  server: www.mysite.com
  protocol: http
  method: GET
actions:
  - http:
      title: Action 1
      url: /
      store_cookie: __all__
  - http:
      title: Action 2
      url: /page1.php
  - http:
      title: Action 3
      url: /chaingun/page1.php
  - http:
      title: Action 4
      url: /chaingun/page5.php?address=the_world

Replay the playbook

Let's say you have pasted the output of the proxy in a file named my_playbook.yml (Yes, it's a YAML file !), stop the proxy by typing Ctrl-C then e. you can replay your scenario like this:

$ player inject --script my_playbook.yml
INFO[0000] Maximum number of open file descriptors: 65536
INFO[0000] If you press <Ctrl-C> during the play, you will get partial results !
INFO[0000] Playbook Version is v1 
INFO[0000] Play pre-actions
INFO[0000] Launch VUs to play the actions
INFO[0001] Time: 1 TotalReq: 4, VUCount: 0, Avg latency: 39761 μs (39 ms) req/s: 4
INFO[0001] All VUs started, waiting at WaitGroup
INFO[0002] Time: 2 TotalReq: 4, VUCount: 0, Avg latency: 0 μs (0 ms) req/s: 0
INFO[0003] Done in 3.014453484s 
INFO[0003] Building reports, please wait...
INFO[0003] Count of remaining goroutines=3
INFO[0003] Launching Viewer
INFO[0003] Graphs generated in directory ./results/

When the player ends, you can browse the results by displaying the results/index.html file in your browser !