Short notes on K6 load test


Fully Managed UK Hosting – Only £1+VAT till 1st Jan 2021 on Shared, Reseller and Dedicated Hosting! …. read more ….

Load test a form

Install K6
Install influxdb

Install grafana

Set up script e.g

import http from 'k6/http';

export let options = {
  scenarios: {
    constant_request_rate: {
      executor: 'constant-arrival-rate',
      rate: 3,
      timeUnit: '1s',
      duration: '1m',
      preAllocatedVUs: 50,
      maxVUs: 100,
    },
  },
};

export default function () {
  var url = 'https://domain-test';
// if you need to post stuff to make a form work
  var payload = {
    __nonce: 'load_test', // code a nonce bypass
    'param1': 'value1',
  };

  var params = {
    headers: {
// for form
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  };

  http.post(url, payload, params);
}

Start services

sudo service grafana-server start
sudo service influxdb start

Run test

k6 run -o influxdb=http://localhost:8086/mydb test.js

Watch in graphana, user admin, pass admin

http://localhost:3000

Shut services

sudo service grafana-server stop
sudo service influxdb stop

[Next] Find out where to host WordPress [Read the full article…]


Leave a Reply

Your email address will not be published.