Questions tagged [k6]

k6 is a backend infrastructure load testing tool written in Go which runs load tests written in JavaScript.

k6 is an open source performance analysis tool for testing backend infrastructure load.

k6 itself is written in Go and runs load test scripts implemented in JavaScript with support for at least ES5.1. Some newer features are also supported through Babel. k6, formerly loadimpact, is owned by Grafana Labs.

k6 supports a variety of common load testing requirements:

  • Scenarios
  • Open and closed workload models
  • (Custom) metrics
  • Thresholds
  • Different protocols, including HTTP, WebSocket, and gRPC
325 questions
0
votes
2 answers

How to stop duplicating scripts in K6?

I have to write like 20 different scripts in K6 for an application. And most of these scripts contains common functionalities like login, choose some options, etc... So is there a better way to write K6 scripts without duplicating these common…
Sandeepa
  • 3,457
  • 5
  • 25
  • 41
0
votes
1 answer

Function for creating and populating k6 metrics

I am trying to create a function in js for k6 tool scripts which would enable me to create multiple type of metrics for "Transaction Name" as input and then create another function to populate those metrics. This will help in avoiding writing…
Saurabh Vyas
  • 35
  • 1
  • 5
0
votes
1 answer

How to calculate results from built_in metrics

I am creating monitoring system (k6+grafana+influxdb) with docker. I want to use built-in metrics (not http-specific) to calculate e.g. data_received per request/group or full iteration in worst case, but all I get in influxDB in data_received…
Ceyeva
  • 1
0
votes
1 answer

Parsing only the id with regex

Using this regex /var userId = (\d+)/, I can find the id of the user. Except it returns "var userId = 117051" instead of just 117051. I looked around in regexr but I'm not very good with regex. Is there a way to only get the id?
Hugo
  • 349
  • 3
  • 6
  • 23
0
votes
1 answer

Emulating browser cache for each VU from K6 for load testing

I understand k6 cannot emulate browser cache (except cookies in header) as per its documentation. Has someone attempted to simulate browser cache (more than just cookies header) while load testing with k6 tool ? Looking for functions / options…
Saurabh Vyas
  • 35
  • 1
  • 5
0
votes
1 answer

K6 Memory Consumption per VU

I have recently started to work with k6 and really liked the approach of writing tests. When I started my first serious test I found that the memory consumption per VU is pretty high even though my test was not huge. As I read here memory…
0
votes
1 answer

Invalid URL GoError: invalid URL value in K6 Performance Testing

I am running the API via K6 http.url and getting the below exception but not sure what is being missed in the URL; export default function() { let url = http.get("http://test.loadimpact.com"); let res = http.get(url); check(res, { …
techie
  • 1
  • 1
0
votes
2 answers

RESTAPI Performance (Stress) test using docker

I want to do a performance test on Perl based REST API. Is there any docker container available to do this? Like I can input: 1000 requests per second POST request URL and body Run for 5 mins. I have monitoring setup on the server side. If the…
Nageswaran
  • 7,481
  • 14
  • 55
  • 74
0
votes
2 answers

Meteor application load testing with k6, wait on body element

New to k6, working with a web application that presents a spinner briefly on the home page while css and js files load. Once the files are loaded and scripts are available, a login form is added (replacing the spinner). With k6, is there a way to…
Bill R
  • 1
  • 3
0
votes
1 answer

How can I generate an html report with k6?

I'm using grafana and influxdb with k6 for load testing, but I have a usecase where I'll need offline access to the grafana dashboard (or something similar). Does k6, or grafana, have a way to export an html report? thanks, jas
Jas Ahluwalia
  • 183
  • 3
  • 15
0
votes
1 answer

K6: k6 websocket - how to decode compressed text in K6

I have used K6 in websocket performance test. While the content from server is compressed, and I got "�0E�e�!�56���j0&��v!�{�:�9�^�" printed in console. I used nodejs code to handle the same message from server. I got the right text. So my…
wazhao
  • 106
  • 1
  • 4
0
votes
1 answer

Save response body to file when "check" fail in k6

Is there any way for k6 to save every response body and response code of the failed checks/assertion? maybe something like check(res, {"rc code": (r) => r.status == rc_code,}) || AppendErrorLog(filename, r.body);
0
votes
1 answer

Parse output from k6 data to get specific information

I am trying to extract data from a k6 output (https://docs.k6.io/docs/results-output): data_received.........: 246 kB 21 kB/s data_sent.............: 174 kB 15 kB/s http_req_blocked......: avg=26.24ms min=0s med=13.5ms max=145.27ms…
gagneet
  • 35,729
  • 29
  • 78
  • 113
0
votes
1 answer

Verifying that a k6 transaction used HTTP/2

When making a k6 HTTP request, how can I verify if the transaction happened using HTTP/1.1 or HTTP/2? This code does not work: let res = http.get("http://some.url/"); check(res, { "HTTP/2": (r) => r.headers.match(/HTTP\/2/)}); //fail
Ragnar
  • 1,122
  • 1
  • 9
  • 16
0
votes
1 answer

Running k6 script with multiple vusers fails with "request canceled (Client.Timeout exceeded while awaiting headers)" error

My following k6 script runs fine with 1 vuser. But whenever I run with more than 1 vusers, script fails:- (←[33mWARN←[0m[0114] Request Failed ←[33merror←[0m="Post http://myurl.mycompany.com/v1/Order: net/http: request canceled (Client.Timeout…
MOZARA
  • 1
  • 3
1 2 3
21
22