k6/experimental module provides access to experimental APIs and features that are under development or evaluation for inclusion in k6.
Overview
Experimental modules allow you to try new k6 features before they become stable. Features that prove useful and stable are eventually promoted to regular k6 modules.Importing Experimental Modules
Available Experimental Modules
CSV Module
Provides efficient and convenient parsing of CSV files with better performance than JavaScript-based libraries.csv
Efficient CSV file parsing and streaming
- Fast parsing using Go-based processing
- Lower memory usage with SharedArray support
- Line-by-line streaming for large files
- Full-file parsing for performance-critical scenarios
Filesystem Module
Provides memory-efficient file interactions within test scripts, including reading files, seeking, and retrieving metadata.fs
Memory-efficient file system operations
- Memory-efficient file loading (shared across VUs)
- File seeking and random access
- File metadata and stats
- Async file operations
Streams Module
Implements the Streams API specification for defining and consuming readable streams.streams
Streams API for reading and transforming data
- ReadableStream implementation
- Transform streams
- Backpressure handling
- Integration with other k6 modules
Module Comparison
CSV Module
| Approach | Memory Usage | Performance | Use Case |
|---|---|---|---|
csv.parse() | Higher (full file) | Faster | Performance-critical scenarios |
csv.Parser | Lower (streaming) | Moderate | Large files, memory constraints |
Filesystem vs Traditional open()
| Feature | experimental/fs | Traditional open() |
|---|---|---|
| Memory Usage | Low (shared) | High (per-VU copy) |
| File Size | Any size | Limited by memory |
| Random Access | Yes (seeking) | No |
| Read Mode | Streaming | Full load |
API Reference Summary
k6/experimental/csv
Parses entire CSV file into a SharedArray
Streaming CSV parser for line-by-line reading
k6/experimental/fs
Opens a file and returns a File instance
Represents a file with read(), seek(), and stat() methods
Enum for seek operations: Start, Current, End
k6/experimental/streams
Implements the Streams API ReadableStream
Best Practices
Using Experimental Features
Pin Your k6 Version
Pin Your k6 Version
Experimental APIs may change between k6 versions. Pin your k6 version in CI/CD to avoid unexpected breaking changes.
Monitor Deprecation Notices
Monitor Deprecation Notices
Check k6 release notes for deprecation warnings and migration paths when experimental modules are stabilized or changed.
Test Before Production
Test Before Production
Thoroughly test scripts using experimental modules in non-production environments before deploying to production load tests.
Have Fallback Plans
Have Fallback Plans
Be prepared to refactor if an experimental module is removed or significantly changed in future k6 versions.
Migration Paths
Some experimental modules have been promoted to stable:| Former Experimental Module | Stable Module |
|---|---|
k6/experimental/browser | k6/browser |
k6/experimental/websockets | k6/websockets |
k6/experimental/grpc | k6/net/grpc |
k6/experimental/timers | k6/timers |
Examples
Combining CSV and Filesystem
Streaming Large Files
Related Resources
CSV Module
Efficient CSV parsing
Filesystem Module
Memory-efficient file operations
Streams API
Data streaming support
k6 Changelog
Track experimental module changes