Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/k6/next/javascript-api/k6-x-redis.md, or by sending Accept: text/markdown to https://grafana.com/docs/k6/next/javascript-api/k6-x-redis/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
k6/x/redis
The Redis module provides a client library that makes it possible to interact with Redis directly from a k6 script. With this module, you can:
- Load test Redis
- Use Redis as a data store for test-script logic.
Though the API intends to be thorough and extensive, it does not expose the whole Redis API. Instead, the intent is to expose Redis for use cases most appropriate to k6.
| Class | Description |
|---|---|
| Client | Client that exposes allowed interactions with Redis. |
| Options | Options used to configure the behavior of the Redis Client. |
Notes on usage
The Client exposes a promise-based API.
Unlike most other current k6 modules and extensions,
which operate in a synchronous manner,
the Redis Client operates in an asynchronous manner.
In practice, this means that using the Redis Client’s methods won’t block test execution,
and that the test will continue to run even if the Redis Client isn’t ready to respond to the request.
The async and await keywords enable asynchronous, promise-based behavior to be written in a cleaner style, avoiding the need to explicitly configure promise chains
(for details, refer to the MDN documentation).
Was this page helpful?
Related resources from Grafana Labs

