Learn Software Performance Testing with K6 :: Part-7

Learn Software Performance Testing with K6 :: Part-7

গত পর্বে আমরা দেখেছিলাম কিভাবে ENV variable and CSV এর মাধ্যমে কিভাবে ভেলু পাস করা যায়। তাছাড়া ইউজার লগিন এর টোকেন কিভাবে অন্য API এর header এর authorization হিসেবে সেট করা যায়। আজকে আমরা দেখব performance testing করার সময় Grafana and Influxdb use করে কিভাবে real time monitoring করা যায়। তো চলুন শুরু করা যাক।

১ম পর্বঃ https://www.linkedin.com/pulse/learn-software-performance-testing-k6-part-1-salman-rahman-vy2uc/?trackingId=GJhfD5nTjYN2Jd9L0axcZQ%3D%3D

২য় পর্বঃ https://www.linkedin.com/pulse/learn-software-performance-testing-k6-part-2-salman-rahman-x3tic/?trackingId=PsGX9OLreY4NGaJZrCjpNA%3D%3D

৩য় পর্বঃ https://www.linkedin.com/pulse/learn-software-performance-testing-k6-part-3-salman-rahman-zdsjc/?trackingId=ZKQg2k1qRiufH041CMR2LQ%3D%3D

৪র্থ পর্বঃ https://www.linkedin.com/pulse/learn-software-performance-testing-k6-part-4-salman-rahman-trvuc/?trackingId=UlE55ZNaTP6TNhIPkVJdkw%3D%3D

৫ম পর্বঃ https://www.linkedin.com/pulse/learn-software-performance-testing-k6-part-5-salman-rahman-neuvc/?trackingId=8hSpXe3KAayieydPahtGng%3D%3D

৬ষ্ঠ পর্বঃ https://www.linkedin.com/pulse/learn-software-performance-testing-k6-part-6-salman-rahman-vk8mc/?trackingId=tU5VeNsvTImB%2B8JX7OasiA%3D%3D

Influxdb এর ৩ টি version আছে।

1. InfluxDB 1.x (Legacy)

  • Latest Version: v1.11.8
  • Key Features:
  • Ideal for: Single User in localhost

2. InfluxDB 2.x

  • Latest Version: v2.7.12
  • Key Features:
  • Ideal for: New projects needing integrated tools

3. InfluxDB 3.x (Latest)

  • Latest Version: 3.0 (General Availability as of April 2025)
  • Key Features:
  • Ideal for: Real-time analytics and large-scale deployments

প্রাথমিক ধারণা লাভ এবং installation এর ঝামেলা এড়ানোর জন্য আমরা Influxdb v1.x version টাই install করব।

Installation Process:

  1. Open Powershell and hit this command:

Download Influxdb:
wget https://download.influxdata.com/influxdb/releases/influxdb-1.11.8-windows-amd64.zip -UseBasicParsing -OutFile influxdb-1.11.8_windows_amd64.zip        
Extract Zip:
Expand-Archive .\influxdb-1.11.8-windows-amd64.zip -DestinationPath 'C:\Program Files\InfluxData\influxdb\'        

2. Now Edit system variable and add following path: C:\Program Files\InfluxData\influxdb\

3. Now hit the command to start influxdb server >influx

Article content
Started Influxdb Server

4. Navigate to http://localhost:8086 to make sure the influxdb server is running


Article content
Running Influxdb server

  1. Now open another terminal tab and hit following command to get into influxdb >influx
  2. Create new db; > CREATE DATABASE k6
  3. SHOW DATABASES
  4. EXIT

Now write a basic script to see the output in influxdb:

import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
  iterations:50,
  vus:2
};
export default function () {
  http.get('https://test-api.k6.io');

  // Sleep for 1 second to simulate real-world usage
  sleep(1);
}
        

Hit following command to write data in k6 database:

k6 run --out influxdb=http://localhost:8086/k6 first-script.js        

Now again go to your terminal and enter into influxddb by hitting those commands:

> influx
> USE K6
> SHOW MEASUREMENTS
        

It will show the list of measurement data inserted in k6

Article content
Measurement data inserted into influxdb

এখন আমরা Grafana install করব।

Install Grafana:

  1. Download the grafana binary grafana-enterprise-11.4.0.windows-amd64.zip https://grafana.com/grafana/download?platform=windows
  2. Extract and keep in the location: C:\Program Files\grafana-v11.4.0
  3. Go to bin folder
  4. Open cmd and hit command grafana-server
  5. Navigate to this url: http://localhost:3000
  6. Login as default username and password (admin/admin)
  7. Go to connection=>datasource and select influxdb


Article content
Grafana Dashboard

  1. Set influxdb url: http://localhost:8086
  2. Set database: k6
  3. Set HTTP Method: POST
  4. Click 'Save and Test' button

Article content

You are successfully configured the influxdb with Grafana now!

Run k6 for real time monitoring in Grafana

  1. Create new dashboard in grafana
  2. Add visualization
  3. Set datasource as influxdb
  4. Select measurement; you can add multiple measurements for each query module that will visualize the data
  5. Save Dashboard
  6. From the edit option, select Last 5 minutes and for auto refresh, set time 5s

Now hit the following command again for real time monitoring:k6 run --out influxdb=http://localhost:8086/k6 first-script.js


Article content
Showing performance measurement data in realtime

Finally আমরা Real time monitoring ও করে ফেললাম।

Good Luck! Happy performance testing :)

Could you please check your dm

Like
Reply

To view or add a comment, sign in

Others also viewed

Explore topics