Benchmarks
Swytch includes built-in benchmark suites for both the cache engine and Redis command handling. You can also use the
standard redis-benchmark tool.
go test -bench=. -benchmem ./cache/
These benchmarks exercise the CloxCache (L0 in-memory layer) directly, without Redis protocol overhead:
| Benchmark | Description |
|---|---|
BenchmarkCloxCacheGet | Parallel GET on 10k keys |
BenchmarkCloxCachePut | Parallel PUT operations |
BenchmarkCloxCacheMixed | 80% read / 20% write workload, reports hit rate and evictions |
BenchmarkCloxCacheZipf | Zipf distribution (theta=0.99) simulating realistic hotspot access |
BenchmarkCloxCacheContention | High contention on 100 hot keys |
BenchmarkCloxCacheSizes | Scaling across Small, Medium, Large, and XLarge cache sizes |
BenchmarkCloxCachePointers | Pointer-type values |
Each benchmark also has a sync.Map variant for comparison.
go test -bench=. -benchmem ./redis/
These benchmarks exercise the full Redis command pipeline including parsing, execution, and response writing:
| Benchmark | Description |
|---|---|
BenchmarkHandler_Set | SET command throughput |
BenchmarkHandler_Get | GET command throughput (pre-populated 10k keys) |
BenchmarkHandler_Incr | INCR atomic counter |
BenchmarkHandler_IncrBy | INCRBY atomic counter |
BenchmarkHandler_LPush | LPUSH list operations |
BenchmarkHandler_RPush | RPUSH list operations |
BenchmarkHandler_LPop | LPOP list operations |
BenchmarkHandler_RPop | RPOP list operations |
BenchmarkHandler_LRange | LRANGE range queries |
BenchmarkHandler_LIndex | LINDEX positional lookup |
BenchmarkHandler_HSet | HSET hash field writes |
BenchmarkHandler_HGet | HGET hash field reads |
BenchmarkHandler_HGetAll | HGETALL full hash retrieval |
BenchmarkHandler_HIncrBy | HINCRBY atomic hash field increment |
BenchmarkHandler_Mixed | 80/20 read/write mixed workload |
BenchmarkHandler_Parallel | Multi-goroutine GET/SET |
BenchmarkHandler_LargeValues | 10KB value SET/GET |
BenchmarkHandler_LPushScalability | LPUSH scaling from 1K to 10M list elements |
go test -bench=. -benchmem ./effects/
Benchmarks for the causal effect resolution layer.
Swytch is compatible with the standard redis-benchmark tool:
# Basic throughput test
redis-benchmark -p 6379 -n 100000 -c 50
# GET/SET only
redis-benchmark -p 6379 -t set,get -n 1000000 -c 100
# Pipeline mode (higher throughput)
redis-benchmark -p 6379 -t set,get -n 1000000 -P 16
# With specific key size and value size
redis-benchmark -p 6379 -t set,get -d 256 -r 1000000
| Flag | Description |
|---|---|
-n | Total number of requests |
-c | Number of parallel connections |
-P | Pipeline N requests per connection |
-t | Comma-separated list of commands to benchmark |
-d | Data size in bytes for SET values |
-r | Use random keys from a range of this size |
-q | Quiet mode (show only requests/sec) |
The cache benchmarks include a Zipf workload generator (theta=0.99) that simulates realistic access patterns where a small number of keys receive the majority of traffic. This is representative of most production workloads.
The contention benchmark concentrates all access on 100 keys across many goroutines. This stress-tests the sharded locking and adaptive serialization paths.
For reproducible cache evaluations, trace files are available from the CacheMon cache_dataset project. These real-world traces can be replayed against Swytch to compare eviction behavior across different workloads.