Giter Club home page Giter Club logo

demok6loadtesting's Introduction

๐ŸŽ‰ DemoK6LoadTesting ๐ŸŽ‰

This repository contains performance tests to be executed by TestKube. Publishing test results to Prometheus and visualizing them in Grafana is supported.

๐Ÿ“ Installation

MacOS

brew install k6

check version

k6 version

Check the releases page for different versions of k6.

Run K6 scripts to publish metrics to Prometheus

K6_PROMETHEUS_RW_SERVER_URL=http://localhost:9090/api/v1/write \
K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true \
K6_PROMETHEUS_RW_INSECURE_SKIP_TLS_VERIFY=true \
K6_PROMETHEUS_RW_STALE_MARKERS=true \
k6 run \
-o experimental-prometheus-rw \
--log-output=loki=http://localhost:3100/loki/api/v1/push,label.loadtest=k6,limit=1000,pushPeriod=1m,msgMaxSize=1231,level=trace \
tests/script.js
# Prometheus URL to write metrics from K6 to Prometheus
K6_PROMETHEUS_RW_SERVER_URL

more details here how to write metrics from K6 to Prometheus

more details here how to write logs from K6 to Loki

Run K6 browser based scripts to publish metrics to Prometheus

K6_PROMETHEUS_RW_SERVER_URL=http://localhost:9090/api/v1/write \
K6_PROMETHEUS_RW_TREND_AS_NATIVE_HISTOGRAM=true \
K6_PROMETHEUS_RW_INSECURE_SKIP_TLS_VERIFY=true \
K6_PROMETHEUS_RW_STALE_MARKERS=true \
K6_BROWSER_HEADLESS=false
k6 run \
-o experimental-prometheus-rw \
tests/browser-test.js

K6 browser tests documentation

https://github.com/grafana/xk6-browser

๐Ÿ”จ Running Loki, Prometheus and Grafana Locally

Prerequisites

Before you begin, ensure you have the following installed:

  • Docker
  • Docker Compose

You can download Docker here and it includes Docker Compose in most installation packages.

Starting the Services

docker-compose up -d

This will pull the required Docker images, create volumes, and start the Prometheus and Grafana containers.

Accessing Prometheus

Once the services are up and running, you can access the Prometheus web UI by opening your browser and going to:

http://localhost:9090/metrics

image

Here you can execute queries to explore your metrics and see the health of your monitoring system.

Accessing Grafana

  • Visualize your results to analyze performance during the test run or over multiple test runs.
  • Correlate test results with application and system metrics in the same dashboard to get a holistic overview of your system's performance and quickly find the root causes of performance issues.

Grafana will be available by navigating to the following URL in your browser:

http://localhost:3000

By default, the login credentials are set to admin for the username and admin for the password. It's strongly recommended to change these credentials upon first login. image image

By default, k6 dashboard is available in Grafana. You can access it by navigating to the Grafana dashboard

Available dashboard resources:

Accessing Loki logs

Loki will be available by navigating to the Grafana under explorer section.

image

Stopping the Services

To stop the services, run the following command:

docker-compose down
docker kill $(docker ps -q)

If you want to remove the volumes along with the containers, use:

docker-compose down -v

Note: This will delete your data in Prometheus and Grafana.

๐Ÿง‘โ€๐Ÿ’ป Contact

๐Ÿ‘ท Owner

๐Ÿ“ง Email: [email protected]

demok6loadtesting's People

Contributors

beemi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.