K6 WebSockets Loadtest Report Confusing

439 views Asked by At

Just wanna ask, how to read the report generated by K6 on websockets load test

enter image description here

That's the report I got from the code i made like this

import {
  check,
  fail,
  sleep
} from "k6";
import {
  Counter,
  Rate
} from "k6/metrics";
import ws from "k6/ws";

let errorCount = new Counter("error_count");
//let errorRate = new Rate("error_rate");


export const options = {
  thresholds: {
    "error_rate": ["rate<0.2"]
  } // error rate not more than 20 percent
};




export default function () {
  

  var url = "wss://play.blabla.com";

  console.log(url);

  var params = {
    headers: {
      "accept-encoding": "gzip, deflate",
      "accept-language": "id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7",
     
    }
  };


  let res;

  res = ws.connect(url, params, function(socket) {
    socket.on('open', function open() {
      console.log('connected');

      socket.setInterval(function timeout() {
        socket.ping();
        console.log("Pinging every 500 ms (setInterval test)");
      }, 500);
      });

      socket.on('ping', function () {
          console.log("PING!");
      });

      socket.on('pong', function () {
          console.log("PONG!");
      });

      socket.on('close', function() {
          console.log('disconnected');
      });
      
      socket.on('error', function(e) {
        if (e.error() != "websocket: close sent") {
          console.log('An unexpected error occured: ', e.error());
        }
      });

  });
  

  let checking = check(res, { "status is 101": r => r && r.status === 101 });

  
}

I dont understand on ws_sessions that hits 5603, but the checks said only 815

Can someone explain? Is this report was having a good result or bad result from the test.

Thanks a lot for your help guys!

0

There are 0 answers