0

I have a conceptual question regarding the K6 parallel test. I want to run multiple test scripts in parallel. If I choose to run them using docker compose file like following, can we say that its a parallel in real sense? As I understand, each k6 container inside docker compose is a seperate unit with its own processor? Is that correct? Can this be called a parallel test then?

version: '3'
services:
  k6_test:
    image: loadimpact/k6
    container_name: test_k6
    volumes:
       - ./:/specs
    command: run /tests/test_spec.js
    ports:
       - "6565:6565"

  k6_test2:
    image: loadimpact/k6
    container_name: test2_k6
    volumes:
       - ./:/specs
    command: run /tests/test2_spec.js
    ports:
       - "6566:6566"
Jay
  • 339
  • 1
  • 7
  • 23

1 Answers1

0

You will have two separate containers, and the tests will be able to run in parallel. They will use the normal Linux kernel scheduling mechanisms and won't necessarily have "their own processors"; this setup would work fine, and you would have parallel execution, even if you only had a single physical core.

This having been said, a more typical approach that would be called "parallel testing" is to have a single test runner that's able to run multiple tests in parallel on its own. Many unit-test systems have a "parallel test" option that runs tests on multiple threads, for example. Since k6 is more of a load-testing tool, it is able to launch multiple concurrent HTTP requests, without the sort of manual setup you show; Load testing and Stress testing in the k6 documentation describe some typical setups.

David Maze
  • 130,717
  • 29
  • 175
  • 215