Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

โ€œInvest in yourself โ€” your confidence is always worth it.โ€

Explore Cosmetic Hospitals

Start your journey today โ€” compare options in one place.

Grafana k6 OSS: Demo & Lab


1. Install k6 on Windows

You have a few options. Iโ€™ll show the two easiest:

Option A โ€“ Using winget (recommended if available)

  1. Open Windows Terminal / PowerShell as Administrator.
  2. Run: winget install grafana.k6
  3. After install, verify: k6 version You should see something like: k6 v0.xx.x

Option B โ€“ Using Chocolatey

If youโ€™re already using Chocolatey:

  1. Open PowerShell (Admin).
  2. Install: choco install k6
  3. Verify: k6 version

Option C โ€“ Portable (ZIP) Binary (no package manager)

  1. Go to: https://github.com/grafana/k6/releases (in your browser).
  2. Download the latest Windows x64 .zip.
  3. Extract it to a folder, e.g.: C:\tools\k6\
  4. Add that folder to your PATH:
    • Press Win โ†’ search Environment Variables โ†’ โ€œEdit the system environment variablesโ€.
    • Click Environment Variablesโ€ฆ
    • Under User variables or System variables, select Path โ†’ Edit โ†’ New โ†’ add: C:\tools\k6\
    • Click OK several times.
  5. Open a new PowerShell and run: k6 version

2. Create a Project Folder

Letโ€™s keep things clean.

  1. Choose a workspace folder, e.g.: mkdir C:\k6-demo cd C:\k6-demo
  2. Youโ€™ll put all your k6 scripts here.

3. Your First โ€œHello Worldโ€ k6 Script

Weโ€™ll create a very simple script that:

  • Sends 1 HTTP GET request to a test URL.
  • Checks that the response status is 200.
  • Prints basic stats at the end.

3.1 Create the script file

  1. In C:\k6-demo, create a file named hello-world.js.

If you like using Notepad:

notepad .\hello-world.js
Code language: CSS (css)

Paste this code inside:

import http from 'k6/http';
import { check, sleep } from 'k6';

export const options = {
  vus: 1,          // number of virtual users
  duration: '10s', // total test duration
};

export default function () {
  // 1) Make a simple GET request
  const res = http.get('https://test.k6.io');

  // 2) Validate response
  check(res, {
    'status is 200': (r) => r.status === 200,
  });

  // 3) Small pause between iterations
  sleep(1);
}
Code language: JavaScript (javascript)

Save and close the file.


4. Run the Hello World Test

From inside the folder:

cd C:\k6-demo
k6 run .\hello-world.js
Code language: CSS (css)

You will see something like:

          /\      |โ€พโ€พ| /โ€พโ€พ/  /โ€พโ€พ/
     /\  /  \     |  |/  /  /  /
    /  \/    \    |     (  /  /
   /          \   |  |\  \/  /
  / __________ \  |__| \____/

  execution: local
     script: hello-world.js
     output: -

  scenarios: (100.00%) 1 scenario, 1 max VUs, 10s max duration (incl. graceful stop):
           * default: 1 looping VUs for 10s (gracefulStop: 30s)

running (10.0s), 0/1 VUs, 10 complete and 0 interrupted iterations
default โœ“ [======================================] 1 VUs  10s

     โœ“ status is 200

     checks...................: 100.00% โœ“ 10 โœ— 0
     http_req_duration........: avg=150ms min=120ms max=200ms ...
     http_reqs................: 10  (1.0/s)
     vus......................: 1
Code language: PHP (php)

5. Understand the Output

Important fields to understand:

  • checks โ€“ shows how many checks passed/failed:
    • โœ“ 10 โœ— 0 โ†’ all 10 requests returned status 200.
  • http_req_duration โ€“ time it took to complete each HTTP request.
    • avg, min, max, percentiles.
  • http_reqs โ€“ total number of HTTP requests (10 here).
  • vus โ€“ how many virtual users were active (1 here).

Since status is 200 is the only check, if the website failed or returned a different code, youโ€™d see failed checks.


6. Slightly More Interesting Example (Hello World with Threshold)

Now, letโ€™s add a threshold so the test โ€œfailsโ€ if latency is too high.

Create another file: hello-with-threshold.js

notepad .\hello-with-threshold.js
Code language: JavaScript (javascript)

Paste:

import http from 'k6/http';
import { check, sleep } from 'k6';

export const options = {
  vus: 2,
  duration: '15s',
  thresholds: {
    // 95% of all requests must finish below 500ms
    http_req_duration: ['p(95) < 500'],
    // At least 99% of checks must pass
    checks: ['rate > 0.99'],
  },
};

export default function () {
  const res = http.get('https://test.k6.io');

  check(res, {
    'status is 200': (r) => r.status === 200,
  });

  sleep(1);
}
Code language: JavaScript (javascript)

Run it:

k6 run .\hello-with-threshold.js
Code language: JavaScript (javascript)

At the end, youโ€™ll see something like:

   checks................: 100.00% โœ“ 30 โœ— 0
   http_req_duration.....: p(95)=180ms ...
   thresholds:
     * http_req_duration  p(95)<500       โœ“  passed
     * checks             rate>0.99       โœ“  passed
Code language: HTML, XML (xml)

If you intentionally use a slow or broken URL, you might see thresholds marked as failed with โœ—.


7. Running a Quick โ€œSmoke Testโ€ Style Hello World

If you just want to quickly confirm your script works (like a smoke test):

Create hello-smoke.js:

notepad .\hello-smoke.js
Code language: CSS (css)

Paste:

import http from 'k6/http';
import { sleep } from 'k6';

export const options = {
  vus: 1,
  iterations: 1, // run only once
};

export default function () {
  const res = http.get('https://test.k6.io');
  console.log(`Response status: ${res.status}`);
  sleep(1);
}
Code language: JavaScript (javascript)

Run:

k6 run .\hello-smoke.js
Code language: CSS (css)

Youโ€™ll see a log line:

INFO[0000] Response status: 200
Code language: CSS (css)

This is a super basic โ€œHello Worldโ€ just to embed k6 in a CI step or script.


8. Typical Folder Structure for Your k6 Work

If you continue learning, you might organize like:

C:\k6-demo
 โ”œโ”€ hello-world.js
 โ”œโ”€ hello-with-threshold.js
 โ”œโ”€ hello-smoke.js
 โ”œโ”€ scenarios/
 โ”‚   โ”œโ”€ basic-load.js
 โ”‚   โ”œโ”€ spike-test.js
 โ”œโ”€ data/
 โ”‚   โ””โ”€ users.csv
Code language: JavaScript (javascript)

9. Next Easy Steps After Hello World

Once this works, good next things to explore:

  1. Increase load
    Change: vus: 10, duration: '30s',
  2. Add multiple URLs
    Use group() blocks and multiple http.get calls.
  3. Export results to JSON (for later analysis): k6 run --out json=results.json .\hello-world.js
  4. Integrate with Grafana later (Prometheus or k6 Cloud), once youโ€™re comfortable.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
Iโ€™m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

Top 10 AI Code Generation for Scientific Computing Tools: Features, Pros, Cons & Comparison

Introduction AI Code Generation Tools for Scientific Computing combine artificial intelligence, machine learning, and programming assistance to help researchers, engineers, and scientists write, optimize, and maintain scientific…

Read More

Top 10 AI Computer-Aided Engineering Assistants: Features, Pros, Cons & Comparison

Introduction AI Computer-Aided Engineering (CAE) Assistants combine artificial intelligence, machine learning, automation, and engineering knowledge to help engineers improve design, simulation, analysis, and optimization workflows. These assistants…

Read More

Top 10 AI Materials Informatics Platforms: Features, Pros, Cons & Comparison

Introduction AI Materials Informatics Platforms combine artificial intelligence, machine learning, data analytics, and materials science to accelerate the discovery, development, and optimization of new materials. These platforms…

Read More

Top 10 AI CFD Acceleration Toolkits: Features, Pros, Cons & Comparison

Introduction AI CFD Acceleration Toolkits use artificial intelligence, machine learning, and scientific computing techniques to speed up Computational Fluid Dynamics (CFD) simulations. Traditional CFD simulations can require…

Read More

Top 10 Physics-Informed Neural Network (PINN) Frameworks: Features, Pros, Cons & Comparison

Introduction Physics-Informed Neural Network (PINN) Frameworks are AI and machine learning platforms designed to combine neural networks with mathematical equations, physical laws, and scientific constraints. Unlike traditional…

Read More

Top 10 AI Surrogate Modeling Tools: Features, Pros, Cons & Comparison

Introduction AI Surrogate Modeling Tools use artificial intelligence, machine learning, and statistical modeling techniques to create fast approximations of complex simulations, experiments, and computational processes. Instead of…

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Jason Mitchell
Jason Mitchell
7 months ago

This demo lab is an excellent introduction to integrating load-testing right into the development lifecycle with Grafana k6. It shows how developers and QA teams can simulate realistic traffic using JavaScript-based scripts to uncover performance bottlenecks before deployment โ€” a critical practice for building scalable, resilient applications. By highlighting how to configure virtual users, ramp up/down load, and visualize results (especially when paired with observability tools), the article makes it clear that performance testing doesnโ€™t have to be an afterthought. Overall, a very practical guide for teams wanting to embed performance and reliability checks early in their CI/CD pipelines โ€” thanks for sharing!

1
0
Would love your thoughts, please comment.x
()
x