Repository navigation
Releases: wutlu/boltcache
Release list
v2.1.0
Sorted sets, reproducible benchmarks against Redis, Valkey and Dragonfly, and faster hot keys. This release follows up on the feedback from BoltCache's first Hacker News thread.
Added
- Sorted sets:
ZADD(NX/XX/GT/LT/CH/INCR),ZINCRBY,ZSCORE,ZMSCORE,ZCARD,ZCOUNT,ZRANK/ZREVRANK(WITHSCORE),ZREM,ZRANGE(BYSCORE/REV/LIMIT/WITHSCORES),ZREVRANGE,ZRANGEBYSCORE,ZREVRANGEBYSCORE,ZPOPMIN/ZPOPMAX,ZREMRANGEBYRANK/ZREMRANGEBYSCOREandZSCAN. They're backed by a skiplist with O(log n) ranks, persisted in snapshots, filterable withSCAN ... TYPE zsetand returned byGET /cache/{key}. - Reproducible benchmarks:
bench/run.shcompares BoltCache with Redis (with and without I/O threads), Valkey and Dragonfly under the same pinned CPU budget, and a GitHub Actions workflow runs it. Results and methodology are in BENCHMARKS.md. - README sections on project status, when (not) to use BoltCache with a comparison to Redis/Valkey, Dragonfly, NATS and etcd, and how the project is built and verified.
- Issue templates; private vulnerability reporting is enabled.
Performance
- Commands pipelined by a client that hit the same shard now run under a single lock acquisition, and shard locks spin briefly before blocking. This removes most lock contention on hot keys. On an M1 Pro, unpipelined
ZADDto one key went from 55K to 114K ops/s, and pipelinedHSETfrom 800K to 1.33M. - Skiplist nodes embed their level arrays, so a random insert into a 100K-member sorted set takes 2.4 µs instead of 3.2 µs.
Changed
- Performance claims in the README now come only from the reproducible benchmark, including where BoltCache is slower: pipelined
ZADD, andSET/GETon 2 cores.
Install
docker run -d -p 6382:6382 -p 8090:8090 -v boltcache-data:/data ghcr.io/wutlu/boltcache:2.1.0
go install github.com/wutlu/boltcache/v2@v2.1.0Or download a binary below.
v2.0.1
BoltCache 2.0 is a ground-up rework: it now works with redis-cli, redis-benchmark and Redis client libraries, and it's about 2x faster than 1.0. This patch release makes go install work and restores the release notes that were missing from 2.0.0.
Fixed in 2.0.1
go install github.com/wutlu/boltcache/v2@latestworks. Go requires a/v2suffix in the module path of v2+ releases, so the module path is nowgithub.com/wutlu/boltcache/v2.- Release notes are included in GitHub releases again.
What's new in 2.0
- Redis compatible: 120 commands over RESP: strings, lists, sets, hashes, TTL/
SCAN, pub/sub,MULTI/EXEC/WATCH,INFO... 1.x answered onlyPING/SET/GETand hung on everything else. - Real Lua scripting with
EVAL/EVALSHA. Scripts are atomic, sandboxed and time-limited. - Eviction:
max_memoryandmax_keysare enforced withlru,lfu,random,ttlornoeviction. - Crash-safe persistence: types and binary data survive restarts, and 1.x data files are converted automatically.
- Security: token auth is now actually enforced on REST, RESP and TCP. There's also CSRF protection, rate limiting and TLS for HTTP.
- Ops: Prometheus
/metrics,/health, JSON logs, a multi-arch distroless Docker image, and binaries for Linux, macOS, Windows and FreeBSD. - Fixes for data races, data loss after restarts, dropped commands and an XSS in the web client.
On an M1 Pro with redis-benchmark, BoltCache is ahead of Redis 8.4: +5–10% without pipelining and 1.25–2x with pipeline 16.
⚠️ Upgrading from 1.x
- Authentication is enforced when
security.auth.enabledis true. - Writing a different type to an existing key returns
WRONGTYPE. - Port 6381 and the
clustercommand were removed. cors_originsdefaults to same-origin.
See the full changelog and the README's Upgrading from 1.x section.
Install
docker run -d -p 6382:6382 -p 8090:8090 -v boltcache-data:/data ghcr.io/wutlu/boltcache:2.0.1
go install github.com/wutlu/boltcache/v2@v2.0.1Or download a binary below. Then: redis-cli -p 6382 PING.
BoltCache 2.0.0
Use 2.0.1: it fixes
go install(module pathgithub.com/wutlu/boltcache/v2).
BoltCache 2.0 is a ground-up rework of the engine, the network layer and the tooling. It is now a real Redis-compatible server: redis-cli, redis-benchmark, go-redis and other clients work against it, with real Lua scripting, transactions, eviction and crash-safe persistence. It is also about 2x faster than 1.0 and outperforms Redis 8.4 on a multi-core machine in redis-benchmark (see the README for numbers and methodology).
Highlights
- Redis compatibility: 120 commands over RESP2, up from
PING/SET/GET. Strings with allSEToptions, keys/TTL (EXPIRENX/XX/GT/LT,SCANwith MATCH/COUNT/TYPE), lists, sets, hashes, pub/sub with patterns,MULTI/EXEC/WATCH, Lua,INFO,CONFIG GET,CLIENT,COMMAND,HELLOand more. - Real Lua scripting (gopher-lua) replaces the line-based imitation:
EVAL,EVALSHA,EVAL_RO,SCRIPT LOAD/EXISTS/FLUSH,redis.call/redis.pcallwith Redis type conversions. Scripts are atomic, sandboxed and time-limited. - Atomicity everywhere: every command runs under its key's shard lock; multi-key commands, transactions and scripts lock all their keys in a fixed order, so they're atomic and can't deadlock.
- Eviction and limits:
cache.max_memoryandcache.max_keysare now enforced withlru,lfu,random,ttlor the newnoevictionpolicy. - Crash-safe, typed persistence: snapshots keep value types and binary data, are written atomically (temp file + fsync + rename), can be gzipped and are skipped when nothing changed. 1.x snapshots are converted automatically.
- Security: token authentication is enforced on REST, RESP and TCP; CORS allow-list (also for WebSockets) with CSRF protection, per-IP rate limiting, request size limits (strict ones for unauthenticated clients), HTTPS for the REST API, constant-time token checks, sandboxed Lua.
- Observability: Prometheus
/metrics,/healthand/ready, structured logging withlog/slog(text/JSON), optional pprof. - Distribution: prebuilt binaries for Linux, macOS, Windows and FreeBSD (amd64/arm64), multi-arch distroless images on
ghcr.io/wutlu/boltcache,go install github.com/wutlu/boltcache@latest.
Added
- RESP listener (
server.resp, port 6382) with incremental, zero-copy parsing: pipelining, partial reads and inline commands are handled correctly. The TCP port (6380) auto-detects RESP, so Redis clients work there too. - REST endpoints:
GET /list/{key},DELETE /set/{key}/{member},GET /hash/{key},DELETE /hash/{key}/{field},GET /cache/{key}/ttl,GET /keys(paginated),POST /command(run any command),/health,/ready,/metrics.GET /cache/{key}returns lists, sets and hashes too. - Real token management:
POST/GET/DELETE /auth/tokenscreate, list (masked, with usage statistics) and revoke runtime tokens valid for every protocol. ${VAR}/${VAR:-default}environment expansion in configuration files andBOLTCACHE_CONFIG.boltcache config show,boltcache version,boltcache config generate --force;config validatereports every problem at once.boltcache client benchmark: parallel, pipelined load generator with p50/p99 latency.client interactiveis now a RESP client similar toredis-cli, andclient testruns a feature check.features.lua_timeout,cache.default_ttl/max_ttlfor the REST API,persistence.compression,security.rate_limitandsecurity.tlsnow take effect.- Web client: "run any command" box, token stored in the browser, works on any host/port.
- CI on Linux and macOS with the race detector, fuzzing and golangci-lint; GoReleaser and Docker release automation; Dependabot.
Fixed
- The Redis-compatible port hung on any command other than
PING,SETandGET(no reply was sent), which also maderedis-benchmarkhang at startup. - Commands split across TCP packets were silently dropped, and only the first three arguments of a command were parsed.
- On the high-performance text port, any command starting with
sorgwas treated asSET/GET(e.g.SADD x ystored a value). - Authentication was configured but never enforced: the middleware was commented out, so tokens in
config-dev.yamlprotected nothing. - Data races between hash/set/list writes, reads and snapshots could crash the server with
concurrent map read and map write. - After a restart, values written over RESP came back base64-encoded, and writing to a restored hash/set/list wiped its previous contents.
- Persistence wrote the snapshot in place, so a crash during a save could leave a truncated file.
- Pub/sub: dead subscribers were never removed, one slow subscriber blocked publishers, and concurrent writes to a WebSocket could panic the server.
POST /evalpanicked when Lua scripting was disabled;ParseMemorySize("1")panicked.- The web client was vulnerable to XSS through cached values and pub/sub messages, and was hard-wired to
localhost:8090. KEYS/PSUBSCRIBEglob matching could take exponential time on hostile patterns.config validateignored--config;config generateoverwrote existing files;SIGTERMdidn't stop the HTTP server gracefully.
Changed
- Breaking: the Go module path is
github.com/wutlu/boltcacheand Go 1.26 or newer is required to build. - Breaking: authentication is enforced when
security.auth.enabledis true (see above). - Breaking: writing a different type to an existing key returns
WRONGTYPEinstead of silently replacing it, and replies follow Redis (e.g.HSETreturns the number of new fields,DELthe number of deleted keys). - Breaking: the separate gnet text listener on
tcp.port + 1(6381) was removed; port 6380 now runs on gnet and serves both protocols. - Breaking: the
clustercommand was removed. It started an isolated node and never replicated data; replication is on the roadmap. gorilla/muxwas replaced with the standard library router;gopkg.in/yaml.v3(archived) withgo.yaml.in/yaml/v3. All dependencies were updated.- Defaults:
server.modeisboth, the REST port is 8090 everywhere,eviction_thresholdis 1.0, snapshot compression is off, andcors_originsis empty (same origin only) instead of*, so web pages you visit can't use a local BoltCache. Non-GET requests from origins that aren't allowed get403. - The Docker image is distroless, runs as non-root, is multi-arch and is configured through
BOLTCACHE_*environment variables;docker-compose.ymlwas fixed. - Swagger UI assets are pinned to a fixed version; the OpenAPI document covers every endpoint and declares the auth schemes.
Install
docker run -d -p 6382:6382 -p 8090:8090 -v boltcache-data:/data ghcr.io/wutlu/boltcache:2.0.0
go install github.com/wutlu/boltcache/v2@latest # from 2.0.1Or download a binary below. Upgrading from 1.x? Read the Upgrading from 1.x section of the README first: authentication is now enforced and a few behaviours changed.