Doing user load testing with Artillery and finding it to be clean, useful, and fully featured

Install Artillery

npm install artillery@latest -g

Sample configuration file

The following is a simple load test with the following parameters

  • Only 1 phase
  • Start a test run that lasts 60 seconds with new users arriving 20 per every 5 seconds until reaching
  • Single test url GET
config:
  target: 'https://artillery.io'
  phases:
    - duration: 60
      arrivalRate: 20
  defaults:
    headers:
      x-my-service-auth: '987401838271002188298567'
scenarios:
  - flow:
    - get:
        url: "/docs"

Commands to test the run

Run this in quiet mode with an output report file

artillery run test.yml -q -o test.json

When this is completed generate a human readable report from the test run

artillery report test.json

Which produces this nice html report test.json.html That looks something like this

Detailed example with environments

An example that will allow me to control and launch different tests based on environment

config:
  target: 'http://localhost/amazingapp'
  tls:
    rejectUnauthorized: false
  phases:
    - duration: 30
      arrivalRate: 1
      rampTo: 10
  environments:
    alb1:
      target: 'https://alb1.not_a_real_domain.nonono'
      tls:
        rejectUnauthorized: false
      phases:
        - duration: 30
          arrivalRate: 1
          rampTo: 10
    alb2:
      target: 'https://alb2.not_a_real_domain.nonono'
      tls:
        rejectUnauthorized: false
      phases:
        - duration: 30
          arrivalRate: 1
          rampTo: 10
    alb3:
      target: 'https://alb3.not_a_real_domain.nonono'
      tls:
        rejectUnauthorized: false
      phases:
        - duration: 30
          arrivalRate: 1
          rampTo: 10      
scenarios:
  - flow:
    - get:
        url: "/search?keyword=abc"