k6 README

The project's README from github.com/grafana/k6. As one markdown file: README.md.

Grafana k6

Grafana Labs

Like unit testing, for performance

Modern load testing for developers and testers in the DevOps era.

Github release Build status Go Report Card Codecov branch
@k6_io on Twitter

Download · Documentation · Community Forum · Public Roadmap


---

k6 is a modern load-testing tool, built on our years of experience in the performance and testing industries. It's built to be powerful, extensible, and full-featured. The key design goal is to provide the best developer experience.

Its core features are:

This is what load testing looks like in the 21st century.

Example script

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

// Test configuration
export const options = {
  thresholds: {
    // Assert that 99% of requests finish within 3000ms.
    http_req_duration: ["p(99) < 3000"],
  },
  // Ramp the number of virtual users up and down
  stages: [
    { duration: "30s", target: 15 },
    { duration: "1m", target: 15 },
    { duration: "20s", target: 0 },
  ],
};

// Simulated user behavior
export default function () {
  let res = http.get("https://quickpizza.grafana.com");
  // Validate response status
  check(res, { "status was 200": (r) => r.status == 200 });
  sleep(1);
}

You can run scripts like this on the CLI, or in your CI, or across a Kubernetes cluster.

[!NOTE] Don't want to write code ?

We got you! Meet k6 Studio, a desktop application made to help you generate k6 scripts without having to touch code!

Documentation

The docs cover all aspects of using k6. Some highlights include:

These links barely scratch the surface! If you're looking for conceptual information, you can read about Test types, Test strategies, or one of the many informative Blog posts.

Roadmap

Our team is dedicated to continuously improving and providing the best user experience possible. The public roadmap covers user-oriented features, UX improvements and JavaScript support that our team will focus on. Remember that timeframes and priorities may shift, but we believe it's important to share our vision.

We hope it provides a clear overview of our plans for future development. We welcome feedback, corrections, and suggestions via GitHub to make it more comprehensive, accessible, and valuable for the community.

It's worth mentioning that we consider upvotes (thumbs-up) to be one of the essential metrics for determining community needs. If you want to show us the importance of a feature, please give it a thumbs-up.

Contribute

If you want to contribute or help with the development of k6, start by reading CONTRIBUTING.md. Before you start coding, it might be a good idea to first discuss your plans and implementation details with the k6 maintainers—especially when it comes to big changes and features. You can do this in the GitHub issue for the problem you're solving (create one if it doesn't exist).

Note: To disclose security issues, refer to SECURITY.md.

Support

To get help, report bugs, suggest features, and discuss k6 with others, refer to SUPPORT.md.

License

k6 is distributed under the AGPL-3.0 license.

k6 (grafana/k6)

Searching Database…

32K ·GitHub
这是什么东西?k6 是一款现代化的负载测试工具:你编写测试脚本,模拟真实的用户流量访问你的应用,看看它的表现如何。它是为 DevOps 时代的开发者和测试人员打造的——就像单元测试,只不过测的是性能。
k6 是需要安装的命令行工具,还是导入到代码里的库?它是一个命令行工具,而不是库:你可以在终端里、CI 中或整个 Kubernetes 集群上运行测试脚本。引擎本身用 Go 编写,而测试脚本则是 JavaScript。
怎么运行我的第一个测试?安装 k6 CLI,然后在终端里运行一个 JavaScript 测试脚本——Get Started 文档涵盖了安装、运行测试和查看结果的完整流程。不想写代码?k6 Studio 是一款桌面应用,可以帮你自动生成 k6 脚本。
写测试用 JavaScript 还是 Go?不需要会 Go:测试用 JavaScript 配合 k6 的脚本 API 来写,内置的 JavaScript 引擎把 Go 的高性能和 JavaScript 的易用性结合在了一起。
我的笔记本能产生足够的负载吗,还是需要很强的硬件?比你想的轻量得多:负载生成是可配置的,即使是配置较低的机器也能模拟大量流量。
它只支持 HTTP 接口,还是也支持其他协议?除了 HTTP,k6 还支持 WebSockets、gRPC 和浏览器流量,它的扩展生态还能带来更多协议和使用场景。
测试结果和指标会输出到哪里?随你安排:k6 可以把汇总统计或细粒度指标导出到你选择的任意服务,并且原生集成了 Grafana Cloud,可用于执行、指标关联和分析。
thresholds 和 scenarios 是用来做什么的?Thresholds 让你为测试设定目标,把 SLO 固化下来;scenarios 则定义负载模型——开放或封闭模型、恒定 RPS、固定迭代次数等等。
我能为自己的使用场景扩展 k6 吗?可以——它天生就是为可扩展性设计的,社区共享的大量扩展生态已经覆盖了新的协议和使用场景。
What are similar projects?locust, pyroscope, vegeta, hey, goreplay, insomnia, oha, loki
Creator
grafana
Size
83.7 MB
Stars
32K
Age
10y
Commits · 90 Days