GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - lambertjosh/k6: A modern load testing tool, using Go and JavaScript - https://k6.io

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

1,669 Commits
1,669 Commits

Folders and files

NameName
Last commit message
Last commit date
api
api
 
 
core
core
 
 
external
external
 
 
js
js
 
 
lib
lib
 
 
loader
loader
 
 
samples
samples
 
 
simple
simple
 
 
stats
stats
 
 
tutorials
tutorials
 
 
ui
ui
 
 
web
web
 
 
.dockerignore
.dockerignore
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
API.md
API.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Caddyfile
Caddyfile
 
 
Dockerfile
Dockerfile
 
 
Dockerfile.grafana
Dockerfile.grafana
 
 
Dockerfile.influxdb
Dockerfile.influxdb
 
 
LICENSE.md
LICENSE.md
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
Vagrantfile
Vagrantfile
 
 
bench_test.go
bench_test.go
 
 
build-release.sh
build-release.sh
 
 
circle.yml
circle.yml
 
 
config.go
config.go
 
 
ctl.go
ctl.go
 
 
demo.gif
demo.gif
 
 
docker-compose.yml
docker-compose.yml
 
 
gometalinter.json
gometalinter.json
 
 
jsdoc.json
jsdoc.json
 
 
k6.sublime-project
k6.sublime-project
 
 
login.go
login.go
 
 
logo.png
logo.png
 
 
main.go
main.go
 
 
run.go
run.go
 
 
run_test.go
run_test.go
 
 
util.go
util.go
 
 
util_test.go
util_test.go
 
 

Repository files navigation

k6 is a modern load testing tool, building on Load Impact's years of experience. It provides a clean, approachable scripting API, distributed and cloud execution, and orchestration via a REST API.

This is how load testing should look in the 21st century.


  • Project site: http://k6.io

  • Documentation: http://docs.k6.io

  • Check out k6 on Slack!

Introduction

k6 works with the concept of virtual users (VUs), which run scripts - they're essentially glorified, parallel while(true) loops. Scripts are written using JavaScript, as ES6 modules, which allows you to break larger tests into smaller pieces, or make reusable pieces as you like.

Scripts must contain, at the very least, a default function - this defines the entry point for your VUs, similar to the main() function in many other languages:

export default function() {
    // do things here...
}

"Why not just run my script normally, from top to bottom", you might ask - the answer is: we do, but code inside and outside your default function can do different things.

Code inside default is called "VU code", and is run over and over for as long as the test is running. Code outside of it is called "init code", and is run only once per VU.

VU code can make HTTP requests, emit metrics, and generally do everything you'd expect a load test to do - with a few important exceptions: you can't load anything from your local filesystem, or import any other modules. This all has to be done from init code.

There are two reasons for this. The first is, of course: performance.

If you read a file from disk on every single script iteration, it'd be needlessly slow; even if you cache the contents of the file and any imported modules, it'd mean the first run of the script would be much slower than all the others. Worse yet, if you have a script that imports or loads things based on things that can only be known at runtime, you'd get slow iterations thrown in every time you load something new.

But there's another, more interesting reason. By forcing all imports and file reads into the init context, we design for distributed execution. We know which files will be needed, so we distribute only those files. We know which modules will be imported, so we can bundle them up from the get-go. And, tying into the performance point above, the other nodes don't even need writable filesystems - everything can be kept in-memory.

As an added bonus, you can use this to reuse data between iterations (but only for the same VU):

var counter = 0;

export default function() {
    counter++;
}

Installation

Mac

brew tap loadimpact/k6
brew install k6

Docker

docker pull loadimpact/k6

Other Platforms

Grab a prebuilt binary from the Releases page.

Running k6

First, create a k6 script to describe what the virtual users should do in your load test:

import http from "k6/http";

export default function() {
  http.get("http://test.loadimpact.com");
};

Save it as script.js, then run k6 like this:

k6 run script.js

(Note that if you use the Docker image, the command is slightly different: docker run -i loadimpact/k6 run - <script.js)

For more information on how to get started running k6, please look at the Running k6 documentation. If you want more info on the scripting API or results output, you'll find that also on https://docs.k6.io.


Need help or want to contribute?

Types of questions and where to ask:

  • How do I? -- Stack Overflow (use tags: k6, javascript, load-testing)
  • I got this error, why? -- Stack Overflow
  • I got this error and I'm sure it's a bug -- file an issue
  • I have an idea/request -- file an issue
  • Why do you? -- Slack
  • When will you? -- Slack
  • I want to contribute/help with development -- Start here, then Slack and issues

Development Setup

go get -u github.com/loadimpact/k6

The only catch is, if you want the web UI available, it has to be built separately. Requires a working NodeJS installation.

First, install the ember-cli and bower tools if you don't have them already:

npm install -g ember-cli bower

Then build the UI:

cd $GOPATH/src/github.com/loadimpact/k6/web
npm install && bower install
ember build

About

A modern load testing tool, using Go and JavaScript - https://k6.io

Resources

Readme
AGPL-3.0 license

Code of conduct

Code of conduct

Contributing

Contributing
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.