Self-host Valkey
9.0.7Open-source in-memory key-value store and cache server
sudo apt install valkey- Stars
- 27 715
- Ports
- 6379 (default TCP client port), 16379 (cluster bus port used when running in cluster mode)
valkey/valkeyWhat is Valkey?
Valkey is a BSD-3-licensed, in-memory data structure server that began life as a fork of Redis, taken before that project switched to source-available terms, and today sits under the Linux Foundation. Engineers reach for it when they need quick key/value access: as a cache in front of a slower store, as a queue or lightweight streaming backbone, or even as the primary database behind a service. Values can be strings and numbers, hashes, lists, sets and sorted sets, and there are also bitmaps, hyperloglogs, geospatial indexes plus streams. Durability is configurable rather than mandatory - you can snapshot to RDB on a schedule, append every write to an AOF log, combine the two, or turn persistence off entirely. Scaling paths include primary/replica copies, Sentinel-driven failover for availability and Valkey Cluster to shard keys automatically, while I/O threading uses several cores for network work. On the programmability side it ships Lua scripting, transactions, Pub/Sub channels, expiring keys, LRU/LFU eviction under a memory cap, module loading for new types and commands, and TLS for client, replication and cluster-bus traffic. Access control comes from an ACL system with named users, or the simpler requirepass password. Deployment options are the valkey/valkey container image, distro packages such as apt, apk, yum, Homebrew and MacPorts, release tarballs for arm64 and x86_64, or a plain make (or experimental CMake) build on Linux, macOS and the BSDs - Windows is only supported through WSL. Fresh installs listen on TCP 6379 with no password and can bind every interface, so the docs stress firewalls, a narrow bind, protected mode and credentials before exposing an instance. Built binaries can also be given redis-server and redis-cli symlinks so older Redis toolchains keep working.
Valkey alternatives
KeyDBA Multithreaded Fork of RedisCompareKeyDB with Valkey
RedisRedis is a self-hosted, open-source in-memory data structure server used as a database, cache, message broker, and vector query engine with sub-millisecond latency.CompareRedis with Valkey
minikvA self-hosted, open-source distributed key-value and object store written in Rust that achieves strong consistency through Raft consensus and two-phase commit.Compareminikv with Valkey
gtsdbGTSDB is a self-hosted, open-source time-series database in Go using WAL-first architecture for sub-millisecond reads and 233x faster writes than InfluxDB.Comparegtsdb with Valkey
MemcachedSelf-hosted, open-source in-memory object cache that fronts databases and APIs; a single multithreaded daemon pooling RAM across your own servers.CompareMemcached with Valkey
swiftwaveSwiftWave: self-hosted open source PaaS for deploying apps on any server. Alternative to Heroku/Netlify/Render with 1GB RAM min and integrated app store.Compareswiftwave with Valkey
memgraphSelf-hosted, open-source in-memory graph database with Cypher, vector indexes and the MAGE algorithm library for GraphRAG and real-time graph analytics.Comparememgraph with Valkey
etcdA self-hosted, open-source distributed key-value store using Raft consensus for critical data in clustered systems. CNCF graduated project.Compareetcd with Valkey
Should you self-host Valkey?
Valkey scores 81/100 on selfhost.directory (how scoring works) and ranks #3 of 38 in Databases. It has 27 715 GitHub stars, +324 in the last 30 days.
It shipped 22 stable releases in the past year. The latest, 9.0.7, came out on 27 October 2026.
Setup is easy: most people get it running in one sitting. An official Docker image is available. It is BSD-3-Clause-licensed and written mostly in C.
Its closest alternative on selfhost.directory is Redis (86/100, 77 489 stars). It scores higher overall, so compare the two before you pick. See Valkey vs Redis side by side.
Features
- Access control lists (ACL)
- Append-only file persistence
- Asynchronous replication
- High availability with Sentinel
- I/O threading
- Key expiration (TTL)
- Key/value data structures
- Lua ScriptingCan be compiled out with `make BUILD_LUA=no`.
- Memory limit and eviction policies
- Module plugins
- Pub/Sub messaging
- RDB snapshot persistence
- TLS EncryptionSentinel mode does not support the TLS module.
- Transactions
Valkey README
This project was forked from the open source Redis project right before the transition to their new source available licenses.
This README is just a fast quick start document. More details can be found under valkey.io
FAQ
Why did Linux Foundation start the Valkey project?
The FAQ points to the project history topic page for the background behind the Linux Foundation launching Valkey.
Why does my replica have a different number of keys than its primary instance?
With expiring keys this is expected: the RDB used for the first sync omits keys logically expired on the primary but still resident, so the replica loads fewer entries while both are logically identical.
What is the maximum number of keys a single Valkey instance can hold? What is the maximum number of elements in a Hash, List, Set, and Sorted Set?
Up to 2^32 keys per instance, with at least 250 million keys proven in practice, and each collection type can hold 2^32 elements. Realistically available memory is the limit.
How can Valkey use multiple CPUs or cores?
Turn on I/O threading, rewritten and much improved in version 8, to move client reading and writing off the main thread. Alternatively run several instances on the machine and group them into a cluster.
Are Valkey on-disk snapshots atomic?
Yes. The background save process is forked between command executions, so anything atomic in RAM is also atomic in the snapshot on disk.
Background saving fails with a fork() error on Linux?
Background saves rely on copy-on-write fork, and with overcommit_memory set to 0 Linux refuses the fork unless enough free RAM exists to duplicate everything. Setting overcommit_memory to 1 lets the fork proceed optimistically.
What happens if Valkey runs out of memory?
The maxmemory setting caps usage; once it is hit the server rejects write commands but still answers read-only ones. You can instead have it evict keys under an eviction policy.
How can I reduce Valkey' overall memory usage?
Plan the physical data model deliberately by picking suitable types and key patterns, and normalizing data. The Memory Optimization topic page covers further techniques.
Why does Valkey keep its entire dataset in memory?
The project tried virtual memory and similar approaches but decided to do one thing well: serve data from memory and use disk only for storage, so there are no plans for an on-disk backend.
What's the Valkey memory footprint?
An idle instance takes roughly 3 MB, one million small key/string pairs about 85 MB, and one million hashes with five fields about 160 MB. You can measure your own workload with valkey-benchmark plus the INFO memory command.
How is Valkey different from other key-value stores?
Its values can hold richer data types with atomic operations defined directly on them, without an extra abstraction layer. It is in-memory yet persisted to disk, so reads and writes are very fast while the dataset must fit in memory, and its two on-disk formats stay compact and append-only.
More in Databases
VectorChordSelf-hosted PostgreSQL extension for scalable vector search using RaBitQ quantization, compatible with pgvector syntax, enabling 100M+ vectors on modest hardware.
victoriametricsOpen-source, self-hosted time series database and monitoring backend that replaces Prometheus or Graphite as Grafana's metrics store, with PromQL and MetricsQL querying.
yantrikdb-serverSelf-hosted memory DB for AI agents with recall, graph, contradiction detection, decay. Embedded lib, MCP server, or replicated cluster.
AntflyAntfly is a self-hosted, open-source Zig database unifying full-text, vector, and graph search with built-in ML for embeddings, reranking, and RAG.
Apache CassandraSelf-hosted, open-source distributed NoSQL database: a masterless partitioned row store with multi-datacenter replication, queried with CQL over the native protocol.
Apache CouchDBSelf-hosted, open-source Apache CouchDB is a document database with an HTTP/JSON API, bi-directional replication for offline-first sync, and multi-server clustering.
Apache IoTDBApache IoTDB is a self-hosted, open-source time-series database for industrial IoT with high-throughput reads/writes, ultra-high compression, and SQL-like queries.
arangodbSelf-hosted multi-model database for documents, graphs and key-values, queried in one AQL language; the open-source Community edition is free for non-commercial use.
autobaseOpen-source MIT DBaaS for PostgreSQL: Patroni-based HA clusters, backups, failover and upgrades driven from a web console, Ansible collection or GitOps.
brain-dbSelf-hosted memory database for AI agents with fused semantic, lexical, graph, and temporal retrieval. Single Rust core, binary wire protocol, Apache-2.0.
chromaOpen-source vector database for AI retrieval: dense, sparse, full-text, regex and metadata search. Self-host it with pip, the chroma CLI, or Docker on port 8000.
CondensationAn open-source distributed data system for app builders: conflict-free sync, end-to-end encryption and self-hosted store servers on a file system or MySQL.
0 comments