Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SoakConfig ¶
type SoakConfig struct {
// Duration is how long to run the soak test (default: 1 minute).
Duration time.Duration
// NumObjects is the total number of unique object keys to use (default: 1000).
NumObjects int
// MaxObjectSize is the maximum size of each object in bytes (default: 1MB).
MaxObjectSize int
// MinObjectSize is the minimum size of each object in bytes (default: 1KB).
MinObjectSize int
// OverwritePercent is the percentage of writes that should overwrite existing keys (default: 20).
OverwritePercent int
// Concurrency is the number of concurrent goroutines writing to the cache (default: 4).
Concurrency int
// TTL is the time-to-live for cache entries (default: 1 hour).
TTL time.Duration
}
SoakConfig configures the soak test parameters.
type SoakResult ¶
type SoakResult struct {
Writes int64
Reads int64
ReadHits int64
ReadMisses int64
Deletes int64
BytesWritten int64
Duration time.Duration
// Memory stats
HeapAllocStart uint64
HeapAllocEnd uint64
TotalAlloc uint64
NumGC uint32
}
SoakResult contains the results of a soak test run.
func Soak ¶
func Soak(t *testing.T, c cache.Cache, config SoakConfig) SoakResult
Soak runs an extended soak test against a cache implementation.
The test writes random objects of varying sizes, with some overwrites, and verifies that the cache behaves correctly under sustained load. It also performs periodic reads and deletes.
Click to show internal directories.
Click to hide internal directories.