Lamp Coder

Web development & stuff

Test your website from aws ec2 with artillery

Posted by Vasilis on July 17, 2018

While you are connected to your ec2 instance with SSH:

Install node (version 6 at least is required)

# install the node version manager
curl -o- | bash

# activate nvm
. ~/.nvm/

# install latest long term release of nodejs
nvm install --lts

# see the version installed
node -v

Install artillery with npm

sudo apt-get install npm
sudo npm install -g artillery

Now that artillery is installed you can run a quick test

artillery quick --count 10 -n 20

This command will create 10 "virtual users" each of which will send 20 HTTP requests to your site

In the end you get similar results:

All virtual users finished
Summary report @ 13:26:13(+0000) 2018-07-16
  Scenarios launched:  10
  Scenarios completed: 10
  Requests completed:  200
  RPS sent: 82.64
  Request latency:
    min: 4.2
    max: 1486.1
    median: 7.6
    p95: 183.3
    p99: 533.2
  Scenario counts:
    0: 10 (100%)
    200: 200

Results explained (from artillery documentation)

  • Scenarios launched is the number of virtual users created in the preceding 10 seconds (or in total for the final report)
  • Scenarios completed is the number of virtual users that completed their scenarios in the preceding 10 seconds (or in the whole test). Note: this is the number of completed sessions, not the number of sessions started and completed in a 10 second interval.
  • Requests completed is the number of HTTP requests and responses or WebSocket messages sent
  • RPS sent is the average number of requests per second completed in the preceding 10 seconds (or throughout the test)
  • Request latency is in milliseconds, and p95 and p99 values are the 95th and 99th percentile values (a request latency p99 value of 500ms means that 99 out of 100 requests took 500ms or less to complete).

Now go and create a script to run your tests 

And coninue in