Valkey Documentation

website·Indexed 40 days ago

https://valkey.io

Valkey is an open source (BSD licensed), in-memory data structure store used as a database, cache, and message broker. This documentation covers command references (including GEOADD, XREADGROUP, and CLUSTER commands), the Lua 5.1 sandbox environment, RESP protocol bulk loading, memory optimization, and module integrations like Valkey-Search and LDAP authentication.

Tokens
320.6K
Snippets
1.5K
Records
2.3K
Agent score
73%

What's inside Valkey

  1. Overview of Valkey-Search capabilities

    Valkey-Search is a high-performance search engine provided as a Valkey module (BSD-3-Clause). It is optimized for AI-driven workloads, analytics, and recommendation systems, offering single-digit millisecond latency and high QPS. It supports:

    • Vector Search: Approximate Nearest Neighbor (ANN) using HNSW and exact matching using K-Nearest Neighbors (KNN), capable of handling billions of vectors with >99% recall.
    • Non-Vector Search: Numeric, Tag, and Full-text searches.
    • Data Types: Supports indexing data stored in Valkey Hash or Valkey-JSON formats.
  2. Overview of Valkey leader-follower replication

    Valkey uses a leader-follower (primary-replica) replication model where replicas are exact copies of the primary. The system is primarily asynchronous for high performance and low latency, though it supports optional synchronous replication via the WAIT command to ensure a specific number of replicas have acknowledged writes.

    Key characteristics include:

    • Non-blocking Primary: The primary continues to handle queries during initial or partial resynchronization.
    • Replica Flexibility: Replicas can be chained (cascading replication), where sub-replicas receive the same stream from the primary.
    • Automatic Recovery: Replicas automatically reconnect to the primary if the link breaks.
    • Read Scalability: Replicas can be used to offload read-only queries or slow O(N) operations from the primary.
  3. Overview of Atomic Slot Migration in Valkey 9.0

    Atomic Slot Migration is a feature introduced in Valkey 9.0 to improve the resharding process (moving data slots between nodes). Unlike the legacy process that moved keys individually and caused client redirections, Atomic Slot Migration uses a replication-based approach.

    Key benefits include:

    • Reduced Client Impact: Clients are unaware of the migration; there are no -ASK redirections or multi-key operation errors.
    • Improved Performance: Up to 9x faster migrations compared to legacy methods.
    • Better Reliability: Improved handling of large keys/collections and built-in support for cancellation and automated rollback on failure.
    • Simplified Interface: Supports multiple slot ranges in a single command.
  4. Overview of Valkey JSON capabilities

    Valkey JSON provides native support for storing, querying, and updating JSON documents in Valkey 8.0 and above. It is compliant with RFC7159 and ECMA-404. It supports six data types: null, boolean, number, string, object, and array. Internally, it uses an optimized binary tree-like format to allow rapid traversal and manipulation of substructures without rewriting the entire document. It also integrates with Valkey's Access Control Lists (ACLs) via the @json command category.
  5. Overview of Bloom Filters in Valkey

    Valkey introduces Bloom Filters via the valkey-bloom module (compatible with Valkey >= 8.0). Bloom filters are space-efficient probabilistic data structures used for membership testing. They guarantee no false negatives (if an item was added, it will always be reported as existing), but allow for false positives (an item may be reported as existing even if it wasn't added). This makes them ideal for high-volume applications where memory efficiency is prioritized over absolute precision, such as advertisement deduplication.
  6. Overview of Valkey Streams

    A Stream in Valkey is an append-only log data structure that supports random access in O(1) time and complex consumption strategies like consumer groups. It is ideal for event sourcing (tracking user actions), sensor monitoring, and notification systems. Streams allow for both 'fan-out' messaging (multiple consumers seeing the same data) and time-series storage (querying by time ranges).
  7. Overview of Valkey Sentinel capabilities

    Valkey Sentinel provides high availability for Valkey deployments (when not using Valkey Cluster). Its primary capabilities include:

    • Monitoring: Constantly checks if primary and replica instances are working as expected.
    • Notification: Notifies administrators or programs via API when a monitored instance fails.
    • Automatic Failover: Promotes a replica to primary if the primary fails, reconfigures other replicas, and informs clients of the new primary address.
    • Configuration Provider: Acts as a source of authority for service discovery; clients query Sentinels to find the current primary address for a given service.
  8. Overview of Valkey's origin as a Redis fork

    Valkey is an open-source fork of the Redis (REmote DIctionary Server) database. It was created to maintain open-source development under the BSD license after Redis Ltd. changed the Redis license from BSD to dual source-available licenses (RSALv2 and SSPLv1) in 2024.
  9. Overview of k0rdent Multi-Cluster Management

    k0rdent is a Kubernetes-native distributed container management platform that automates the deployment and lifecycle of child clusters across multi-cloud and hybrid environments. It acts as a 'super control plane' where infrastructure and cluster providers are packaged as Helm templates. Users define child clusters declaratively using the ClusterDeployment object.
  10. Overview of Valkey Bundle and included modules

    Valkey Bundle is a pre-packaged, containerized version of Valkey that includes several modules to extend core functionality with advanced data structures and search capabilities. Included modules are:

    • Valkey JSON: Native storage, querying, and modification of JSON data using JSONPath.
    • Valkey Bloom: Space-efficient probabilistic data structures (Bloom filters).
    • Valkey Search: Indexing and similarity searches using complex filters.
    • Valkey LDAP: User authentication against LDAP-based identity providers.
  11. Overview of valkey-bundle

    valkey-bundle is a single-container distribution designed for low-latency, real-time applications. It bundles Valkey 8.1.1 with four specialized modules: Valkey JSON (document storage), Valkey Bloom (probabilistic filtering), Valkey Search (vector similarity search), and Valkey LDAP (enterprise authentication). This bundle simplifies CI/CD pipelines and eliminates dependency conflicts by providing these tools in one image.
  12. Overview of the Valkey RESP Protocol

    Valkey clients use the REdis Serialization Protocol (RESP) to communicate with the server. RESP is a binary-safe serialization protocol designed to be simple to implement, fast to parse, and human-readable. It uses prefixed lengths for bulk data to avoid expensive processing.

    Key characteristics:

    • It is used exclusively over TCP connections (or Unix sockets).
    • The default server port is 6379.
    • It follows a request-response model where clients send commands as arrays of bulk strings and the server replies with a type determined by the command and protocol version.
    • The protocol uses \r\n (CRLF) as the universal terminator to separate parts of the payload.