I am new to k6 load testing. And I have been asked to test the performance of multiple pages with 20 VUs. How should I construct the tests?
Currently I am listing them in the default function and have a list of batch requests for each page. Am I doing it correctly with following example?
Example:
export let options = {
stages: [
{ duration: “1m”, target: 20 },
{ duration: “5m”, target: 20 },
{ duration: “1m”, target: 0 }
]
…
group(“Test performance of 3 pages with 20 VUs”, function() {
//3 request for 3 test pages
let req, req2, req3;
req = [{
“method”: “get”, home page
…
req2 = [{
“method”: “get”, listing page
…
req3 = [{
“method”: “get”, support page
…
http.batch(req);
http.batch(req2);
http.batch(req3);
});
}
And I have following questions:
-
By doing it this way when at its peak where 20 VUs are reached, it is possible that at some point 5 VUs might be hitting page 1, 5 other VUs hitting page 2 and the rest 10 VUs hitting page 3. So we cannot get the concurrency of 20 VUs hitting the same page. How do we address this? I have tried using http.batch(req, req2, req3); to have the VUs hitting all the pages at the same time, but it doesn’t seem to give you the analytics for each page.
-
Our pages have asynchronous elements. Does k6 evaluate the load time of the main doc, or does it include those asynchronous elements as well, eg, those making javascript calls to load certain datatable? Should those be included in evaluating the performance of these pages?