Skip to contentমূল লেখায় যান

Topic 05 · K6টপিক 05 · K6

Install k6 and Run Your First Script

Install k6, run a small script, and read the first output.

4 min read4 মিনিটে পড়া যায় · 5 sections5টি সেকশন · 5 sources5টি সোর্স · updated Nov 2026আপডেট: Nov 2026

From install to first summaryইনস্টল থেকে প্রথম summary পর্যন্ত

Run a 10-iteration script and watch iterations, sleeps and the summary lines add up.১০ iteration-এর একটা স্ক্রিপ্ট চালান আর দেখুন iteration, sleep আর summary-র লাইনগুলো কীভাবে মেলে।

2 min2 মিনিট8 steps8টি ধাপ
  • iterationsiterations (রান)0 / 10
  • http_reqshttp_reqs (অনুরোধ)0
$ k6 version$ k6 versionk6k6one VUএকটা VUk6 v<version>k6 v<version>QuickPizzaQuickPizzademo siteডেমো সাইটiterations · 0 / 10iterations · 0 / 10

You’ll learnআপনি শিখবেন

  • How to check that k6 is installedk6 ইনস্টল হয়েছে কীভাবে দেখবেন✓
  • What an iteration isiteration কী
  • Why http_reqs equals 10http_reqs কেন 10
  • How to run a script with DockerDocker দিয়ে স্ক্রিপ্ট কীভাবে চালাবেন
  • Why iteration_duration is longeriteration_duration কেন বেশি

Install k6

You can install k6 from a package on Linux, Mac, or Windows. A Docker image and a standalone binary also work Source 1সোর্স 1. Use the commands for your system.

Windows. Two package managers work. The choco package is unofficial. The winget packages are official, and the community made their manifests Source 1সোর্স 1.

winget install k6 --source winget
choco install k6

You can also download and run the official MSI installer Source 1সোর্স 1. Use the link on the install page of the docs, so you always get the latest version.

macOS. Use Homebrew Source 1সোর্স 1:

brew install k6

Linux (Debian or Ubuntu). Add the k6 signing key and the package repository. Then install Source 1সোর্স 1:

curl -fsSL https://dl.k6.io/key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/k6-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
sudo apt-get update
sudo apt-get install k6

Linux (Fedora or CentOS). Use dnf Source 1সোর্স 1:

sudo dnf install https://dl.k6.io/rpm/repo.rpm
sudo dnf install k6

Docker. Pull the image Source 1সোর্স 1:

docker pull grafana/k6

The standalone binary is on the GitHub Releases page. Put the k6 or k6.exe file in your PATH Source 1সোর্স 1. The commands can change, so the install page of the docs is the place to check Source 1সোর্স 1.

After the install, check that k6 works. This is the tutorial's own tip. The output below is an example, and your version number will differ:

$ k6 version
k6 v<version> (commit/<hash>, go<version>, <os>/<arch>)

সহজ English

k6 installs from a package on Linux, Mac, or Windows. A Docker image and a standalone binary also work Source 1সোর্স 1. Use the commands for your system.

On Windows, you can use winget or choco. The choco package is unofficial. The winget packages are official, and the community made their manifests Source 1সোর্স 1. You can also run the official MSI installer Source 1সোর্স 1. Use the link on the install page of the docs.

On macOS, use Homebrew with brew install k6 Source 1সোর্স 1. On Debian or Ubuntu, you add the k6 signing key and the package repository. Then you run apt-get install k6 Source 1সোর্স 1. On Fedora or CentOS, you use dnf Source 1সোর্স 1. With Docker, you pull the grafana/k6 image Source 1সোর্স 1.

The standalone binary is on the GitHub Releases page. Put it in your PATH Source 1সোর্স 1. The commands can change, so check the install page of the docs Source 1সোর্স 1.

After the install, run k6 version. This is the tutorial's own tip. It shows the version that you installed.

বাংলা ব্যাখ্যা

k6 Linux, Mac আর Windows-এ চলে। আপনি Docker image বা standalone binary-ও ব্যবহার করতে পারেন Source 1সোর্স 1। নিজের সিস্টেমের কমান্ড ব্যবহার করুন।

Windows-এ winget বা choco দিয়ে ইনস্টল করা যায়। choco প্যাকেজ unofficial। winget প্যাকেজ official, আর কমিউনিটি এর manifest বানিয়েছে Source 1সোর্স 1। চাইলে official MSI installer চালাতে পারেন Source 1সোর্স 1। সবসময় latest ভার্সন পেতে docs-এর install পেজের লিংক ব্যবহার করুন।

macOS-এ Homebrew দিয়ে brew install k6 চালান Source 1সোর্স 1। Debian বা Ubuntu-তে k6-এর signing key আর package repository যোগ করতে হয়। তারপর apt-get install k6 চালান Source 1সোর্স 1। Fedora বা CentOS-এ dnf ব্যবহার করুন Source 1সোর্স 1। Docker-এ grafana/k6 image pull করুন Source 1সোর্স 1।

Standalone binary GitHub Releases পেজে আছে। এটা আপনার PATH-এ রাখুন Source 1সোর্স 1। কমান্ড বদলাতে পারে, তাই docs-এর install পেজ দেখে নিন Source 1সোর্স 1।

ইনস্টলের পর k6 version চালান। এটা টিউটোরিয়ালের নিজের পরামর্শ। এতে আপনার ইনস্টল করা ভার্সন দেখা যায়।

Write your first script

Save this script as first-script.js. It sends 10 GET requests to the QuickPizza demo site of Grafana. It waits 1 second after each request.

// first-script.js
import http from 'k6/http';
import { sleep } from 'k6';

// Run the default function 10 times in total.
export const options = {
  iterations: 10,
};

// k6 calls this function again and again. Each call is one iteration.
export default function () {
  http.get('https://quickpizza.grafana.com');
  // Pause for 1 second, like a real user who reads the page.
  sleep(1);
}

The default function is the entry point of the test. k6 runs it once for each iteration Source 4সোর্স 4. The iterations option sets the total number of runs of the default function in the test Source 5সোর্স 5. The counter metric iterations counts these runs Source 4সোর্স 4.

The site quickpizza.grafana.com is the tutorial's own choice for this first script. The k6 docs use the same site in their examples Source 2সোর্স 2. Run load tests only against a system that you own or have permission to test. Keep this script small. It sends 10 requests, one at a time.

সহজ English

Save this script as first-script.js. It sends 10 GET requests to the QuickPizza demo site of Grafana. It waits 1 second after each request.

// first-script.js
import http from 'k6/http';
import { sleep } from 'k6';

// Run the default function 10 times in total.
export const options = {
  iterations: 10,
};

// k6 calls this function again and again. Each call is one iteration.
export default function () {
  http.get('https://quickpizza.grafana.com');
  // Pause for 1 second, like a real user who reads the page.
  sleep(1);
}

The default function is the entry point of the test. k6 runs it once for each iteration Source 4সোর্স 4. The iterations option sets the total number of runs in the test Source 5সোর্স 5. The metric iterations counts these runs Source 4সোর্স 4.

quickpizza.grafana.com is the tutorial's own choice for this first script. The k6 docs use the same site in their examples Source 2সোর্স 2. Test only a system that you own or have permission to test. This script is small. It sends 10 requests, one at a time.

বাংলা ব্যাখ্যা

এই স্ক্রিপ্টটা first-script.js নামে সেভ করুন। এটা Grafana-র QuickPizza ডেমো সাইটে ১০টা GET request পাঠায়। প্রতিটা request-এর পরে ১ সেকেন্ড অপেক্ষা করে।

// first-script.js
import http from 'k6/http';
import { sleep } from 'k6';

// Run the default function 10 times in total.
export const options = {
  iterations: 10,
};

// k6 calls this function again and again. Each call is one iteration.
export default function () {
  http.get('https://quickpizza.grafana.com');
  // Pause for 1 second, like a real user who reads the page.
  sleep(1);
}

default function হলো টেস্টের entry point। k6 প্রতিটা iteration-এ এটা একবার চালায় Source 4সোর্স 4। iterations option টেস্টে মোট কতবার এটা চলবে তা ঠিক করে Source 5সোর্স 5। iterations মেট্রিক এই রান গুনে রাখে Source 4সোর্স 4।

quickpizza.grafana.com এই প্রথম স্ক্রিপ্টের জন্য টিউটোরিয়ালের নিজের পছন্দ। k6 docs তাদের উদাহরণে একই সাইট ব্যবহার করে Source 2সোর্স 2। শুধু সেই সিস্টেমে টেস্ট করুন, যেটা আপনার নিজের বা যেটা টেস্ট করার অনুমতি আছে। এই স্ক্রিপ্ট ছোট। এটা একটা একটা করে ১০টা request পাঠায়।

Run the script

Open a terminal in the folder of the file. Run Source 2সোর্স 2:

k6 run first-script.js

With the Docker image, the script file is not inside the container. Tell k6 to read the script from stdin. Use - as the file name Source 2সোর্স 2:

docker run --rm -i grafana/k6 run - <first-script.js

When the test ends, k6 prints a summary of the results to stdout Source 3সোর্স 3.

সহজ English

Open a terminal in the folder of the file. Run k6 run first-script.js Source 2সোর্স 2.

With the Docker image, the script file is not inside the container. So you tell k6 to read the script from stdin. You use - as the file name Source 2সোর্স 2:

docker run --rm -i grafana/k6 run - <first-script.js

When the test ends, k6 prints a summary of the results Source 3সোর্স 3.

বাংলা ব্যাখ্যা

ফাইলের ফোল্ডারে একটা টার্মিনাল খুলুন। k6 run first-script.js চালান Source 2সোর্স 2।

Docker image ব্যবহার করলে script ফাইল container-এর ভেতরে থাকে না। তাই k6-কে stdin থেকে script পড়তে বলুন। ফাইলের নামের জায়গায় - দিন Source 2সোর্স 2:

docker run --rm -i grafana/k6 run - <first-script.js

টেস্ট শেষ হলে k6 ফলাফলের একটা summary প্রিন্ট করে Source 3সোর্স 3।

Read the output

This is a short real output of the script above. It is one run with k6 v2.3.0, with the lines above the summary cut out. Your numbers will differ, because they depend on your network and on the server.

  █ TOTAL RESULTS

    HTTP
    http_req_duration..............: avg=645.49ms min=315.15ms med=363.83ms max=1.87s p(90)=1.75s p(95)=1.81s
    http_req_failed................: 0.00%  0 out of 10
    http_reqs......................: 10     0.425111/s

    EXECUTION
    iteration_duration.............: avg=2.35s    min=1.31s    med=1.36s    max=8.47s p(90)=3.43s p(95)=5.95s
    iterations.....................: 10     0.425111/s
    vus............................: 1      min=1       max=1
    vus_max........................: 1      min=1       max=1

    NETWORK
    data_received..................: 37 kB  1.6 kB/s
    data_sent......................: 2.3 kB 97 B/s

The summary groups the metrics by source: HTTP (protocol) metrics, execution metrics, and network metrics Source 3সোর্স 3. By default, k6 prints a compact summary with the most important metrics Source 3সোর্স 3.

MetricMeaning
http_reqsThe total number of HTTP requests that k6 made Source 4সোর্স 4.
http_req_failedThe rate of failed requests Source 4সোর্স 4. Here it is 0 out of 10.
http_req_durationThe total time of a request: sending, waiting, and receiving. It does not include the DNS lookup and the connection time Source 4সোর্স 4.
iterationsHow many times the VUs ran the default function Source 4সোর্স 4. Here it is 10.
iteration_durationThe time of one full iteration Source 4সোর্স 4. It is longer than http_req_duration, because the 1 second of sleep is part of the iteration.
vus, vus_maxThe current number of active VUs, and the maximum number Source 4সোর্স 4. Here the run used 1 VU.
data_sent, data_receivedThe amount of data that k6 sent and received Source 4সোর্স 4.

Reading the gap. In this run, the average iteration_duration (2.35 s) is about 1.7 s more than the average http_req_duration (645 ms). One second of the gap is the sleep. This output does not show where the rest comes from. The tutorial's own view: do not read one run of 10 requests as a performance result. It only proves that the script and the tools work.

The first run. The owner's own first run is below. It is an older run, and the layout of the summary can differ between k6 versions.

Terminal screenshot of the end-of-test summary of the first k6 run: lines for data_received, data_sent, http_req_duration, http_reqs, iteration_duration, iterations, and vus.Open the image in full sizeছবিটি পূর্ণ আকারে খুলুন

সহজ English

This is a short real output of the script above. It is one run with k6 v2.3.0, with the lines above the summary cut out. Your numbers will differ. They depend on your network and on the server.

  █ TOTAL RESULTS

    HTTP
    http_req_duration..............: avg=645.49ms min=315.15ms med=363.83ms max=1.87s p(90)=1.75s p(95)=1.81s
    http_req_failed................: 0.00%  0 out of 10
    http_reqs......................: 10     0.425111/s

    EXECUTION
    iteration_duration.............: avg=2.35s    min=1.31s    med=1.36s    max=8.47s p(90)=3.43s p(95)=5.95s
    iterations.....................: 10     0.425111/s
    vus............................: 1      min=1       max=1
    vus_max........................: 1      min=1       max=1

    NETWORK
    data_received..................: 37 kB  1.6 kB/s
    data_sent......................: 2.3 kB 97 B/s

The summary groups the metrics by source: HTTP, execution, and network Source 3সোর্স 3. By default, k6 prints a compact summary with the most important metrics Source 3সোর্স 3.

The tutorial's own view: do not read one run of 10 requests as a performance result. It only proves that the script and the tools work.

The owner's own first run is below. It is an older run, and the layout of the summary can differ between k6 versions.

Terminal screenshot of the end-of-test summary of the first k6 run: lines for data_received, data_sent, http_req_duration, http_reqs, iteration_duration, iterations, and vus.Open the image in full sizeছবিটি পূর্ণ আকারে খুলুন

বাংলা ব্যাখ্যা

এটা উপরের স্ক্রিপ্টের একটা ছোট real output। এটা k6 v2.3.0-এর একটা রান, summary-র ওপরের লাইনগুলো বাদ দেওয়া হয়েছে। আপনার সংখ্যা আলাদা হবে, কারণ এটা আপনার নেটওয়ার্ক আর সার্ভারের ওপর নির্ভর করে।

  █ TOTAL RESULTS

    HTTP
    http_req_duration..............: avg=645.49ms min=315.15ms med=363.83ms max=1.87s p(90)=1.75s p(95)=1.81s
    http_req_failed................: 0.00%  0 out of 10
    http_reqs......................: 10     0.425111/s

    EXECUTION
    iteration_duration.............: avg=2.35s    min=1.31s    med=1.36s    max=8.47s p(90)=3.43s p(95)=5.95s
    iterations.....................: 10     0.425111/s
    vus............................: 1      min=1       max=1
    vus_max........................: 1      min=1       max=1

    NETWORK
    data_received..................: 37 kB  1.6 kB/s
    data_sent......................: 2.3 kB 97 B/s

Summary মেট্রিকগুলোকে source অনুযায়ী ভাগ করে: HTTP, execution আর network Source 3সোর্স 3। ডিফল্টে k6 সবচেয়ে গুরুত্বপূর্ণ মেট্রিক নিয়ে একটা compact summary প্রিন্ট করে Source 3সোর্স 3।

  • http_reqs হলো k6 কতগুলো HTTP request করেছে তার সংখ্যা Source 4সোর্স 4।
  • http_req_failed হলো ব্যর্থ request-এর rate Source 4সোর্স 4। এখানে এটা ১০-এর মধ্যে ০।
  • http_req_duration হলো একটা request-এর সময়: sending, waiting আর receiving। এতে DNS lookup আর connection-এর সময় ধরা হয় না Source 4সোর্স 4।
  • iterations হলো VU-রা কতবার default function চালিয়েছে Source 4সোর্স 4। এখানে ১০।
  • iteration_duration হলো একটা পুরো iteration-এর সময় Source 4সোর্স 4। এটা http_req_duration-এর চেয়ে বেশি, কারণ ১ সেকেন্ডের sleep এর অংশ।
  • vus আর vus_max হলো এখনকার আর সর্বোচ্চ VU-র সংখ্যা Source 4সোর্স 4। এখানে রানে ১টা VU ছিল।
  • data_sent আর data_received হলো k6 কত ডেটা পাঠিয়েছে আর পেয়েছে তার পরিমাণ Source 4সোর্স 4।

টিউটোরিয়ালের নিজের মত: ১০টা request-এর একটা রানকে performance-এর ফলাফল ধরবেন না। এটা শুধু প্রমাণ করে যে স্ক্রিপ্ট আর টুল কাজ করছে।

নিচে owner-এর নিজের প্রথম রান। এটা একটা পুরোনো রান, আর k6-এর ভার্সন অনুযায়ী summary-র layout আলাদা হতে পারে।

Terminal screenshot of the end-of-test summary of the first k6 run: lines for data_received, data_sent, http_req_duration, http_reqs, iteration_duration, iterations, and vus.Open the image in full sizeছবিটি পূর্ণ আকারে খুলুন

Key words

TermMeaning
k6 runThe command that runs a k6 script.
IterationOne run of the default function.
iterationsThe option that sets the total number of runs. It is also a counter metric.
VUA virtual user. It runs the script in a loop.
sleep()A pause inside the script. It simulates the think time of a user.
End-of-test summaryThe result table that k6 prints to stdout when the test ends.
http_req_durationThe time of an HTTP request: sending, waiting, and receiving.
http_req_failedThe rate of failed HTTP requests.
stdinThe input stream. k6 run - reads the script from it.
  1. [1]
    Install k6

    Grafana k6 documentation · accessed 2026-10-27দেখা হয়েছে: 2026-10-27

  2. [2]
    Running k6

    Grafana k6 documentation · accessed 2026-10-27দেখা হয়েছে: 2026-10-27

  3. [3]
    End-of-test summary

    Grafana k6 documentation · accessed 2026-10-27দেখা হয়েছে: 2026-10-27

  4. [4]
    Built-in metrics

    Grafana k6 documentation · accessed 2026-10-27দেখা হয়েছে: 2026-10-27

  5. [5]
    Options

    Grafana k6 documentation · accessed 2026-10-27দেখা হয়েছে: 2026-10-27