AWS Builder Center
Getting Started with Valkey: The Open Source In-Memory Database for Modern Applications

Getting Started with Valkey: The Open Source In-Memory Database for Modern Applications

Learn what Valkey is, why it was created, and how developers can use it for caching, session storage, real-time analytics, and high-performance applications on AWS

Cloud, Data | AWS Student Builder Group Leader

Getting Started with Valkey: The Open Source In-Memory Database for Modern Applications

Modern applications demand speed. Whether you're building an e-commerce platform, a gaming backend, or an AI-powered application, reducing latency is essential for delivering a great user experience.
This is where Valkey comes in.
Valkey is an open source, high-performance, in-memory data store that can be used as a cache, database, or message broker. It is designed for applications that require extremely fast data access while remaining scalable and reliable.

What is Valkey?

Valkey is a community-driven fork of Redis OSS that continues development under an open governance model.
It is fully open source and is maintained by contributors from organizations across the cloud-native ecosystem.
Since Valkey follows the Redis protocol, many existing Redis clients and applications can work with little or no modification.

Why Use Valkey?

Valkey offers several advantages for developers:
  • Extremely low latency
  • High throughput
  • Open source governance
  • Compatible with many Redis clients
  • Multiple built-in data structures
  • Active community support
  • Suitable for cloud-native deployments
These features make it an excellent choice for modern distributed applications.

Common Use Cases

1. Caching

Store frequently accessed data in memory to reduce database load.
Examples:
  • Product catalog
  • User profiles
  • API responses
  • Dashboard data
Instead of querying the database repeatedly, applications retrieve data directly from Valkey, resulting in significantly faster response times.

2. Session Storage

Web applications can store user sessions in Valkey.
Benefits include:
  • Fast authentication
  • Centralized session management
  • Easy scaling across multiple application servers

3. Real-Time Leaderboards

Gaming applications often need to rank players instantly.
Using sorted sets, Valkey can efficiently maintain leaderboards with minimal latency.

4. Rate Limiting

Protect APIs from abuse by limiting the number of requests per user.
This is commonly used for:
  • Login endpoints
  • Public APIs
  • Payment services

5. Message Queues

Applications can exchange events asynchronously using Valkey's messaging capabilities.
Examples include:
  • Notification systems
  • Order processing
  • Background workers

Popular Data Structures

One of Valkey's biggest strengths is its rich collection of data structures.

Strings

Perfect for:
  • Counters
  • Tokens
  • Cached values

Lists

Useful for:
  • Task queues
  • Activity feeds

Sets

Great for:
  • Unique visitors
  • Tags
  • Membership tracking

Sorted Sets

Ideal for:
  • Rankings
  • Scores
  • Leaderboards

Hashes

Efficient storage for objects like:
  • User information
  • Product details
  • Configuration values

Running Valkey Locally

If you have Docker installed, getting started is simple.
1
2
3
4
docker run -d \
--name valkey \
-p 6379:6379 \
valkey/valkey
Verify the container:
1
docker ps
Connect to Valkey:
1
docker exec -it valkey valkey-cli
Try a simple example:
1
2
SET language AWS
GET language
Output:
1
"AWS"

Using Valkey on AWS

AWS offers managed support for Valkey through Amazon ElastiCache.
With Amazon ElastiCache, developers don't need to manage infrastructure manually.
Key benefits include:
  • Automatic backups
  • Monitoring with Amazon CloudWatch
  • High availability
  • Automatic failover
  • Scaling
  • Security with VPC integration
This allows teams to focus on building applications rather than managing cache servers.

Best Practices

When working with Valkey:
  • Set expiration (TTL) for cache entries.
  • Monitor memory usage regularly.
  • Use appropriate data structures for each workload.
  • Avoid storing unnecessarily large objects.
  • Secure deployments using authentication and network isolation.
  • Benchmark your workloads before production deployment.

When Should You Choose Valkey?

Valkey is a great choice if your application requires:
  • Low-latency responses
  • High request throughput
  • Distributed caching
  • Session management
  • Real-time analytics
  • Gaming leaderboards
  • API rate limiting
  • Event-driven architectures

Final Thoughts

Valkey combines performance, flexibility, and an open-source community-driven development model. Whether you're building cloud-native applications, AI-powered platforms, or large-scale web services, it provides a reliable foundation for handling high-speed data access.
If you're already using AWS, Amazon ElastiCache for Valkey makes deployment and operations even simpler by providing a fully managed experience.
As developers continue building increasingly data-intensive applications, Valkey is becoming an excellent option for delivering fast, scalable, and efficient systems.

Happy Building! 🚀
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article