What Is a Valkey Java Client?

As highly available, distributed systems became the norm in enterprise application development, the in-memory data store became a foundational piece of backend architecture. For years, Redis was the default choice in this category, but a March 2024 switch to a dual-license model led to the emergence of the open source Valkey.

Since then, Valkey has had one of the fastest adoption rates in the history of open source software. Part of this success is due to Valkey being a drop-in replacement for Redis, which greatly eases the transition. For developers, a bigger question was whether their Redis client — the software tool that helps them leverage the in-memory data store in their apps — would still work as a Valkey Java client.

Here's a look at what a Valkey Java client is, the different clients available, and why enterprise developers need one.

What Is Valkey, and How Is It Different From Redis?

Before getting into the details of Java clients, it's important to understand what Valkey is, its relationship to Redis, and how the two differ.

Valkey was created as a community-driven, open source fork of Redis, spearheaded by the Linux Foundation, after Redis Inc. announced that its flagship software would shift to a dual-source license. The new Redis licensing model raised immediate concerns about potential "poison pill" clauses and vendor lock-in, leading to rapid, widespread adoption of Valkey. Since the Valkey project began, both Valkey and Redis have each added some unique features. But, for the most part, the two are still remarkably similar.

Valkey and Redis store data directly in RAM to achieve microsecond response times. Developers can manipulate complex data structures such as lists, sets, sorted sets, hashes, bit arrays, and streams directly in memory on either platform. And both are very versatile, serving as everything from a basic key-value database to a reliable message broker using publish/subscribe patterns and a session store for managing web user data.

What Is a Valkey Java Client, and How Does It Work?

Just like Redis, Valkey communicates over a network using an optimized protocol known as RESP (Redis Serialization Protocol) and has no native integration with Java.

For Java developers to read or write data on a Valkey server, they must create their own methods and classes based on RESP — or they can use client software that takes care of the heavy lifting for them. A Valkey Java client does just that, acting as an intermediary, translating standard Java method calls into the low-level RESP commands that the Valkey server can process.

A full-featured Java client can do even more, such as handling connection pooling to reduce the latency overhead of constantly opening network sockets, or managing thread safety to ensure highly concurrent applications operate smoothly. Advanced clients also handle data serialization automatically, allowing developers to store complex Java objects directly in Valkey.

Examples of Valkey Java Clients:

Developers looking for a Valkey Java client have a few examples to choose from, including:

Valkey GLIDE

Valkey General Language Independent Driver for the Enterprise (GLIDE) is the official Valkey client, sponsored by AWS. It's written in Rust and wrapped with language-specific Java bindings.

valkey-java

Forked from the Redis Java client Jedis, valkey-java is a lightweight solution for executing Valkey commands within Java code.

Redisson

Redisson is a comprehensive Java client for Valkey or Redis and a premium real-time data platform. Rather than just providing a thin wrapper around database commands, Redisson bridges the gap by offering over 50 distributed Java objects. Developers interact with Valkey through familiar interfaces such as Maps, Sets, and Locks.

Using Redisson as a Valkey Java Client

Redisson sets itself apart from other Java clients by making it remarkably simple for Java developers to learn. This is tied to Redisson's objects and methods that immediately feel familiar to any Java developer. Take a look at this code and see how simple it is to configure Redisson, interact with a distributed map, and secure a critical section of code using a lock:

// Redisson connects to a Valkey server the same way it connects to Redis
Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379"); // point at your Valkey node
RedissonClient redisson = Redisson.create(config);

// All Redisson objects and services work against Valkey unchanged
RMap scores = redisson.getMap("leaderboard");
scores.put("player:1", 100);

RLock lock = redisson.getLock("job:lock");
lock.lock();
try {
    // critical section
} finally {
    lock.unlock();
}

redisson.shutdown();

Similar terms