What Zettuce is
Zettuce ("Zero-Copy Lettuce") is a fast, zero-dependency alternative to the Java Lettuce client for Valkey and Redis-compatible servers—backed by one C11 networking engine shared across Java 22+ FFM, Rust, Python, and C.
Why replace Lettuce?
Lettuce is built on Netty and Project Reactor. Even for a simple synchronous GET or SET, a Lettuce request hops from your application thread onto a Netty event-loop thread, allocates command and ByteBuf wrappers, copies buffers through the OS kernel TCP stack, waits for an epoll wakeup, decodes RESP objects on the JVM heap, and signals back to the caller thread.
Zettuce removes every one of those hops:
- Zero-copy RDMA data path: Writes RESP frames straight into registered NIC memory (
IBV_WR_RDMA_WRITE_WITH_IMMwithIBV_SEND_INLINE) and polls completions in userspace—bypassing both the OS kernel and CPU copies for 7.98 µs p50 latency. - Single-syscall Linux
io_uringTCP: When running over ordinary TCP, Zettuce linksIORING_OP_SEND+IORING_OP_RECVwith a registered fixed socket fd into a singleio_uring_enter()syscall, beating Lettuce 7.9.0 (Netty Epoll) by 1.67×–2.62×. - Zero JVM dependencies: The Java module uses Java 22+ Panama Foreign Function & Memory (FFM) directly with zero Netty or Reactor JARs.
- Pointer-stable C11 RESP2/3 arena: Parses replies directly out of RX memory into a slab-based bump arena with zero per-command
malloc/freeor JVM garbage.
Four transport modes
RDMA(default — Valkey)- Uses Valkey's native RDMA module (
valkey-rdma.so) over RoCE or InfiniBand. Loadslibibverbs.so.1andlibrdmacm.so.1dynamically at runtime viadlopen. Requires Valkey (Redis does not support RDMA). TCP(Valkey & Redis)- Works with any standard Valkey or Redis server—no RDMA NIC required. Automatically uses Linux
io_uringon Linux 5.6+ and falls back silently to optimizedepollwhen blocked by container seccomp profiles or whenZETTUCE_TCP_NO_IOURING=1is set. UNIX(Unix Domain Sockets — Valkey & Redis)- Connects to a local Valkey or Redis socket path (e.g.,
/var/run/valkey/valkey.sock,/var/run/redis/redis.sock, orunix:///tmp/valkey.sock) overAF_UNIXusing the same single-syscallio_uring/epollengine—ideal for co-located sidecars and single-host deployments. AUTO- Attempts RDMA on the primary port first; if RDMA hardware, the RDMA listener, or RDMA support (such as on Redis) is unavailable, transparently connects over TCP on
tcpFallbackPort(or the same port). Ideal for running one codebase across CI, cloud VMs, Redis, and RDMA Valkey racks.
Platform support (Linux native engine + pure-Java dev fallback): Zettuce's native C11 engine targets Linux x86_64 and aarch64 (RDMA verbs, Linux io_uring, epoll, and AF_UNIX). On macOS/Windows developer workstations or older-glibc Linux hosts, zettuce-java automatically falls back to a zero-dependency pure-Java TCP/Unix RESP2/RESP3 backend for TCP, AUTO, and UNIX transports. For production non-Linux servers (Windows/FreeBSD), use Lettuce.
Shared C11 architecture
Full feature coverage
- TLS 1.2/1.3, mTLS & dynamic credential rotation: OpenSSL (dynamically loaded in C/Java/Rust/Python) + JSSE fallback with SNI/IP-SAN verification, mTLS, explicit refusal to downgrade to cleartext RDMA, and dynamic
CredentialsProviderrotation on every connect/reconnect. - Read-from-replicas & live Sentinel failover:
ReadFrom(MASTER,MASTER_PREFERRED,REPLICA_PREFERRED,REPLICA,ANY,LOWEST_LATENCY) across Cluster,MasterReplicaPool, and liveSentinelPool(+switch-mastersubscription + polling fallback +READONLYauto-recovery). - Cluster scaling: Per-node connection pooling (
connectionsPerNode), shard-grouped pipelinedcluster.batch(), cross-slot scatter-gather (mget/mset/del, Rustdel_multi, Pythondelete_multi), background topology refresh, and automaticMOVED/ASK/TRYAGAIN/CLUSTERDOWNhandling. - RESP3 Client-Side Caching & Observability: Built-in
LatencyHistogram,CommandListenerSPI,ZettuceClientCache/ClientCache(CLIENT TRACKING ON BCASTwith heartbeat + disconnect-flush safety), and optionalzettuce-observability(Micrometer & OpenTelemetry). - Full commands & codecs: Strings, Hashes (incl.
HEXPIRE/HTTL), Lists, Sets, Sorted Sets, Geo, HyperLogLog, Bitmaps, Lua/Valkey Functions, Streams consumer groups, typedSCAN/HSCAN/SSCAN/ZSCAN, ACL, single-doorbell batching, Sharded Pub/Sub, and pluggableZettuceCodec<K, V>. - Java ecosystem & GraalVM 25 Native Image: Zero-dependency core
zettuce-javaplus optional first-classzettuce-spring(Spring Data RedisRedisTemplate&@Cacheable),zettuce-micronaut(@Cacheable&ZettuceTemplate),zettuce-observability, and built-in GraalVM 25+ Native Image FFM metadata.
License
Zettuce — including the C11 engine, Java FFM client, Rust crate, Python C-extension, and test suites — is open source under the Apache License, Version 2.0.