Know More About Parallel Requests In Grafana K6

female software engineer coding on computer
Reading Time: 2 minutes

Hi folks, In this blog, we will explore more about parallel requests in our favorite performance testing tool, Grafana K6. However, you may be asking what the circumstances are and why we use them. So let’s start with some core fundamentals of “Parallel Requests.”

Parallel requests are requests that are sent at the same time. Parallel requests are sometimes called “concurrent” requests.

Why should we use parallel requests?

Parallel requests influence load testing results because they increase test throughput. Increased test throughput affects load testing in two ways.

  • First, because sending requests in parallel takes less time than sending them sequentially, the load generator may experience more resource consumption in a shorter period of time.
  • Second, concurrent requests reach the application server faster, potentially increasing server resource use.

We also used parallel requests in production, because parallel requests make a test more realistic in certain instances. Because modern browsers support parallelism by default, a load test for a website or web app should usually account for parallel requests.

API calls may not typically be triggered simultaneously, so it may be more realistic to send requests sequentially.

Batching in k6

By default, each k6 user sends each request in the script sequentially. But we can modify this scenario by using batching, which can be used to adjust consecutive behavior.

 export default function () {

    let responses = http.batch([

        ['GET', ''],

        ['GET', ""],

        ['GET', ""],

        ['GET', ""],


above script sends five requests in parallel, Each of the responses is saved like an array in the variable responses.

We also add some checks to verify the send request, like

 check(responses[0], {

    'Homepage successfully loaded': (r) => r.body.includes("Collection of 

simple web-pages suitable for load testing"),

    'main page status was 200': (res) => res.status === 200,

The above check verifies that the very first element of that array, responses[0], the homepage, contains text that proves that the script successfully retrieved the HTML body.

we need some arguments in a particular order with each request when we specified request in array

Method string / HTTP URL Mandatory. The HTTP method of the request. One of GET,
URL string / object /
Mandatory. The URL to request.
Body string/object /
The body of the request is relevant. Can be set to null if not
applicable but you want to set the last params argument.
Params object Params like auth, custom headers, and tags.

You can batch requests even if they are not all HTTP GET requests. For example, you could use HTTP GET and HTTP POST requests in the same batch

Batching with request objects

Objects can also be used to store information about a request. Here’s an example of how we do it to send a POST request and use custom HTTP headers by including a Params object in the request:

 export default function () {  

    const req1 = {

      method: 'GET',

      url: '',


    const req2 = {

       method: 'GET',

       url: '',

     const req3 = {

       method: 'POST',

       url: '',

      body: {

          "email": "",
          "password": "pistol"


      params: {

       headers: { 'User-Agent': 'k6test' },

       tags: { k6test: 'yes' }   



We pass all the above requests in a batch as an array.

const responses = http.batch([req1, req2, req3]);

That concludes this blog. I hope you enjoyed and learned about parallel requests in k6. If you require the above code, please feel free to reach out to us at knoldus

Thank you!!


Written by 

I am a self-driven self-starter with strong analytical, problem-solving, and communication skills, and I'm always looking to pick up new skills and develop my interpersonal skills. I am currently employed as a quality assurance software consultant. I am well-versed in creating automation frameworks and am familiar with key QA ideas. I've worked with automation technologies in the past, including,,, selenium (java), Appium, Grafana-K6, and core Java development tools, among others. Maven, Version Control GIT (GitLab Project Management Tool).