Reports and the Web Dashboard
The terminal summary is enough for a quick look, but a team often needs a file or a page to share. k6 can write the summary as JSON or text, show a live web dashboard, save an HTML report, and dump every raw data point.
12 min read12 মিনিটে পড়া যায় · 9 sections9টি সেকশন · 7 sources7টি সোর্স · updated Nov 2026আপডেট: Nov 2026
One run, four ways outএকটা run, চারটা বের হওয়ার পথ
Follow one finished run into handleSummary, the web dashboard, raw JSON/CSV and summary-export.একটা শেষ হওয়া run অনুসরণ করুন: handleSummary, web dashboard, raw JSON/CSV আর summary-export-এ।
You’ll learnআপনি শিখবেন
- What handleSummary returnshandleSummary কী ফেরত দেয়
- Why the default summary disappearsdefault summary কেন হারায়
- The 3 x period rule for the reportreport-এর ৩ গুণ period-এর নিয়ম
- Why raw files get largeraw ফাইল কেন বড় হয়
Pick the right output
k6 gives you 4 ways to get results out of a run. Each one answers a different need.
| You want | Use | Output |
|---|---|---|
| A custom summary: JSON, text, XML, HTML | handleSummary(data) Source 1সোর্স 1 | Any file, stdout, or stderr |
| A live view and a shareable report | The web dashboard Source 2সোর্স 2 | A browser page and an HTML file |
| Every raw data point | --out json=… or --out csv=… Source 4সোর্স 4 Source 5সোর্স 5 | A JSON or CSV file |
| The summary as one JSON file, from the command line | --summary-export Source 6সোর্স 6 | A JSON file |
The next sections show each one. The tutorial's own view: start with handleSummary() and the dashboard. Use the raw files only when you need to analyze each request.
সহজ English
k6 has 4 ways to get results out of a run. Each one is for a different need.
Use handleSummary(data) when you want a summary as JSON, text, XML, or HTML Source 1সোর্স 1. Use the web dashboard when you want a live view and a report you can share Source 2সোর্স 2. Use --out json=… or --out csv=… when you want every raw data point Source 4সোর্স 4 Source 5সোর্স 5. Use --summary-export when you want the summary as one JSON file from the command line Source 6সোর্স 6.
The tutorial's own view: start with handleSummary() and the dashboard. Use the raw files only when you need to look at each request.
বাংলা ব্যাখ্যা
k6 থেকে run-এর ফল বের করার ৪টা উপায় আছে। প্রতিটা আলাদা প্রয়োজনের জন্য।
JSON, text, XML বা HTML summary চাইলে handleSummary(data) ব্যবহার করুন Source 1সোর্স 1। live view আর শেয়ার করার মতো report চাইলে web dashboard ব্যবহার করুন Source 2সোর্স 2। প্রতিটা raw data point চাইলে --out json=… অথবা --out csv=… ব্যবহার করুন Source 4সোর্স 4 Source 5সোর্স 5। command line থেকে summary একটা JSON ফাইলে চাইলে --summary-export ব্যবহার করুন Source 6সোর্স 6।
টিউটোরিয়ালের নিজস্ব মত: handleSummary() আর dashboard দিয়ে শুরু করুন। প্রতিটা request আলাদা করে দেখতে হলেই কেবল raw ফাইল ব্যবহার করুন।
Write your own summary with handleSummary
The function. After the test, k6 collects the metrics into one JavaScript object. It passes this object to your handleSummary() function. The function is optional. If you do not export it, k6 prints its default summary. k6 calls it at the end of the test lifecycle Source 1সোর্স 1.
Return value. The function returns a map. Each key says where to put the content. A key is stdout, stderr, or a path to a file. k6 overwrites a file that already exists. Each value is a string or an ArrayBuffer Source 1সোর্স 1. One return can have several keys Source 1সোর্স 1.
Default summary. If your script exports handleSummary(), k6 does not print its default summary Source 1সোর্স 1. To keep a text summary, use textSummary, which the k6 JS utilities library exports Source 1সোর্স 1. The version in the k6 docs is 0.0.2 Source 1সোর্স 1. The k6 docs say that these helpers can change, so check jslib.k6.io for the latest Source 1সোর্স 1.
import http from 'k6/http';
import { textSummary } from 'https://jslib.k6.io/k6-summary/0.0.2/index.js';
export const options = { vus: 2, duration: '5s' };
export default function () {
http.get('https://quickpizza.grafana.com/');
}
export function handleSummary(data) {
return {
stdout: textSummary(data, { indent: ' ', enableColors: false }),
'summary.json': JSON.stringify(data),
};
}textSummary has 2 options: indent and enableColors Source 1সোর্স 1. This script prints the text summary and writes all the data to summary.json.
The output below is one short run of this script on the tutorial's machine. Your numbers will differ.
http_req_duration..............: avg=340.19ms min=311.2ms med=338.64ms max=376.46ms p(90)=362.48ms p(95)=371.71ms
{ expected_response:true }...: avg=340.19ms min=311.2ms med=338.64ms max=376.46ms p(90)=362.48ms p(95)=371.71ms
http_req_failed................: 0.00% ✓ 0 ✗ 26
http_reqs......................: 26 5.081088/s
iterations.....................: 26 5.081088/s
vus............................: 2 min=2 max=2সহজ English
After the test, k6 puts all the results into one object. It hands this object to a function called handleSummary() Source 1সোর্স 1. You write this function yourself. It is optional. If you do not write it, k6 prints its default summary. k6 calls it at the end of the test Source 1সোর্স 1.
The function returns a map. A map is a set of keys, each with a value. Each key says where the content goes. A key can be stdout, stderr, or a file path. k6 overwrites a file that already exists. Each value is a string or an ArrayBuffer. An ArrayBuffer is a block of raw data Source 1সোর্স 1. One return can have many keys Source 1সোর্স 1.
If your script has handleSummary(), k6 does not print its default summary Source 1সোর্স 1. To keep a text summary, use textSummary. It comes from the k6 JS utilities library Source 1সোর্স 1. The docs use version 0.0.2. The docs say these helpers can change. Check jslib.k6.io for the latest Source 1সোর্স 1.
The script in the Technical text prints the text summary. It also writes all the data to summary.json. textSummary has 2 options: indent and enableColors Source 1সোর্স 1.
The output in the Technical text is one short run on the tutorial's machine. Your numbers will differ.
বাংলা ব্যাখ্যা
টেস্টের পর k6 সব metric একটা JavaScript object-এ রাখে। এই object আপনার handleSummary() function-কে দেয় Source 1সোর্স 1। এই function আপনি লেখেন। এটা optional; না লিখলে k6 তার default summary ছাপে। k6 test lifecycle-এর শেষে এটা call করে Source 1সোর্স 1।
function একটা map return করে। প্রতিটা key বলে content কোথায় যাবে: stdout, stderr, অথবা একটা ফাইলের path। ফাইল আগে থেকে থাকলে k6 সেটা overwrite করে। প্রতিটা value একটা string অথবা ArrayBuffer Source 1সোর্স 1। একটা return-এ অনেক key থাকতে পারে Source 1সোর্স 1।
আপনার script handleSummary() export করলে k6 তার default summary ছাপে না Source 1সোর্স 1। text summary রাখতে textSummary ব্যবহার করুন, যা k6 JS utilities library export করে Source 1সোর্স 1। docs-এ ব্যবহৃত version 0.0.2। k6 docs বলে এই helper বদলাতে পারে, তাই সর্বশেষটা jslib.k6.io-তে দেখে নিন Source 1সোর্স 1।
Technical লেখার script text summary ছাপে এবং সব data summary.json ফাইলে লেখে। textSummary-র ২টা option আছে: indent আর enableColors Source 1সোর্স 1।
Technical লেখার output টিউটোরিয়ালের মেশিনে একটা ছোট run-এর ফল। আপনার সংখ্যা আলাদা হবে।
Reading the Metrics Data
The metrics object. All metrics are in the top-level metrics object of data. For example, data.metrics.http_req_duration is the object of that metric Source 1সোর্স 1. Each metric has a type, a contains, and a values object. A metric with a threshold also has thresholds, and each threshold has an ok flag Source 1সোর্স 1. The keys inside values for a Trend follow the summaryTrendStats option Source 1সোর্স 1.
The summary format. In the same run, summary.json had the top-level keys root_group, options, state, and metrics. The docs describe a newer machine-readable format. k6 v1.5.0 added it Source 1সোর্স 1. You turn it on with the --new-machine-readable-summary flag Source 1সোর্স 1. The docs say it will become the default in k6 v2 Source 1সোর্স 1. In k6 v2.3.0, a 2 VU, 5 second handleSummary test against QuickPizza gave the keys root_group, options, state, and metrics in the JSON file, with or without the flag. The docs say the new format will become the default in v2, but I did not see a difference here. k6 also adds setup_data when the script has a setup() function. A 2 VU, 5 second variant with setup() showed it. These are observed results, not from a source. So print the file once with your k6 version before you write code that reads it.
Other formats. You are not limited to JSON. The handleSummary() function can turn the data into JSON, HTML, console text, or XML. It can also send the data to a remote server Source 1সোর্স 1. For example, the jUnit helper of the same library makes a JUnit XML file that says if the thresholds failed Source 1সোর্স 1.
See it in a real project
In the owner's k6-performance-testing repository, handleSummary() builds Markdown tables for each API and each time window and saves them as a .md file. It saves the summary data as a .json file. It removes setup_data from the JSON file, because that data holds the login tokens. The repository also uses a third-party HTML reporter that this tutorial does not teach. This is the tutorial's own example project, not an official source.
সহজ English
All the metrics are in the metrics object inside data. For example, data.metrics.http_req_duration holds that metric Source 1সোর্স 1. Each metric has three parts: type, contains, and values. A metric with a threshold also has thresholds. A threshold is a pass or fail limit. Each one has an ok flag Source 1সোর্স 1. Some metrics are of the Trend kind. For these, the keys in values follow the summaryTrendStats option Source 1সোর্স 1.
In the same run, summary.json had the keys root_group, options, state, and metrics. The docs describe a newer format that machines can read. k6 v1.5.0 added it. You turn it on with the --new-machine-readable-summary flag Source 1সোর্স 1. The docs say it will become the default in k6 v2 Source 1সোর্স 1.
In k6 v2.3.0, a test of 2 VU and 5 seconds against QuickPizza gave these keys in the JSON file, with or without the flag: root_group, options, state, and metrics. The docs say the new format will become the default in v2, but I did not see a difference here. A VU is a virtual user. k6 also adds setup_data when the script has a setup() function. A variant of the same test with setup() showed it. These are observed results, not from a source. So print the file once with your k6 version before you write code that reads it.
You can make more than JSON. handleSummary() can make JSON, HTML, console text, or XML. It can also send the data to a remote server Source 1সোর্স 1. The jUnit helper of the same library makes a JUnit XML file. That file says if the thresholds failed Source 1সোর্স 1.
See it in a real project
In the owner's k6-performance-testing repository, handleSummary() builds Markdown tables for each API and each time window. It saves them as a .md file. It saves the summary data as a .json file. It removes setup_data from the JSON file, because that data holds the login tokens. The repository also uses a third-party HTML reporter. This tutorial does not teach it. This is the tutorial's own example project. It is not an official source.
বাংলা ব্যাখ্যা
সব metric data-র metrics object-এ থাকে। যেমন data.metrics.http_req_duration ওই metric-এর object Source 1সোর্স 1। প্রতিটা metric-এর একটা type, একটা contains, আর একটা values object আছে। threshold থাকলে metric-এ thresholds-ও থাকে। প্রতিটা threshold-এ একটা ok flag আছে Source 1সোর্স 1। Trend-এর values-এর key summaryTrendStats option অনুযায়ী বদলায় Source 1সোর্স 1।
একই run-এ summary.json-এর key ছিল root_group, options, state আর metrics। docs একটা নতুন machine-readable format-এর কথা বলে। k6 v1.5.0 এটা যোগ করেছে। --new-machine-readable-summary flag দিয়ে এটা চালু করতে হয় Source 1সোর্স 1। docs বলে এটা k6 v2-তে default হবে Source 1সোর্স 1। k6 v2.3.0-এ QuickPizza-র বিরুদ্ধে ২ VU, ৫ সেকেন্ডের একটা handleSummary টেস্টে flag দিয়ে বা ছাড়া, দুই ক্ষেত্রেই JSON ফাইলে key ছিল root_group, options, state আর metrics। docs বলে নতুন format v2-তে default হবে, কিন্তু এখানে আমি কোনো পার্থক্য দেখিনি। script-এ setup() function থাকলে k6 setup_data-ও যোগ করে: setup()-সহ ২ VU, ৫ সেকেন্ডের একটা variant-এ এটা দেখা গেছে। এগুলো পর্যবেক্ষণ করা ফল, কোনো source থেকে নয়। তাই ফাইল পড়ার code লেখার আগে আপনার k6 version-এ ফাইলটা একবার ছাপিয়ে দেখুন।
শুধু JSON নয়, আরও বানানো যায়। handleSummary() JSON, HTML, console text বা XML বানাতে পারে। এটা data একটা remote server-এও পাঠাতে পারে Source 1সোর্স 1। একই library-র jUnit helper একটা JUnit XML ফাইল বানায়, যেটা বলে threshold fail করেছে কি না Source 1সোর্স 1।
বাস্তব প্রজেক্টে দেখুন
মালিকের k6-performance-testing repository-তে handleSummary() প্রতিটা API আর প্রতিটা time window-এর জন্য Markdown টেবিল বানায় আর সেগুলো একটা .md ফাইলে সেভ করে। summary data সেভ করে একটা .json ফাইলে। JSON ফাইল থেকে এটা setup_data সরিয়ে দেয়, কারণ ওই ডেটায় login token থাকে। repository-টা একটা third-party HTML reporter-ও ব্যবহার করে, যেটা এই টিউটোরিয়াল শেখায় না। এটা টিউটোরিয়ালের নিজের উদাহরণ প্রজেক্ট, অফিশিয়াল সোর্স নয়।
Use the built-in web dashboard
k6 has a built-in web dashboard. It shows the results in real time while the test runs Source 2সোর্স 2. Since k6 v2.0.0, the dashboard code is part of the k6 binary, so you do not install an extension Source 7সোর্স 7. Set the variable K6_WEB_DASHBOARD to true Source 2সোর্স 2:
K6_WEB_DASHBOARD=true k6 run script.jsk6 prints the address of the dashboard in its header. The default is localhost, port 5665 Source 2সোর্স 2. In the check run of this page, k6 v2.3.0 printed this line:
web dashboard: http://127.0.0.1:5665
output: -Open the address in a browser while the test runs. You can set the dashboard with these environment variables Source 2সোর্স 2:
| Variable | Meaning | Default |
|---|---|---|
K6_WEB_DASHBOARD | Turns the dashboard on | false |
K6_WEB_DASHBOARD_HOST | The host to bind to | localhost |
K6_WEB_DASHBOARD_PORT | The port to bind to | 5665 |
K6_WEB_DASHBOARD_PERIOD | How often the dashboard updates | 10s |
K6_WEB_DASHBOARD_OPEN | Opens the dashboard in the default browser | false |
K6_WEB_DASHBOARD_EXPORT | The file name for an HTML report at the end of the run | empty (no report) |
The k6 process waits to exit while a browser window for the dashboard is open Source 2সোর্স 2. This is a problem in a CI pipeline. There, the docs advise you to set the port to -1, which turns off the HTTP port Source 2সোর্স 2.
সহজ English
k6 has a built-in web dashboard. It shows the results live while the test runs Source 2সোর্স 2. Since k6 v2.0.0, the dashboard is part of the k6 binary. You do not install an extension Source 7সোর্স 7. Set the variable K6_WEB_DASHBOARD to true Source 2সোর্স 2. The Technical text shows the command.
k6 prints the dashboard address in its header. The default is localhost, port 5665 Source 2সোর্স 2. Open that address in a browser while the test runs.
You can change the dashboard with environment variables Source 2সোর্স 2. K6_WEB_DASHBOARD_HOST and K6_WEB_DASHBOARD_PORT set the address. K6_WEB_DASHBOARD_PERIOD sets how often the page updates. The default is 10s. K6_WEB_DASHBOARD_OPEN opens the page in your default browser. K6_WEB_DASHBOARD_EXPORT sets a file name for an HTML report at the end of the run.
The k6 process waits to exit while a browser window for the dashboard is open Source 2সোর্স 2. This is a problem in a CI pipeline. There, the docs advise you to set the port to -1. This turns off the HTTP port Source 2সোর্স 2.
বাংলা ব্যাখ্যা
k6-এ একটা built-in web dashboard আছে। টেস্ট চলার সময় এটা ফল live দেখায় Source 2সোর্স 2। k6 v2.0.0 থেকে dashboard k6 binary-র অংশ, তাই কোনো extension install করতে হয় না Source 7সোর্স 7। K6_WEB_DASHBOARD variable-কে true করুন Source 2সোর্স 2। command-টা Technical লেখায় আছে।
k6 তার header-এ dashboard-এর address ছাপে। default হলো localhost, port 5665 Source 2সোর্স 2। টেস্ট চলার সময় ওই address একটা browser-এ খুলুন।
environment variable দিয়ে dashboard বদলানো যায় Source 2সোর্স 2। K6_WEB_DASHBOARD_HOST আর K6_WEB_DASHBOARD_PORT address ঠিক করে। K6_WEB_DASHBOARD_PERIOD ঠিক করে পেজ কত পরপর update হবে। default 10s। K6_WEB_DASHBOARD_OPEN পেজটা আপনার default browser-এ খোলে। K6_WEB_DASHBOARD_EXPORT run-এর শেষে HTML report-এর ফাইলের নাম ঠিক করে।
dashboard-এর একটা browser window খোলা থাকলে k6 process বের হওয়ার জন্য অপেক্ষা করে Source 2সোর্স 2। CI pipeline-এ এটা সমস্যা। সেখানে docs port -1 করতে বলে। এতে HTTP port বন্ধ হয় Source 2সোর্স 2।
Save the dashboard as an HTML report
The dashboard can give you a report that is one self-contained HTML file. You share it with your team Source 2সোর্স 2. There are 2 ways to get it Source 2সোর্স 2:
- In the dashboard, click Report in the menu.
- From the command line, set
K6_WEB_DASHBOARD_EXPORT. k6 writes the file when the test ends.
K6_WEB_DASHBOARD=true K6_WEB_DASHBOARD_EXPORT=html-report.html k6 run script.jsThere is a rule about the length of the test. The report has graphs only if the test lasts more than 3 times the aggregation period Source 2সোর্স 2. The period is K6_WEB_DASHBOARD_PERIOD, and its default is 10s Source 2সোর্স 2. So with the default, a test must run for more than 30 seconds.
This page checked the rule. A script with 2 VUs and duration: '10s' ran with the default period. k6 v2.3.0 printed a warning and wrote no file:
level=warning msg="The test run was short, report generation was skipped (not enough data)"The same script ran again with K6_WEB_DASHBOARD_PERIOD=1s. The 10 second test is then longer than 3 periods, and k6 wrote the HTML file:
K6_WEB_DASHBOARD=true \
K6_WEB_DASHBOARD_PERIOD=1s \
K6_WEB_DASHBOARD_EXPORT=html-report.html \
k6 run script.jsUse a short period only for short practice runs. For a real test, keep the default period and run the test long enough.
The tutorial's owner made an HTML report from handleSummary() with a community package that the script loaded from a URL. The built-in export needs no import from a URL, so this page teaches it instead.
সহজ English
The dashboard can give you a report. It is one self-contained HTML file. You share it with your team Source 2সোর্স 2. There are 2 ways to get it Source 2সোর্স 2:
- In the dashboard, click Report in the menu.
- From the command line, set
K6_WEB_DASHBOARD_EXPORT. k6 writes the file when the test ends.
The Technical text shows the command.
There is a rule about the length of the test. The report has graphs only if the test lasts more than 3 times the aggregation period Source 2সোর্স 2. The period is K6_WEB_DASHBOARD_PERIOD. Its default is 10s Source 2সোর্স 2. So with the default, a test must run for more than 30 seconds.
This page checked the rule. A script with 2 VUs ran for 10 seconds with the default period. k6 v2.3.0 printed a warning and wrote no file. The same script ran again with K6_WEB_DASHBOARD_PERIOD=1s. A 10 second test is then longer than 3 periods, and k6 wrote the HTML file.
Use a short period only for short practice runs. For a real test, keep the default period and run the test long enough.
The tutorial's owner made an HTML report from handleSummary() with a community package that the script loaded from a URL. The built-in export needs no import from a URL, so this page teaches it instead.
বাংলা ব্যাখ্যা
dashboard আপনাকে একটা report দিতে পারে। এটা একটাই self-contained HTML ফাইল। আপনি এটা টিমের সাথে শেয়ার করেন Source 2সোর্স 2। পাওয়ার ২টা উপায় আছে Source 2সোর্স 2:
- dashboard-এর menu-তে Report চাপুন।
- command line থেকে
K6_WEB_DASHBOARD_EXPORTসেট করুন। টেস্ট শেষ হলে k6 ফাইলটা লেখে।
command-টা Technical লেখায় আছে।
টেস্টের দৈর্ঘ্য নিয়ে একটা নিয়ম আছে। টেস্ট aggregation period-এর ৩ গুণের বেশি চললেই কেবল report-এ graph থাকে Source 2সোর্স 2। period হলো K6_WEB_DASHBOARD_PERIOD। এর default 10s Source 2সোর্স 2। তাই default থাকলে টেস্ট ৩০ সেকেন্ডের বেশি চালাতে হবে।
এই পেজ নিয়মটা পরীক্ষা করেছে। ২টা VU-র একটা script default period-এ ১০ সেকেন্ড চলেছে। k6 v2.3.0 একটা warning ছাপে এবং কোনো ফাইল লেখে না। একই script K6_WEB_DASHBOARD_PERIOD=1s দিয়ে আবার চালানো হয়। তখন ১০ সেকেন্ডের টেস্ট ৩ period-এর চেয়ে বড়, আর k6 HTML ফাইল লেখে।
ছোট period শুধু ছোট practice run-এ ব্যবহার করুন। আসল টেস্টে default period রাখুন এবং টেস্ট যথেষ্ট সময় চালান।
টিউটোরিয়ালের মালিক handleSummary() থেকে HTML report বানিয়েছিলেন একটা community package দিয়ে, যেটা script একটা URL থেকে লোড করত। built-in export-এ URL থেকে import লাগে না, তাই এই পেজ সেটাই শেখায়।
Save raw results to a file
The summary has only totals. To get every data point, use the --out flag. It writes each sample as k6 collects it.
k6 run --out json=test_results.json script.js
k6 run --out csv=test_results.csv script.jsA file name that ends in .gz gives a gzip file Source 4সোর্স 4 Source 5সোর্স 5. You can follow a file live with tail -f Source 4সোর্স 4 Source 5সোর্স 5.
The JSON file has one JSON object on each line. A Metric line says that a metric exists. A Point line is one sample Source 4সোর্স 4. A Point has a time, a value, and tags. Time values are in milliseconds Source 4সোর্স 4. The jq tool can filter the lines, for example by the metric name Source 4সোর্স 4.
The 2 lines below are from one short run of a script on the tutorial's machine, with some fields, the URL, and the tags shortened. Your lines will differ.
{"type":"Metric","data":{"name":"http_req_duration","type":"trend","contains":"time","thresholds":[]},"metric":"http_req_duration"}
{"metric":"http_req_duration","type":"Point","data":{"time":"2026-10-27T09:43:31+06:00","value":376.401122,"tags":{"method":"GET","status":"200","scenario":"default"}}}The CSV file has a header line. The columns start with metric_name, timestamp, and metric_value. They go on with the tags, such as check, error, group, method, status, and url Source 5সোর্স 5. If an error happens, the error and error_code fields have a value Source 5সোর্স 5.
These files get large, because they have one line for each sample. A long test with many VUs gives a big file. Use them to analyze requests one by one, not as a report to share.
সহজ English
The summary has only totals. To get every data point, use the --out flag. It writes each sample as k6 collects it. A sample is one measured data point. The Technical text shows both commands.
A file name that ends in .gz gives a compressed file Source 4সোর্স 4 Source 5সোর্স 5. You can follow a file live with tail -f Source 4সোর্স 4 Source 5সোর্স 5.
The JSON file has one JSON object on each line. There are two kinds of line:
- A
Metricline says that a metric exists Source 4সোর্স 4. - A
Pointline is one sample Source 4সোর্স 4.
A Point has a time, a value, and tags. Time values are in milliseconds Source 4সোর্স 4. The jq tool can filter the lines. For example, it can filter by the metric name Source 4সোর্স 4.
The CSV file has a header line. The first columns are metric_name, timestamp, and metric_value Source 5সোর্স 5. Then come the tags. Some examples are check, error, group, method, status, and url Source 5সোর্স 5. If an error happens, the error and error_code fields have a value Source 5সোর্স 5.
These files get large, because they have one line for each sample. A long test with many VUs gives a big file. A VU is a virtual user. Use the files to look at requests one by one. Do not use them as a report to share.
বাংলা ব্যাখ্যা
summary-তে শুধু মোট সংখ্যা থাকে। প্রতিটা data point পেতে --out flag ব্যবহার করুন। k6 যেমন sample সংগ্রহ করে, তেমন ফাইলে লেখে। দুটো command Technical লেখায় আছে।
ফাইলের নাম .gz দিয়ে শেষ হলে gzip ফাইল পাবেন Source 4সোর্স 4 Source 5সোর্স 5। tail -f দিয়ে ফাইলটা live অনুসরণ করা যায় Source 4সোর্স 4 Source 5সোর্স 5।
JSON ফাইলের প্রতিটা লাইনে একটা JSON object থাকে। Metric লাইন বলে একটা metric আছে। Point লাইন হলো একটা sample Source 4সোর্স 4। Point-এ time, value আর tags থাকে। সময়ের মান millisecond-এ Source 4সোর্স 4। jq tool দিয়ে লাইন ফিল্টার করা যায়, যেমন metric-এর নাম দিয়ে Source 4সোর্স 4।
CSV ফাইলে একটা header লাইন থাকে। column শুরু হয় metric_name, timestamp আর metric_value দিয়ে। তারপর আসে tag, যেমন check, error, group, method, status আর url Source 5সোর্স 5। error হলে error আর error_code field-এ মান থাকে Source 5সোর্স 5।
এই ফাইল বড় হয়, কারণ প্রতিটা sample-এর জন্য একটা লাইন থাকে। অনেক VU নিয়ে লম্বা টেস্টে ফাইল বিশাল হয়। এগুলো প্রতিটা request আলাদা করে দেখার জন্য ব্যবহার করুন, শেয়ার করার report হিসেবে নয়।
The older summary export
--summary-export saves the end-of-test summary to a JSON file. The environment variable is K6_SUMMARY_EXPORT Source 6সোর্স 6.
k6 run --summary-export export.json script.jsk6 v2.3.0 still has this flag. It is not deprecated, but the docs now discourage it. They say that handleSummary() gives a more flexible JSON export, and also other formats and full control of the summary Source 6সোর্স 6.
Know what v2.0.0 removed. The --no-summary flag is gone. Use --summary-mode=disabled instead Source 7সোর্স 7. The legacy summary mode is gone too. Use compact (the default) or full Source 7সোর্স 7 Source 3সোর্স 3. The disabled mode also turns off handleSummary() and --summary-export Source 6সোর্স 6. If a report is empty, check that you did not set this mode.
সহজ English
--summary-export saves the end-of-test summary to a JSON file. The environment variable is K6_SUMMARY_EXPORT Source 6সোর্স 6. The Technical text shows the command.
k6 v2.3.0 still has this flag. It is not deprecated, but the docs now discourage it. They say that handleSummary() gives a more flexible JSON export, and also other formats and full control of the summary Source 6সোর্স 6.
Know what v2.0.0 removed. The --no-summary flag is gone. Use --summary-mode=disabled instead Source 7সোর্স 7. The legacy summary mode is gone too. Use compact (the default) or full Source 7সোর্স 7 Source 3সোর্স 3. The disabled mode also turns off handleSummary() and --summary-export Source 6সোর্স 6. If a report is empty, check that you did not set this mode.
বাংলা ব্যাখ্যা
--summary-export end-of-test summary একটা JSON ফাইলে সেভ করে। environment variable হলো K6_SUMMARY_EXPORT Source 6সোর্স 6। command-টা Technical লেখায় আছে।
k6 v2.3.0-তে এই flag এখনও আছে। এটা deprecated নয়, কিন্তু docs এখন এটা ব্যবহার করতে নিরুৎসাহিত করে। docs বলে handleSummary() বেশি flexible JSON export দেয়, সাথে অন্য format আর summary-র পূর্ণ নিয়ন্ত্রণও দেয় Source 6সোর্স 6।
v2.0.0 কী সরিয়েছে, জেনে রাখুন। --no-summary flag নেই। এর বদলে --summary-mode=disabled ব্যবহার করুন Source 7সোর্স 7। legacy summary mode-ও নেই। compact (default) অথবা full ব্যবহার করুন Source 7সোর্স 7 Source 3সোর্স 3। disabled mode handleSummary() আর --summary-export-ও বন্ধ করে দেয় Source 6সোর্স 6। report খালি এলে দেখুন আপনি এই mode সেট করেছেন কি না।
Duration and iterations together
The tutorial owner's script had these options:
export const options = {
vus: 100,
duration: '10s',
iterations: 100,
};The options vus and duration alone are a shortcut for one scenario with the constant-VUs executor Source 6সোর্স 6. The options vus and iterations alone are a shortcut for one scenario with the shared-iterations executor Source 6সোর্স 6. When you give all three, the iterations shortcut wins. The duration option then sets the maxDuration of that scenario Source 6সোর্স 6. The default maxDuration is 10 minutes Source 6সোর্স 6.
So the owner's options mean: run 100 iterations shared among 100 VUs, and stop after 10 seconds if the iterations are not done. The run ends at whichever comes first. This page ran a small version of this to check it, with vus: 2, duration: '5s' and iterations: 6. k6 v2.3.0 printed this scenario line:
default: 6 iterations shared among 2 VUs (maxDuration: 5s, gracefulStop: 30s)The 6 iterations ended in less than 2 seconds, so the run did not wait for 5 seconds. With shared iterations, a faster VU completes more iterations than the others Source 6সোর্স 6. So 100 VUs and 100 iterations do not always give one iteration for each VU.
The tutorial's own advice: set the duration or the iterations, not both, unless you want a time limit as a safety net. It keeps the meaning of the test clear.
সহজ English
The tutorial owner's script had vus: 100, duration: '10s', and iterations: 100. The Technical text shows the code.
The options vus and duration alone are a shortcut for one scenario with the constant-VUs executor Source 6সোর্স 6. The options vus and iterations alone are a shortcut for one scenario with the shared-iterations executor Source 6সোর্স 6. When you give all three, the iterations shortcut wins. The duration option then sets the maxDuration of that scenario Source 6সোর্স 6. The default maxDuration is 10 minutes Source 6সোর্স 6.
So the owner's options mean this. Run 100 iterations shared among 100 VUs. Stop after 10 seconds if the iterations are not done. The run ends at whichever comes first.
This page ran a small version to check it, with vus: 2, duration: '5s' and iterations: 6. k6 v2.3.0 printed that 6 iterations are shared among 2 VUs, with a maxDuration of 5 seconds. The 6 iterations ended in less than 2 seconds. The run did not wait for 5 seconds.
With shared iterations, a faster VU completes more iterations than the others Source 6সোর্স 6. So 100 VUs and 100 iterations do not always give one iteration for each VU.
The tutorial's own advice: set the duration or the iterations, not both, unless you want a time limit as a safety net. It keeps the meaning of the test clear.
বাংলা ব্যাখ্যা
টিউটোরিয়াল-মালিকের script-এ ছিল vus: 100, duration: '10s' আর iterations: 100। code Technical লেখায় আছে।
শুধু vus আর duration হলো constant-VUs executor-এর একটা scenario-র shortcut Source 6সোর্স 6। শুধু vus আর iterations হলো shared-iterations executor-এর একটা scenario-র shortcut Source 6সোর্স 6। তিনটাই দিলে iterations shortcut জেতে। তখন duration option ওই scenario-র maxDuration ঠিক করে Source 6সোর্স 6। maxDuration-এর default ১০ মিনিট Source 6সোর্স 6।
তাই মালিকের option-এর মানে এই: ১০০টা VU-র মধ্যে ভাগ করে ১০০টা iteration চালান। iteration শেষ না হলে ১০ সেকেন্ড পরে থামুন। যেটা আগে ঘটে, তখনই run শেষ হয়।
এই পেজ ছোট একটা সংস্করণ চালিয়ে পরীক্ষা করেছে, vus: 2, duration: '5s' আর iterations: 6 দিয়ে। k6 v2.3.0 ছেপেছে যে ৬টা iteration ২টা VU-র মধ্যে ভাগ হয়েছে, maxDuration ৫ সেকেন্ড। ৬টা iteration ২ সেকেন্ডের কম সময়ে শেষ হয়েছে। run ৫ সেকেন্ড অপেক্ষা করেনি।
shared iterations-এ যে VU দ্রুত চলে, সে অন্যদের চেয়ে বেশি iteration শেষ করে Source 6সোর্স 6। তাই ১০০ VU আর ১০০ iteration সবসময় প্রতি VU-তে একটা iteration দেয় না।
টিউটোরিয়ালের নিজস্ব পরামর্শ: সময়সীমার safety net না চাইলে duration অথবা iterations যেকোনো একটা সেট করুন, দুটো নয়। এতে টেস্টের মানে পরিষ্কার থাকে।
Key words
| Term | Meaning |
|---|---|
handleSummary(data) | A function that k6 calls at the end of the test. It returns where to put the summary: stdout, stderr, or files Source 1সোর্স 1. |
textSummary | A helper from the k6 JS utilities library. It makes the text summary that k6 prints by default Source 1সোর্স 1. |
| Web dashboard | A built-in page that shows results in real time. You turn it on with K6_WEB_DASHBOARD=true Source 2সোর্স 2. |
K6_WEB_DASHBOARD_EXPORT | The file name for an HTML report at the end of the run Source 2সোর্স 2. |
| Aggregation period | How often the dashboard updates (K6_WEB_DASHBOARD_PERIOD, default 10s). A report has graphs only if the test lasts more than 3 periods Source 2সোর্স 2. |
--out json=… and --out csv=… | Flags that write every data point to a file Source 4সোর্স 4 Source 5সোর্স 5. |
--summary-export | A flag that saves the summary to a JSON file. The docs discourage it, and prefer handleSummary() Source 6সোর্স 6. |
--summary-mode | A flag that sets the end-of-test summary: compact (default), full, or disabled Source 7সোর্স 7 Source 6সোর্স 6. |
| Shared iterations | An executor that shares a fixed number of iterations among the VUs. The shortcut vus plus iterations uses it Source 6সোর্স 6. |