Skip to content

Repository files navigation

xk6-redis

This is an official k6 extension, it's a client library for Redis database. Check out the extension's documentation here.

Get started

Add the extension's import

import redis from "k6/x/redis";

Define the client

import redis from "k6/x/redis";

// Instantiate a new Redis client using a URL.
// The connection will be established on the first command call.
const client = new redis.Client('redis://localhost:6379');

Call the API from the VU context

export default function () {
  redisClient.sadd("crocodile_ids", ...crocodileIDs);
...
}

Build

The most common and simple case is to use k6 with automatic extension resolution. Simply add the extension's import and k6 will resolve the dependency automtically.
However, if you prefer to build it from source using xk6, first ensure you have the prerequisites:

Then:

  1. Install xk6:
go install go.k6.io/xk6/cmd/xk6@latest
  1. Build the binary:
xk6 build --with github.com/grafana/xk6-redis

About

A k6 extension to test the performance of a Redis instance

Topics

Resources

Code of conduct

Security policy

Stars

38 stars

Watchers

136 watching

Forks

Releases

Packages

Used by

Contributors

Languages