diff --git a/.github/workflows/sentence-per-line.yml b/.github/workflows/sentence-per-line.yml new file mode 100644 index 00000000..203684b5 --- /dev/null +++ b/.github/workflows/sentence-per-line.yml @@ -0,0 +1,27 @@ +name: Sentence per line + +on: + pull_request: + branches: ["main"] + paths: + - "content/blog/**" + - ".github/workflows/sentence-per-line.yml" + +permissions: + contents: read + pull-requests: read + +jobs: + check: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + + # Only the files a PR changes, so one post that slips through doesn't fail every later PR. + - name: Check one sentence per line + uses: madolson/sentence-per-line@a8a3ecebed791b3087fd6e0b94af1224f8cd1a20 # v1.0.0 + with: + paths: content/blog + scope: changed-files + annotation-level: error diff --git a/content/blog/2024-06-27-using-bitnami-valkey-chart/index.md b/content/blog/2024-06-27-using-bitnami-valkey-chart/index.md index c3051ca6..e974c1a1 100644 --- a/content/blog/2024-06-27-using-bitnami-valkey-chart/index.md +++ b/content/blog/2024-06-27-using-bitnami-valkey-chart/index.md @@ -14,9 +14,12 @@ featured_image = "/assets/media/featured/random-01.webp" +++ -> **Due to changes in the [Bitnami catalog](https://github.com/bitnami/charts/issues/35164)**, the contents of this blog post are, as of September 2025, likely out-of-date and the helm chart **does not represent an operational best practice** without a subscription. This post is preserved for historical reference only. You can track work towards a project-provided Helm chart at [valkey-io/valkey#2371](https://github.com/valkey-io/valkey/issues/2371). +> **Due to changes in the [Bitnami catalog](https://github.com/bitnami/charts/issues/35164)**, the contents of this blog post are, as of September 2025, likely out-of-date and the helm chart **does not represent an operational best practice** without a subscription. +> This post is preserved for historical reference only. +> You can track work towards a project-provided Helm chart at [valkey-io/valkey#2371](https://github.com/valkey-io/valkey/issues/2371). -Valkey is a high-performance key/value datastore that supports workloads such as caching, and message queues, supporting many data types including strings, numbers, hashes, bitmaps, and more. Valkey can run in standalone or cluster mode for replication and high availability. +Valkey is a high-performance key/value datastore that supports workloads such as caching, and message queues, supporting many data types including strings, numbers, hashes, bitmaps, and more. +Valkey can run in standalone or cluster mode for replication and high availability. [Bitnami](https://bitnami.com/) offers a number of secure, up-to-date, and easy to deploy charts for a number of popular open source applications. @@ -26,7 +29,8 @@ This blog will serve as a walkthrough on how you can deploy and use the [Bitnami Before starting the deployment, make sure that you have the following prerequisites: - An operational Kubernetes cluster. -- An installed and configured kubectl CLI and Helm v3.x package manager. If you need help with these steps, check our article “[Learn how to install kubectl and Helm v3.x.](https://docs.bitnami.com/kubernetes/get-started-kubernetes#step-3-install-kubectl-command-line)” +- An installed and configured kubectl CLI and Helm v3.x package manager. + If you need help with these steps, check our article “[Learn how to install kubectl and Helm v3.x.](https://docs.bitnami.com/kubernetes/get-started-kubernetes#step-3-install-kubectl-command-line)” - Optional: Access to [VMware Tanzu Application Catalog](https://app-catalog.vmware.com/catalog). # Deploying the Bitnami package for the Valkey Helm chart @@ -35,7 +39,8 @@ The sections below describe the steps to configure the deployment, get and deplo ## Getting and deploying the Bitnami package for Valkey Helm chart -You can deploy the [community](https://github.com/bitnami/charts/blob/main/LICENSE.md) Bitnami-packaged Valkey Helm chart from the open source Bitnami Application Catalog. Alternatively, if you have access to an enterprise Tanzu Application Catalog instance, it can also be deployed from there. +You can deploy the [community](https://github.com/bitnami/charts/blob/main/LICENSE.md) Bitnami-packaged Valkey Helm chart from the open source Bitnami Application Catalog. +Alternatively, if you have access to an enterprise Tanzu Application Catalog instance, it can also be deployed from there. ### Deploying the open source version of the chart through Bitnami Application Catalog @@ -48,11 +53,15 @@ $ helm install myvalkey oci://registry-1.docker.io/bitnamicharts/valkey --set au ### Deploying the enterprise version of the chart through Tanzu Application Catalog -The following steps describe navigating the Tanzu Application Catalog and getting the instructions to deploy Valkey in your cluster. This example shows a Valkey chart built using Ubuntu 22 as the base OS image, but feel free to customize the chart depending on your needs. +The following steps describe navigating the Tanzu Application Catalog and getting the instructions to deploy Valkey in your cluster. +This example shows a Valkey chart built using Ubuntu 22 as the base OS image, but feel free to customize the chart depending on your needs. 1. Navigate to [app-catalog.vmware.com](https://app-catalog.vmware.com) and sign in to your catalog with your VMware account. ![Tanzu Library](images/using-bitnami-valkey-chart_1.png) -3. In the My Applications section, search for Valkey and request it for your catalog. It is supported by Photon, Ubuntu, RHEL UBI, and Debian Linux distributions. On the next screen, you will find the instructions for deploying the chart on your cluster. Make sure that your cluster is up and running. +3. In the My Applications section, search for Valkey and request it for your catalog. + It is supported by Photon, Ubuntu, RHEL UBI, and Debian Linux distributions. + On the next screen, you will find the instructions for deploying the chart on your cluster. + Make sure that your cluster is up and running. 4. Execute **kubectl cluster-info**, then run the commands you will find in the Consume your Helm chart section. ![Tanzu Application Catalog](images/using-bitnami-valkey-chart_2.png) @@ -101,7 +110,8 @@ myvalkey-master:6379> get test_key ## Using a Python environment -The next example explains how to connect to Valkey using a Python script. To run the script, first, it is needed to provide a Python environment and install Python’s Redis package. +The next example explains how to connect to Valkey using a Python script. +To run the script, first, it is needed to provide a Python environment and install Python’s Redis package. ```bash $ kubectl run -it python-redis --image=bitnami/python -- bash @@ -147,7 +157,8 @@ b'bar' ## Using Valkey as a cache for WordPress -Valkey can also work as an object cache for a WordPress deployment. The following steps will show you how to set up this scenario. +Valkey can also work as an object cache for a WordPress deployment. +The following steps will show you how to set up this scenario. First, it is needed to create the configuration for the WordPress deployment, in this case, Valkey’s parameters and the user credential for the site administrator are set. @@ -180,16 +191,20 @@ service/mywp-wordpress LoadBalancer 10.100.136.181 192.168.49.50 80:31116/TCP, Using the external IP, browse to the admin page and log in using the previously set credentials. -You will be able to see the WordPress administrator UI where you can search for `Redis Object Cache` plugin, and then install and activate it. After enabling it, wait for some metrics to appear: +You will be able to see the WordPress administrator UI where you can search for `Redis Object Cache` plugin, and then install and activate it. +After enabling it, wait for some metrics to appear: ![Redis Object Cache Metrics](images/using-bitnami-valkey-chart_4.png) -This is only a drop in the bucket of what can be done with Valkey. Thereafter you could easily integrate Valkey into your projects. +This is only a drop in the bucket of what can be done with Valkey. +Thereafter you could easily integrate Valkey into your projects. # Support and resources -The Bitnami package for Valkey is available in both the community version, through the [Bitnami GitHub repository](https://github.com/bitnami/charts/tree/main/bitnami/valkey/#installing-the-chart), as well as the enterprise version, [Tanzu Application Catalog](https://app-catalog.vmware.com/catalog/f1242d16-218e-4773-8856-adcb2b2006e9/branch/1542f88a-71c4-42ed-b79c-89bd2063ac9a). Learn more about the differences between these two catalogs in this [blog post](https://tanzu.vmware.com/content/blog/open-source-vs-enterprise-edition-of-vmware-bitnami-application-catalog). +The Bitnami package for Valkey is available in both the community version, through the [Bitnami GitHub repository](https://github.com/bitnami/charts/tree/main/bitnami/valkey/#installing-the-chart), as well as the enterprise version, [Tanzu Application Catalog](https://app-catalog.vmware.com/catalog/f1242d16-218e-4773-8856-adcb2b2006e9/branch/1542f88a-71c4-42ed-b79c-89bd2063ac9a). +Learn more about the differences between these two catalogs in this [blog post](https://tanzu.vmware.com/content/blog/open-source-vs-enterprise-edition-of-vmware-bitnami-application-catalog). -To solve the problems you may have with the Bitnami community packages—including deployment support, operational support, and bug fixes—please open an issue in the Bitnami [Helm charts](https://github.com/bitnami/charts) or [containers](https://github.com/bitnami/containers) GitHub repositories. Also, if you want to contribute to the catalog, feel free to send us a [pull request](https://github.com/bitnami/containers/pulls), and the team will check it and guide you in the process for a successful merge. +To solve the problems you may have with the Bitnami community packages—including deployment support, operational support, and bug fixes—please open an issue in the Bitnami [Helm charts](https://github.com/bitnami/charts) or [containers](https://github.com/bitnami/containers) GitHub repositories. +Also, if you want to contribute to the catalog, feel free to send us a [pull request](https://github.com/bitnami/containers/pulls), and the team will check it and guide you in the process for a successful merge. If you are interested in learning more about the Tanzu Application Catalog in general, check out the [product webpage](https://tanzu.vmware.com/application-catalog). diff --git a/content/blog/2024-07-07-unlock-one-million-rps.md b/content/blog/2024-07-07-unlock-one-million-rps.md index c4b7ae0a..58fb0b17 100644 --- a/content/blog/2024-07-07-unlock-one-million-rps.md +++ b/content/blog/2024-07-07-unlock-one-million-rps.md @@ -22,7 +22,8 @@ featured_image = "/assets/media/featured/random-01.webp" Valkey 8.0, set for release in September 2024, will bring major performance enhancements through a variety of improvements including a new multi-threaded architecture. This update aims to significantly boost throughput and reduce latency across various hardware configurations. Read on to learn more about the new innovative I/O threading implementation and its impact on performance and efficiency. -This post is the first in a two-part series. The next post will dive into the new prefetch mechanism and its impact on performance. +This post is the first in a two-part series. +The next post will dive into the new prefetch mechanism and its impact on performance. ### Our Commitment to performance and efficiency At AWS, we have hundreds of thousands of customers using Amazon ElastiCache and Amazon MemoryDB. @@ -83,7 +84,8 @@ Therefore, we decided to offload `epoll_wait` execution to the I/O threads in th I/O threads never sleep on `epoll`, and whenever there are pending I/O operations or commands to be executed, `epoll_wait` calls are scheduled to the I/O threads by the main thread. In all other cases, the main thread executes the `epoll_wait` with the waiting time as in the original Valkey implementation -In addition, before executing commands, the main thread performs a new procedure, prefetch-commands-keys, which aims to reduce the number of external memory accesses needed when executing the commands on the main dictionary. A detailed explanation of the technique used in that procedure will be described in our next blog +In addition, before executing commands, the main thread performs a new procedure, prefetch-commands-keys, which aims to reduce the number of external memory accesses needed when executing the commands on the main dictionary. +A detailed explanation of the technique used in that procedure will be described in our next blog ### Testing and Availability The enhanced performance will be available for testing in the first release candidate of Valkey, available today. diff --git a/content/blog/2024-07-31-valkey-8-0-0-rc1.md b/content/blog/2024-07-31-valkey-8-0-0-rc1.md index 17f672b2..9a00a5f4 100644 --- a/content/blog/2024-07-31-valkey-8-0-0-rc1.md +++ b/content/blog/2024-07-31-valkey-8-0-0-rc1.md @@ -23,17 +23,21 @@ featured_image = "/assets/media/featured/random-07.webp" The Valkey community is proud to unveil the first release candidate of Valkey 8.0, a major update designed to enhance performance, reliability, and observability -for all Valkey installations. In this blog, we'll dive a bit deeper into each of these +for all Valkey installations. +In this blog, we'll dive a bit deeper into each of these areas and talk about the exciting features we've built for this release. ## Performance Valkey 8.0 features significant improvements to the existing I/O threading system, -allowing the main thread and I/O threads to operate concurrently. This release also +allowing the main thread and I/O threads to operate concurrently. +This release also includes a number of improvements to offload work to the I/O threads and introduces -efficient batching of commands. Altogether, Valkey 8.0 is designed to handle up to +efficient batching of commands. +Altogether, Valkey 8.0 is designed to handle up to 1.2 million Queries Per Second (QPS) on AWS's r7g platform, compared to the previous -limit of 380K QPS. We'll dive deeper into these numbers in an upcoming blog. +limit of 380K QPS. +We'll dive deeper into these numbers in an upcoming blog. NOTE: Not all improvements are available in the release candidate, but they will be available in the GA release of Valkey 8.0. @@ -57,16 +61,20 @@ Valkey 8.0 improves reliability and minimizes disruptions with the following enhancements: - **Automatic Failover for Empty Shards**: New shards that start empty, owning - no slots, now benefit from automatic failover. This ensures high availability + no slots, now benefit from automatic failover. + This ensures high availability from the start of the scaling process. - **Replication of Slot Migration States**: All `CLUSTER SETSLOT` commands are - now replicated synchronously to replicas before execution on the primary. This + now replicated synchronously to replicas before execution on the primary. + This reduces the chance of unavailability if the primary fails, as the replicas have - the most up-to-date information about the state of the shard. New replicas also + the most up-to-date information about the state of the shard. + New replicas also automatically inherit the state from the primary without additional input from an operator. - **Slot Migration State Recovery**: In the event of a failover, Valkey 8.0 automatically - updates the slot migration states on source and target nodes. This ensures requests + updates the slot migration states on source and target nodes. + This ensures requests are continuously routed to the correct primary in the target shard, maintaining cluster integrity and availability. @@ -87,7 +95,8 @@ the replica backlog to be transferred simultaneously, accelerating synchronizati client queries and improving overall responsiveness. Performance tests show improvements in write latency during sync, and in scenarios -with heavy read commands, the sync time can be cut by up to 50%. This translates +with heavy read commands, the sync time can be cut by up to 50%. +This translates to a more responsive system, even during synchronization. For more details on these improvements, you can refer to [#60](https://github.com/valkey-io/valkey/pull/60). @@ -116,13 +125,15 @@ For more details on these improvements, you can refer to [#712](https://github.c Valkey 8.0 introduces two new improvements that reduce the memory overhead of keys, allowing users to store more data without any application changes. The first change is that keys are now embedded in the main dictionary, eliminating separate -key pointers and significantly reducing memory overhead. This results in a 9-10% +key pointers and significantly reducing memory overhead. +This results in a 9-10% reduction in overall memory usage for scenarios with 16-byte keys and 8 or 16-byte values, along with performance improvements. This release also introduces a new per-slot dictionary for Valkey cluster, which replaces a linked list that used to allow operator to list out all the keys in -a slot for slot-migration. The new architecture splits the main dictionary by slot, +a slot for slot-migration. +The new architecture splits the main dictionary by slot, reducing the memory overhead by 16 bytes per key-value pair without degrading performance. For more details on these improvements, you can refer to [#541](https://github.com/valkey-io/valkey/pull/541) @@ -147,11 +158,14 @@ and [Redis#11695](https://github.com/redis/redis/pull/11695). ## Conclusion Valkey 8.0 is a major update that offers improved performance, reliability, and -observability. Whether you are an experienced Valkey/Redis user or exploring +observability. +Whether you are an experienced Valkey/Redis user or exploring it for the first time, this release provides significant advancements in in-memory -data storage. You can try out these enhancements today by downloading from +data storage. +You can try out these enhancements today by downloading from [source](https://github.com/valkey-io/valkey/releases/tag/8.0.0-rc1) or using one -of our [container images](https://hub.docker.com/r/valkey/valkey). We would love +of our [container images](https://hub.docker.com/r/valkey/valkey). +We would love to hear your thoughts on these new features and what you hope to see in the future from the Valkey project. diff --git a/content/blog/2024-08-29-valkey-memory-efficiency-8-0.md b/content/blog/2024-08-29-valkey-memory-efficiency-8-0.md index 13d79db8..320f5643 100644 --- a/content/blog/2024-08-29-valkey-memory-efficiency-8-0.md +++ b/content/blog/2024-08-29-valkey-memory-efficiency-8-0.md @@ -10,19 +10,33 @@ featured = true featured_image = "/assets/media/featured/random-05.webp" +++ -Valkey 8.0 GA is around the corner and one of the themes is increasing overall memory efficiency. Memory overhead reduction has the obvious effect of better resource utilization, but also impacts performance. By minimizing unnecessary memory consumption, you can store more data with the same hardware resources and improve overall system responsiveness. This post is going to give an overview into how Valkey internally manages the data and its memory overhead. Additionally, it talks about the two major improvements for Valkey 8.0 that improves the overall memory efficiency. +Valkey 8.0 GA is around the corner and one of the themes is increasing overall memory efficiency. +Memory overhead reduction has the obvious effect of better resource utilization, but also impacts performance. +By minimizing unnecessary memory consumption, you can store more data with the same hardware resources and improve overall system responsiveness. +This post is going to give an overview into how Valkey internally manages the data and its memory overhead. +Additionally, it talks about the two major improvements for Valkey 8.0 that improves the overall memory efficiency. ## Overview -Valkey has two modes of operation: standalone and cluster mode. Standalone allows for one primary with it’s replica(s). To shard data horizontally and scale to store large amounts of data, cluster mode provides a mechanism to set up multiple primaries each with their own replica(s). +Valkey has two modes of operation: standalone and cluster mode. +Standalone allows for one primary with it’s replica(s). +To shard data horizontally and scale to store large amounts of data, cluster mode provides a mechanism to set up multiple primaries each with their own replica(s). ![Figure 1 Standalone (left) and Cluster mode (right)](/assets/media/pictures/valkey_operation_mode.png) -For both standalone and cluster mode setup, Valkey's main dictionary is a hash table with a chained linked list: The major components are a **bucket** and **dictionary entry**. A key is hashed to a bucket and each bucket points to a linked list of dictionary entries and further each dictionary entry consists of key, value, and a next pointer. Each pointer takes 8 bytes of memory usage. So, a single dictionary entry has a minimum overhead of 24 bytes. +For both standalone and cluster mode setup, Valkey's main dictionary is a hash table with a chained linked list: The major components are a **bucket** and **dictionary entry**. +A key is hashed to a bucket and each bucket points to a linked list of dictionary entries and further each dictionary entry consists of key, value, and a next pointer. +Each pointer takes 8 bytes of memory usage. +So, a single dictionary entry has a minimum overhead of 24 bytes. ![Figure 2 Dictionary bucket pointing to a dictionary entry](/assets/media/pictures/dictionary_bucket_and_entry_overview.png) -In cluster mode, Valkey uses a concept called [hash slots](https://valkey.io/topics/cluster-tutorial/) to shard data. There are 16,384 hash slots in cluster, and to compute the hash slot for a given key, the server computes the CRC16 of the key modulo 16,384. Keys are distributed on basis of these slots assigned to each of the primary. The server needs to maintain additional metadata for bookkeeping i.e. slot-to-key mapping to move a slot from one primary to another. In order to maintain the slot to key mapping, two additional pointers `slot-prev` and `slot-next` (Figure 3) are stored as metadata in each dictionary entry forming a double linked list of all keys belonging to a given slot. This further increases the overhead by 16 bytes per dictionary entry i.e. total 40 bytes. +In cluster mode, Valkey uses a concept called [hash slots](https://valkey.io/topics/cluster-tutorial/) to shard data. +There are 16,384 hash slots in cluster, and to compute the hash slot for a given key, the server computes the CRC16 of the key modulo 16,384. +Keys are distributed on basis of these slots assigned to each of the primary. +The server needs to maintain additional metadata for bookkeeping i.e. slot-to-key mapping to move a slot from one primary to another. +In order to maintain the slot to key mapping, two additional pointers `slot-prev` and `slot-next` (Figure 3) are stored as metadata in each dictionary entry forming a double linked list of all keys belonging to a given slot. +This further increases the overhead by 16 bytes per dictionary entry i.e. total 40 bytes. ![Figure 3 Dictionary in cluster mode (Valkey 7.2) with multiple key value pair](/assets/media/pictures/dictionary_in_cluster_mode_7.2.png) @@ -30,25 +44,40 @@ In cluster mode, Valkey uses a concept called [hash slots](https://valkey.io/top ### Optimization 1 - [Dictionary per slot](https://github.com/redis/redis/pull/11695) -The first optimization is a dictionary per slot (16,384 of them in total), where each dictionary stores data for a given slot. With this simplification, the cost of maintaining additional metadata for the mapping of slot to key is no longer required in Valkey 8. To iterate over all the keys in a given slot, the engine simply finds out the dictionary for a given slot and traverse all the entries in it. This reduces the memory usage per dictionary entry by 16 bytes with a small memory overhead around 1 MB per node. As cluster mode is generally used for storing large amount of keys, avoiding the additional overhead per key allows users to store more number of keys in the same amount of memory. +The first optimization is a dictionary per slot (16,384 of them in total), where each dictionary stores data for a given slot. +With this simplification, the cost of maintaining additional metadata for the mapping of slot to key is no longer required in Valkey 8. +To iterate over all the keys in a given slot, the engine simply finds out the dictionary for a given slot and traverse all the entries in it. +This reduces the memory usage per dictionary entry by 16 bytes with a small memory overhead around 1 MB per node. +As cluster mode is generally used for storing large amount of keys, avoiding the additional overhead per key allows users to store more number of keys in the same amount of memory. ![Figure 4 Dictionary in cluster mode (Valkey 8.0) with multiple key value pair](/assets/media/pictures/dictionary_in_cluster_mode_8.0.png) -A few of the interesting challenges that comes up with the above improvements are supporting existing use cases which were optimized with a single dictionary for the entire keyspace. The usecases are: +A few of the interesting challenges that comes up with the above improvements are supporting existing use cases which were optimized with a single dictionary for the entire keyspace. +The usecases are: * [Iterating the entire keyspace](https://valkey.io/commands/scan/) - Command like `SCAN` to iterate over the entire keyspace. * [Random key for eviction](https://valkey.io/topics/lru-cache/) - The server does random sampling of the keyspace to find ideal candidate for eviction. * [Finding a random key](https://valkey.io/commands/randomkey/) - Commands like `RANDOMKEY` retrieve a random key from the database. -In order to efficiently implement these functions, we need to be able to both find non-empty slots, to skip over empty slots during scanning, and be able to select a random slot weighted by the number of keys that it owns. These requirements require a data structure which provides the following functionality: +In order to efficiently implement these functions, we need to be able to both find non-empty slots, to skip over empty slots during scanning, and be able to select a random slot weighted by the number of keys that it owns. +These requirements require a data structure which provides the following functionality: 1. Modify value for a given slot - If a key gets added or removed, increment or decrement the value for that given slot by 1 respectively. 2. Cumulative frequency until each slot - For a given number representing a key between 1 and the total number of keys, return the slot which covers the particular key. -If approached naively, the former and latter operation would take O(1) and O(N) respectively. However, we want to minimize the latter operation’s time complexity and minimally avoid in the former. Hence, a [binary indexed tree (BIT) or fenwick tree](https://www.topcoder.com/thrive/articles/Binary%20Indexed%20Trees) which provides the above functionality with a minimal memory overhead (~1 MB per node) and the time complexity is also bounded to O(M log N) for both the operations where M = number of modification(s) and N = number of slots. This enables skipping over empty slots efficiently while iterating over the keyspace as well as finding a slot for a given key index in logarithmic time via binary search over the cumulative sum maintained by the BIT. +If approached naively, the former and latter operation would take O(1) and O(N) respectively. +However, we want to minimize the latter operation’s time complexity and minimally avoid in the former. +Hence, a [binary indexed tree (BIT) or fenwick tree](https://www.topcoder.com/thrive/articles/Binary%20Indexed%20Trees) which provides the above functionality with a minimal memory overhead (~1 MB per node) and the time complexity is also bounded to O(M log N) for both the operations where M = number of modification(s) and N = number of slots. +This enables skipping over empty slots efficiently while iterating over the keyspace as well as finding a slot for a given key index in logarithmic time via binary search over the cumulative sum maintained by the BIT. -Another interesting side effect is on the rehashing operation. Rehashing is CPU intensive. By default, a limited number of buckets are allocated in a dictionary and it expands/shrinks dynamically based on usage. While undergoing rehashing, all the data needs to be moved from an old dictionary to a new dictionary. With Valkey 7.2, a global dictionary being shared across all the slots, all the keys get stored under a single dictionary and each time the fill factor (number of keys / number of buckets) goes above 1, the dictionary needs to move to a larger dictionary (multiple of 2) and move a large amount of keys. As this operation is performed on the fly, it causes an increase in latency for regular command operations while it's ongoing. With the per-slot dictionary optimization, the impact of rehashing is localized to the specific dictionary undergoing the process and only a subset of keys needs to be moved. +Another interesting side effect is on the rehashing operation. +Rehashing is CPU intensive. +By default, a limited number of buckets are allocated in a dictionary and it expands/shrinks dynamically based on usage. +While undergoing rehashing, all the data needs to be moved from an old dictionary to a new dictionary. +With Valkey 7.2, a global dictionary being shared across all the slots, all the keys get stored under a single dictionary and each time the fill factor (number of keys / number of buckets) goes above 1, the dictionary needs to move to a larger dictionary (multiple of 2) and move a large amount of keys. +As this operation is performed on the fly, it causes an increase in latency for regular command operations while it's ongoing. +With the per-slot dictionary optimization, the impact of rehashing is localized to the specific dictionary undergoing the process and only a subset of keys needs to be moved. Overall, with this new approach, the benefits are: @@ -57,7 +86,9 @@ Overall, with this new approach, the benefits are: ### Optimization 2 - [Key embedding into dictionary entry](https://github.com/valkey-io/valkey/pull/541) -After the dictionary per slot change, the memory layout of dictionary entry in cluster mode is the following, there are three pointers (key, value, and next). The key pointer points to a SDS ([simple dynamic string](https://github.com/antirez/sds/blob/master/README.md)) which contains the actual key data. As a key is immutable, without bringing in much complexity, it can be embedded into the dictionary entry which has the same lifetime as the former. +After the dictionary per slot change, the memory layout of dictionary entry in cluster mode is the following, there are three pointers (key, value, and next). +The key pointer points to a SDS ([simple dynamic string](https://github.com/antirez/sds/blob/master/README.md)) which contains the actual key data. +As a key is immutable, without bringing in much complexity, it can be embedded into the dictionary entry which has the same lifetime as the former. ![Figure 5 Key data storage in 7.2 (left) and 8.0 (right)](/assets/media/pictures/key_embedding.png) @@ -70,7 +101,8 @@ With this new approach, the overall benefits are: #### Setup -A single shard cluster is setup with 1 primary and 2 replica(s). Each node runs with different version to highlight the memory improvements with each optimization introduced between 7.2 to 8.0 and to signify that no additional configuration is required to achieve the memory efficiency. +A single shard cluster is setup with 1 primary and 2 replica(s). +Each node runs with different version to highlight the memory improvements with each optimization introduced between 7.2 to 8.0 and to signify that no additional configuration is required to achieve the memory efficiency. * Node A: Primary running on port 6379 with [Valkey 7.2 version](https://github.com/valkey-io/valkey/commit/ad0a24c7421d3a8ea76cf44b56001e3b3b6ed545) * Node B: Replica 1 running on port 6380 with [optimization 1 - dictionary per slot](https://github.com/valkey-io/valkey/commit/1ea49e5845a11250a13273c725720822c26860f1) @@ -141,5 +173,8 @@ So, the drop in percentage is approximately **20.63% in overall memory usage on ## Conclusion -Through the memory efficiency achieved by introducing dictionary per slot and key embedding into dictionary entry, users should have additional capacity to store more keys per node in Valkey 8.0 (up to 20%, but it will vary based on the workload). For users, upgrading from Valkey 7.2 to Valkey 8.0, the improvement should be observed automatically and no configuration changes are required. -Give it a try by spinning up a [Valkey cluster](https://valkey.io/download/) and join us in the [community](https://github.com/valkey-io/valkey/) to provide feedback. Further, there is an ongoing discussion around overhauling the main dictionary with a more compact memory layout and introduce an open addressing scheme which will significantly improve memory efficiency. More details can be found in [Issue 169: Re-thinking the main hash table](https://github.com/valkey-io/valkey/issues/169). +Through the memory efficiency achieved by introducing dictionary per slot and key embedding into dictionary entry, users should have additional capacity to store more keys per node in Valkey 8.0 (up to 20%, but it will vary based on the workload). +For users, upgrading from Valkey 7.2 to Valkey 8.0, the improvement should be observed automatically and no configuration changes are required. +Give it a try by spinning up a [Valkey cluster](https://valkey.io/download/) and join us in the [community](https://github.com/valkey-io/valkey/) to provide feedback. +Further, there is an ongoing discussion around overhauling the main dictionary with a more compact memory layout and introduce an open addressing scheme which will significantly improve memory efficiency. +More details can be found in [Issue 169: Re-thinking the main hash table](https://github.com/valkey-io/valkey/issues/169). diff --git a/content/blog/2024-09-13-unlock-one-million-rps-part2.md b/content/blog/2024-09-13-unlock-one-million-rps-part2.md index 5ce1ae30..3dd93056 100644 --- a/content/blog/2024-09-13-unlock-one-million-rps-part2.md +++ b/content/blog/2024-09-13-unlock-one-million-rps-part2.md @@ -20,12 +20,20 @@ featured = false featured_image = "/assets/media/featured/random-06.webp" +++ - In the [first part](/blog/unlock-one-million-rps/) of this blog, we described how we offloaded almost all I/O operations to I/O threads, thereby freeing more CPU cycles in the main thread to execute commands. When we profiled the execution of the main thread, we found that a considerable amount of time was spent waiting for external memory. This was not entirely surprising, as when accessing random keys, the probability of finding the key in one of the processor caches is relatively low. Considering that external memory access latency is approximately 50 times greater than L1 cache, it became clear that despite showing 100% CPU utilization, the main process was mostly “waiting”. In this blog, we describe the technique we have been using to increase the number of parallel memory accesses, thereby reducing the impact that external memory latency has on performance. + In the [first part](/blog/unlock-one-million-rps/) of this blog, we described how we offloaded almost all I/O operations to I/O threads, thereby freeing more CPU cycles in the main thread to execute commands. + When we profiled the execution of the main thread, we found that a considerable amount of time was spent waiting for external memory. + This was not entirely surprising, as when accessing random keys, the probability of finding the key in one of the processor caches is relatively low. + Considering that external memory access latency is approximately 50 times greater than L1 cache, it became clear that despite showing 100% CPU utilization, the main process was mostly “waiting”. + In this blog, we describe the technique we have been using to increase the number of parallel memory accesses, thereby reducing the impact that external memory latency has on performance. ### Speculative execution and linked lists -Speculative execution is a performance optimization technique used by modern processors, where the processor guesses the outcome of conditional operations and executes in parallel subsequent instructions ahead of time. Dynamic data structures, such as linked lists and search trees, have many advantages over static data structures: they are economical in memory consumption, provide fast insertion and deletion mechanisms, and can be resized efficiently. However, some dynamic data structures have a major drawback: they hinder the processor's ability to speculate on future memory load instructions that could be executed in parallel. This lack of concurrency is especially problematic in very large dynamic data structures, where most pointer accesses result in high-latency external memory access. +Speculative execution is a performance optimization technique used by modern processors, where the processor guesses the outcome of conditional operations and executes in parallel subsequent instructions ahead of time. +Dynamic data structures, such as linked lists and search trees, have many advantages over static data structures: they are economical in memory consumption, provide fast insertion and deletion mechanisms, and can be resized efficiently. +However, some dynamic data structures have a major drawback: they hinder the processor's ability to speculate on future memory load instructions that could be executed in parallel. +This lack of concurrency is especially problematic in very large dynamic data structures, where most pointer accesses result in high-latency external memory access. -In this blog, Memory Access Amortization, a method that facilitates speculative execution to improve performance, is introduced along with how it is applied in Valkey. The basic idea behind the method is that by interleaving the execution of operations that access random memory locations, one can achieve significantly better performance than by executing them serially. +In this blog, Memory Access Amortization, a method that facilitates speculative execution to improve performance, is introduced along with how it is applied in Valkey. +The basic idea behind the method is that by interleaving the execution of operations that access random memory locations, one can achieve significantly better performance than by executing them serially. To depict the problem we are trying to solve consider the following [function](/assets/C/list_array.c) which gets an array of linked list and returns sum of all values in the lists: ```c @@ -44,7 +52,8 @@ unsigned long sequentialSum(size_t arr_size, list **la) { return res; } ``` -Executing this function on an array of 16 lists containing 10 million elements each takes approximately 20.8 seconds on an ARM processor (Graviton 3). Now consider the following alternative implementation which instead of scanning the lists separately, interleaves the executions of the lists scans: +Executing this function on an array of 16 lists containing 10 million elements each takes approximately 20.8 seconds on an ARM processor (Graviton 3). +Now consider the following alternative implementation which instead of scanning the lists separately, interleaves the executions of the lists scans: ```c unsigned long interleavedSum(size_t arr_size, list **la) { list **lthreads = malloc(arr_size * sizeof(list *)); @@ -72,9 +81,15 @@ unsigned long interleavedSum(size_t arr_size, list **la) { return res; } ``` -Running this new version with the same input as previously described takes less than 2 seconds, achieving a 10x speedup! The explanation for this significant improvement lies in the processor's speculative execution capabilities. In a standard sequential traversal of a linked list, as seen in the first version of the function, the processor cannot 'speculate' on future memory access instructions. This limitation becomes particularly costly with large lists, where each pointer access likely results in a expensive external memory access. In contrast, the alternative implementation, which interleaves list traversals, allows the processor to issue more memory accesses in parallel. This leads to an overall reduction in memory access latency through amortization. - -One way to maximize the amount of parallel memory access issued is to add prefetch instructions. Replacing +Running this new version with the same input as previously described takes less than 2 seconds, achieving a 10x speedup! +The explanation for this significant improvement lies in the processor's speculative execution capabilities. +In a standard sequential traversal of a linked list, as seen in the first version of the function, the processor cannot 'speculate' on future memory access instructions. +This limitation becomes particularly costly with large lists, where each pointer access likely results in a expensive external memory access. +In contrast, the alternative implementation, which interleaves list traversals, allows the processor to issue more memory accesses in parallel. +This leads to an overall reduction in memory access latency through amortization. + +One way to maximize the amount of parallel memory access issued is to add prefetch instructions. +Replacing ```c if (lthreads[i] == NULL) n--; @@ -90,13 +105,24 @@ reduces the execution time further to 1.8 sec. ### Back to Valkey -In the first part, we described how we updated the existing I/O threads implementation to increase parallelism and reduce the amount of I/O operations executed by the main thread to a minimum. Indeed, we observed an increase in the number of requests per second, reaching up to 780K SET commands per second. Profiling the execution revealed that Valkey's main thread was spending more than 40% of its time in a single function: lookupKey, whose goal is to locate the command keys in Valkey's main dictionary. This dictionary is implemented as a straightforward chained hash, as shown in the picture below: +In the first part, we described how we updated the existing I/O threads implementation to increase parallelism and reduce the amount of I/O operations executed by the main thread to a minimum. +Indeed, we observed an increase in the number of requests per second, reaching up to 780K SET commands per second. +Profiling the execution revealed that Valkey's main thread was spending more than 40% of its time in a single function: lookupKey, whose goal is to locate the command keys in Valkey's main dictionary. +This dictionary is implemented as a straightforward chained hash, as shown in the picture below: ![dict find](/assets/media/pictures/lookupKey.jpg) -On a large enough set of keys, almost every memory address accessed while searching the dictionary will not be found in any of the processor caches, resulting in costly external memory accesses. Also, similarly as with the linked list from above, since the addresses in the table→dictEntry→...dictEntry→robj sequence are serially dependent, it is not possible to determine the next address to be accessed before the previous address in the chain has been resolved. +On a large enough set of keys, almost every memory address accessed while searching the dictionary will not be found in any of the processor caches, resulting in costly external memory accesses. +Also, similarly as with the linked list from above, since the addresses in the table→dictEntry→...dictEntry→robj sequence are serially dependent, it is not possible to determine the next address to be accessed before the previous address in the chain has been resolved. ### Batching and interleaving -To overcome this inefficiency, we adopted the following approach. Every time a batch of incoming commands from the I/O threads is ready for execution, Valkey’s main thread efficiently prefetches the memory addresses needed for future lookupKey invocations for the keys involved in the commands before executing the commands. This prefetch phase is achieved by dictPrefetch, which, similarly as with the linked list example from above, interleaves the table→dictEntry→...dictEntry→robj search sequences for all keys. This reduces the time spent on lookupKey by more than 80%. Another issue we had to address was that all the incoming parsed commands from the I/O threads were not present in the L1/L2 caches of the core running Valkey’s main thread. This was also resolved using the same method. All the relevant code can be found in [memory_prefetch.c](https://github.com/valkey-io/valkey/blob/unstable/src/memory_prefetch.c). In total the impact of the memory access amortization on Valkey performance is almost 50% and it increased the requests per second to more than 1.19M rps. +To overcome this inefficiency, we adopted the following approach. +Every time a batch of incoming commands from the I/O threads is ready for execution, Valkey’s main thread efficiently prefetches the memory addresses needed for future lookupKey invocations for the keys involved in the commands before executing the commands. +This prefetch phase is achieved by dictPrefetch, which, similarly as with the linked list example from above, interleaves the table→dictEntry→...dictEntry→robj search sequences for all keys. +This reduces the time spent on lookupKey by more than 80%. +Another issue we had to address was that all the incoming parsed commands from the I/O threads were not present in the L1/L2 caches of the core running Valkey’s main thread. +This was also resolved using the same method. +All the relevant code can be found in [memory_prefetch.c](https://github.com/valkey-io/valkey/blob/unstable/src/memory_prefetch.c). +In total the impact of the memory access amortization on Valkey performance is almost 50% and it increased the requests per second to more than 1.19M rps. ### How to reproduce Valkey 8.0 performance numbers @@ -109,13 +135,15 @@ We conducted our tests on an AWS EC2 c7g.4xlarge instance, featuring 16 cores on ### System Configuration -> Note: The core assignments used in this guide are examples. Optimal core selection may vary depending on your specific system configuration and workload. +> Note: The core assignments used in this guide are examples. +> Optimal core selection may vary depending on your specific system configuration and workload. Interrupt affinity - locate the network interface with `ifconfig` (let's assume it is `eth0`) and its associated IRQs with ```bash grep eth0 /proc/interrupts | awk '{print $1}' | cut -d : -f 1 ``` -In our setup, lines `48` to `55` are allocated for `eth0` interrupts. Allocate one core per 4 IRQ lines: +In our setup, lines `48` to `55` are allocated for `eth0` interrupts. +Allocate one core per 4 IRQ lines: ```bash for i in {48..51}; do echo 1000 > /proc/irq/$i/smp_affinity; done for i in {52..55}; do echo 2000 > /proc/irq/$i/smp_affinity; done @@ -124,9 +152,11 @@ Server configuration - launch the Valkey server with these minimal configuration ```bash ./valkey-server --io-threads 9 --save --protected-mode no ``` -`--save` disables dumping to RDB file and `--protected-mode no ` allows connections from external hosts. `--io-threads` number includes the main thread and the IO threads, meaning that in our case 8 I/O threads are launched in addition to the main thread. +`--save` disables dumping to RDB file and `--protected-mode no ` allows connections from external hosts. +`--io-threads` number includes the main thread and the IO threads, meaning that in our case 8 I/O threads are launched in addition to the main thread. -Main thread affinity - pin the main thread to a specific CPU core, avoiding the cores handling IRQs. Here we use core #3: +Main thread affinity - pin the main thread to a specific CPU core, avoiding the cores handling IRQs. +Here we use core #3: ```bash sudo taskset -cp 3 `pidof valkey-server` ``` @@ -145,7 +175,8 @@ Run the benchmark from a separate instance using the following parameters: ./valkey-benchmark -t set -d 512 -r 3000000 -c 650 --threads 50 -h "host-name" -n 100000000000 ``` -> Important: When running the benchmark, it may take a few seconds for the database to get populated and for the performance to stabilize. You can adjust the `-n` parameter to ensure the benchmark runs long enough to reach optimal throughput. +> Important: When running the benchmark, it may take a few seconds for the database to get populated and for the performance to stabilize. +> You can adjust the `-n` parameter to ensure the benchmark runs long enough to reach optimal throughput. ### Testing and Availability diff --git a/content/blog/2024-11-21-testing-the-limits/index.md b/content/blog/2024-11-21-testing-the-limits/index.md index 2e4159dd..5e37e7ad 100644 --- a/content/blog/2024-11-21-testing-the-limits/index.md +++ b/content/blog/2024-11-21-testing-the-limits/index.md @@ -10,23 +10,43 @@ featured = false featured_image = "/assets/media/featured/random-07.webp" +++ -While doing extensive performance testing on a Raspberry Pi is silly, it's made me realize the complexity of performance testing. For example, in some of the tests below I ended up managing to use all of the resources of the Raspberry Pi and achieved terrible performance. Every application has different performance characteristics so we'll walk through what factors to consider when it comes to deploying Valkey. +While doing extensive performance testing on a Raspberry Pi is silly, it's made me realize the complexity of performance testing. +For example, in some of the tests below I ended up managing to use all of the resources of the Raspberry Pi and achieved terrible performance. +Every application has different performance characteristics so we'll walk through what factors to consider when it comes to deploying Valkey. ## The test environment ![Picture of the Compute Module 4 credit Raspberry Pi Ltd (CC BY-SA)](images/cm4.png) -For hardware we are going to be using a Raspberry Pi [Compute Module 4 (CM4)](https://www.raspberrypi.com/products/compute-module-4/?variant=raspberry-pi-cm4001000). It's a single board computer (SBC) that comes with a tiny 1.5Ghz 4-core Broadcom CPU and 8GB of system memory. This is hardly the first device someone would pick when deciding on a production system. Using the CM4 makes it easy to showcase how to optimize Valkey depending on your different hardware constraints. - -Our operating system will be a 64-bit Debian based operating system (OS) called [Rasbian](https://www.raspbian.org/). This distribution is specifically modified to perform well on the CM4. Valkey will run in a docker container orchestrated with docker compose. I like deploying in containers as it simplifies operations. If you'd like to follow along here is [a guide for installing Docker](https://docs.docker.com/engine/install/debian/). Make sure to continue to the [second page of the installation process](https://docs.docker.com/engine/install/linux-postinstall/) as well. It's easy to miss and skipping it could make it harder to follow along. - -We'll be using two CM4s for testing. The first will host Valkey and the second will host the benchmarking software. This setup probably better reflects how most people will run in production. Benchmarking is being done with redis-benchmark because it can be installed with `sudo apt install redis-tools`. Valkey does have its own benchmark utility that comes installed with Valkey. To use valkey-benchmark instead you would need to install Valkey on the benchmarking server or spin up a container and connect into it. Functionally, they both operate nearly the same as of the writing of this article. +For hardware we are going to be using a Raspberry Pi [Compute Module 4 (CM4)](https://www.raspberrypi.com/products/compute-module-4/?variant=raspberry-pi-cm4001000). +It's a single board computer (SBC) that comes with a tiny 1.5Ghz 4-core Broadcom CPU and 8GB of system memory. +This is hardly the first device someone would pick when deciding on a production system. +Using the CM4 makes it easy to showcase how to optimize Valkey depending on your different hardware constraints. + +Our operating system will be a 64-bit Debian based operating system (OS) called [Rasbian](https://www.raspbian.org/). +This distribution is specifically modified to perform well on the CM4. +Valkey will run in a docker container orchestrated with docker compose. +I like deploying in containers as it simplifies operations. +If you'd like to follow along here is [a guide for installing Docker](https://docs.docker.com/engine/install/debian/). +Make sure to continue to the [second page of the installation process](https://docs.docker.com/engine/install/linux-postinstall/) as well. +It's easy to miss and skipping it could make it harder to follow along. + +We'll be using two CM4s for testing. +The first will host Valkey and the second will host the benchmarking software. +This setup probably better reflects how most people will run in production. +Benchmarking is being done with redis-benchmark because it can be installed with `sudo apt install redis-tools`. +Valkey does have its own benchmark utility that comes installed with Valkey. +To use valkey-benchmark instead you would need to install Valkey on the benchmarking server or spin up a container and connect into it. +Functionally, they both operate nearly the same as of the writing of this article. ![Test architecture showing two nodes: a Benchmark server with the ip of 10.0.11.221 with an arrow pointing to a Valkey server with an ip of 10.0.1.136](images/test_setup.png) ## Setting up our environment -Below is a straightforward docker compose file that will start a single Valkey container. This container will bind Valkey to port 6379 on the host device. This means that is exposed to anyone with access to your network! This is important for us to access it from the benchmarking server. +Below is a straightforward docker compose file that will start a single Valkey container. +This container will bind Valkey to port 6379 on the host device. +This means that is exposed to anyone with access to your network! +This is important for us to access it from the benchmarking server. ```yaml # valkey.yaml @@ -44,7 +64,10 @@ volumes: driver: local ``` -Since we are exposing this to our internal network we will create a password for our default user. I used `head -16 /dev/urandom | openssl sha1` to generate a random password. Because of how fast Valkey can process requests a brute force attack could try hundreds of thousands of passwords per second. After generating that password, I put it in a `.env` file in the same directory as our docker compose. +Since we are exposing this to our internal network we will create a password for our default user. +I used `head -16 /dev/urandom | openssl sha1` to generate a random password. +Because of how fast Valkey can process requests a brute force attack could try hundreds of thousands of passwords per second. +After generating that password, I put it in a `.env` file in the same directory as our docker compose. ```bash #.env @@ -57,7 +80,9 @@ Now by running `docker compose -f valkey.yaml up -d` Valkey server will start wi ## Baseline test -Now we are ready to do some baseline testing. We will log into the benchmarking server. If you haven't installed redis-benchmark yet you can do so with `sudo apt install redis-tools`. +Now we are ready to do some baseline testing. +We will log into the benchmarking server. +If you haven't installed redis-benchmark yet you can do so with `sudo apt install redis-tools`. ```bash redis-benchmark -n 1000000 -t set,get -P 16 -q -a --threads 5 -h 10.0.1.136 @@ -72,7 +97,10 @@ Test breakdown: - `-h` - run the test against the specified host - `--threads` - how many threads to generate test data from -Honestly, I was astonished by the first set of results I got. Sure, I expected Valkey to be fast but this speed from a single board computer?? ON A SINGLE THREAD?? It's amazing. +Honestly, I was astonished by the first set of results I got. +Sure, I expected Valkey to be fast but this speed from a single board computer?? +ON A SINGLE THREAD?? +It's amazing. ```bash redis-benchmark -n 1000000 -t set,get -P 16 -q -a e41fb9818502071d592b36b99f63003019861dad --threads 5 -h 10.0.1.136 @@ -84,13 +112,19 @@ Between the two tests we averaged 240,000 requests per second. ## Raising the CPU clock speed -Since Valkey is a single threaded application, it makes sense that higher clock speeds would lead to more performance. I don't expect most people will overclock their servers in production. Different servers may be available with different CPU clock speeds. +Since Valkey is a single threaded application, it makes sense that higher clock speeds would lead to more performance. +I don't expect most people will overclock their servers in production. +Different servers may be available with different CPU clock speeds. -**Note:** Clock speeds generally are only comparable between CPU's with a similar architecture. For example, you could reasonably compare clock speeds between an 12th generation Intel i5 and a 12th generation Intel i7. If the 12th gen i7 had a max clock speed of 5Ghz that doesn't necessarily mean it will be slower than a AMD Ryzen 9 9900X clocked at 5.6Ghz. +**Note:** Clock speeds generally are only comparable between CPU's with a similar architecture. +For example, you could reasonably compare clock speeds between an 12th generation Intel i5 and a 12th generation Intel i7. +If the 12th gen i7 had a max clock speed of 5Ghz that doesn't necessarily mean it will be slower than a AMD Ryzen 9 9900X clocked at 5.6Ghz. -If you're following along on a Pi of your own I've outlined the steps to overclock your CM4 below. Otherwise, you can skip to the results section below. +If you're following along on a Pi of your own I've outlined the steps to overclock your CM4 below. +Otherwise, you can skip to the results section below. -**Warning** Just a reminder overclocking your device can cause damage to your device. Please use caution and do your own research for settings that are safe. +**Warning** Just a reminder overclocking your device can cause damage to your device. +Please use caution and do your own research for settings that are safe. 1. Open the below file - `sudo nano /boot/firmware/config.txt` @@ -102,7 +136,8 @@ If you're following along on a Pi of your own I've outlined the steps to overclo ``` 3. Restart the Pi and log back in `sudo restart now` -We've just increased the speed of the Pi by 47% by raising the clock speed from 1.5Ghz to 2.2Ghz. Now lets re-run our test and see how things look! +We've just increased the speed of the Pi by 47% by raising the clock speed from 1.5Ghz to 2.2Ghz. +Now lets re-run our test and see how things look! ```bash redis-benchmark -n 1000000 -t set,get -P 16 -q -a e41fb9818502071d592b36b99f63003019861dad --threads 5 -h 10.0.1.136 @@ -110,11 +145,16 @@ SET: 394368.41 requests per second, p50=1.223 msec GET: 438058.53 requests per second, p50=1.135 msec ``` -We're up to 416,000 requests per second (reminder this is the average between the two operations). The mathematicians out there might notice that this speed up is a lot more than the expected 47% increase. It's a 73% increase in requests per second. What's happening?! +We're up to 416,000 requests per second (reminder this is the average between the two operations). +The mathematicians out there might notice that this speed up is a lot more than the expected 47% increase. +It's a 73% increase in requests per second. +What's happening?! ## Adding IO Threading -With all these gains I was super excited to try the new [IO threading available](https://valkey.io/blog/unlock-one-million-rps/) in Valkey 8. First we will take down the previous running docker instance with `docker compose -f valkey.yaml down`. Then we will modify the `.env` file's `IO_THREADS` parameter to 5. +With all these gains I was super excited to try the new [IO threading available](https://valkey.io/blog/unlock-one-million-rps/) in Valkey 8. +First we will take down the previous running docker instance with `docker compose -f valkey.yaml down`. +Then we will modify the `.env` file's `IO_THREADS` parameter to 5. ```bash #.env @@ -124,7 +164,8 @@ IO_THREADS=5 ``` -Then we can `docker compose -f valkey.yaml up -d` to start it again. Remote into the benchmarking server to start the test and...? +Then we can `docker compose -f valkey.yaml up -d` to start it again. +Remote into the benchmarking server to start the test and...? ```bash redis-benchmark -n 10000000 -t set,get -P 16 -q -a e41fb9818502071d592b36b99f63003019861dad --threads 5 -h 10.0.1.136 @@ -132,13 +173,18 @@ SET: 345494.75 requests per second, p50=0.911 msec GET: 327858.09 requests per second, p50=0.879 msec ``` -Wait a second... These results are worse than the ones before? We went from 416k requests per second to 336k.... What's happening? +Wait a second... These results are worse than the ones before? +We went from 416k requests per second to 336k.... What's happening? ![A picture of the valkey server with 4 cores represented as boxes. In each of the four core boxes there are other boxes. 2 cores have 1 IO Thread Box, 1 Core has 2 IO thread boxes, and the last one has 1 IO Thread box along with a Valkey Process box.](images/io_threads.png) -We have over-subscribed our CPU. This means we've created more worker threads than CPU cores. When a thread is under constant load it is competing with other threads on that core for resources. Not to mention, they are also competing with the Valkey process for resources. +We have over-subscribed our CPU. +This means we've created more worker threads than CPU cores. +When a thread is under constant load it is competing with other threads on that core for resources. +Not to mention, they are also competing with the Valkey process for resources. -That's why [Valkey recommends](https://github.com/valkey-io/valkey/blob/a62d1f177b7888ec88035a0a1ce600fbc2280ce7/valkey.conf#L1337-L1341) setting the number of threads to be a value less than the number of cores you have. For our little 4 core server lets change the `IO_THREADS` parameter to be 2 threads in the `.env` file and try again. +That's why [Valkey recommends](https://github.com/valkey-io/valkey/blob/a62d1f177b7888ec88035a0a1ce600fbc2280ce7/valkey.conf#L1337-L1341) setting the number of threads to be a value less than the number of cores you have. +For our little 4 core server lets change the `IO_THREADS` parameter to be 2 threads in the `.env` file and try again. ```bash redis-benchmark -n 10000000 -t set,get -P 16 -q -a e41fb9818502071d592b36b99f63003019861dad --threads 5 -h 10.0.1.136 @@ -146,17 +192,29 @@ SET: 609050.44 requests per second, p50=0.831 msec GET: 521186.22 requests per second, p50=0.719 msec ``` -Much better! Now we are seeing around 565,000 requests per second. Thats a 35% increase in performance across both metrics! Not to mention in the picture below you can see that we have 100% utilization across all of our CPU's which means there's no more room for improvement! +Much better! +Now we are seeing around 565,000 requests per second. +Thats a 35% increase in performance across both metrics! +Not to mention in the picture below you can see that we have 100% utilization across all of our CPU's which means there's no more room for improvement! ![A picture of an HTOP window showing all four of our CPU's at 100% utilization.](images/io_threading_htop.png) -Right? Well believe it or not we can squeeze even more performance out of our little CM4! +Right? +Well believe it or not we can squeeze even more performance out of our little CM4! ![A picture of our Valkey server with the 4 core boxes and to the right of them is a memory box. In the first core box is the Valkey process and in the next two there are IO Threads. The valkey process has a loop showing it communicating with both of the IO threads. It also has a bracket showing it managing all the memory.](images/io_threading_arch.png) -Above is a representative outline of what's happening on the server. The Valkey process has to take up valuable cycles managing the IO Threads. Not only that it has to perform a lot of work to manage all the memory assigned to it. That's a lot of work for a single process. +Above is a representative outline of what's happening on the server. +The Valkey process has to take up valuable cycles managing the IO Threads. +Not only that it has to perform a lot of work to manage all the memory assigned to it. +That's a lot of work for a single process. -Now there is actually one more optimization we can use to make single threaded Valkey even faster. Valkey recently has done a substantial amount of work to support speculative execution. This work allows Valkey to predict which values will be needed from memory in future processing steps. This way Valkey server doesn't have to wait for memory access which is an order of magnitude slower than L1 caches. While I won't go through the details of how this works as there's already a [great blog that describes how to take advantage of these optimizations](https://valkey.io/blog/unlock-one-million-rps-part2/). Here are the results: +Now there is actually one more optimization we can use to make single threaded Valkey even faster. +Valkey recently has done a substantial amount of work to support speculative execution. +This work allows Valkey to predict which values will be needed from memory in future processing steps. +This way Valkey server doesn't have to wait for memory access which is an order of magnitude slower than L1 caches. +While I won't go through the details of how this works as there's already a [great blog that describes how to take advantage of these optimizations](https://valkey.io/blog/unlock-one-million-rps-part2/). +Here are the results: ```bash redis-benchmark -n 10000000 -t set,get -P 16 -q -a e41fb9818502071d592b36b99f63003019861dad --threads 5 -h 10.0.1.136 @@ -164,17 +222,25 @@ SET: 632791.25 requests per second, p50=1.191 msec GET: 888573.00 requests per second, p50=0.695 msec ``` -While these results are better they are a bit confusing. After talking with some of Valkey's maintainers it seems there may be something different in the way that Rasbian is configured when it comes to memory writes. In their testing the `GET/SET` requests were nearly identical but in my testing so far the write speed seems to always be behind read speed. If you think you know why please reach out! +While these results are better they are a bit confusing. +After talking with some of Valkey's maintainers it seems there may be something different in the way that Rasbian is configured when it comes to memory writes. +In their testing the `GET/SET` requests were nearly identical but in my testing so far the write speed seems to always be behind read speed. +If you think you know why please reach out! ## Clustered Valkey ![A picture of our Valkey server with the 4 core boxes and to the right of them is a memory box. In the first three core boxes are Valkey processes. Each of them has a bracket around a portion of the memory.](images/valkey_clustered.png) -For our last step we are going to spin up a Valkey cluster. This cluster will have individual instances of Valkey running that each will be responsible for managing their own keys. This way each instance can execute operations in parallel much more easily. +For our last step we are going to spin up a Valkey cluster. +This cluster will have individual instances of Valkey running that each will be responsible for managing their own keys. +This way each instance can execute operations in parallel much more easily. I am not going into detail with how the keyspaces work but [here is a good 101 guide](https://valkey.io/topics/cluster-tutorial/) for understanding clustering in Valkey. -First we'll stop our previous Valkey container `docker compose -f valkey.yaml down`. Now we can create our docker compose file for the cluster. Because each of these are exposed on the host they will all need to be using different ports. Additionally, all of them need to be aware they are started in cluster mode so they can redirect requests to the appropriate instance. +First we'll stop our previous Valkey container `docker compose -f valkey.yaml down`. +Now we can create our docker compose file for the cluster. +Because each of these are exposed on the host they will all need to be using different ports. +Additionally, all of them need to be aware they are started in cluster mode so they can redirect requests to the appropriate instance. ```yaml # valkey-cluster.yaml @@ -220,13 +286,19 @@ kvtest-valkey-node-3-1 kvtest-valkey-node-2-1 ``` -I'll use the first container to finish the cluster creation. Once the containers have started up we have to tell them the details they need to use for the cluster. Below I am using the IP of the host and the port configurations of all the containers to create the cluster. This is because these addresses need to be accessible from the benchmarking server. +I'll use the first container to finish the cluster creation. +Once the containers have started up we have to tell them the details they need to use for the cluster. +Below I am using the IP of the host and the port configurations of all the containers to create the cluster. +This is because these addresses need to be accessible from the benchmarking server. ```bash docker exec -it kvtest-valkey-node-1-1 valkey-cli --cluster create 10.0.1.136:6379 10.0.1.136:6380 10.0.1.136:6381 -a e41fb9818502071d592b36b99f63003019861dad ``` -Now we can run our benchmark! We need to add the `--cluster` flag to our benchmarking command. Also, because this is so fast I ended up moving from 1 million requests to 10 million requests. That way we can make sure Valkey has time to fully utilize all it's resources. +Now we can run our benchmark! +We need to add the `--cluster` flag to our benchmarking command. +Also, because this is so fast I ended up moving from 1 million requests to 10 million requests. +That way we can make sure Valkey has time to fully utilize all it's resources. ```bash redis-benchmark -n 10000000 -t set,get -P 16 -q --threads 10 --cluster -a e41fb9818502071d592b36b99f63003019861dad --threads 5 -h 10.0.1.136 @@ -240,10 +312,20 @@ SET: 1122838.50 requests per second, p50=0.575 msec GET: 1188071.75 requests per second, p50=0.511 msec ``` -**1,155,000 requests per second**. We've managed to double our requests per second. All this on a single board computer that's the size of a credit card. +**1,155,000 requests per second**. +We've managed to double our requests per second. +All this on a single board computer that's the size of a credit card. -While this is far from what I would recommend for a production server these are the same steps I'd recommend to someone evaluating Valkey. It's important test with a single instance to start finding the optimal settings. Then you can begin to scale up your test by adding either more IO Threads or Valkey instances. +While this is far from what I would recommend for a production server these are the same steps I'd recommend to someone evaluating Valkey. +It's important test with a single instance to start finding the optimal settings. +Then you can begin to scale up your test by adding either more IO Threads or Valkey instances. -Testing should mirror your production workload as best it can. This test is using synthetic data. That's why I'd recommend checking out the documentation to find what other settings you may need to test with. For example, we tested with the default settings of 50 client connections and 3 byte payloads. Your production workload may look different so explore all the settings! You may find that IO threading works better for your use case than I did in this case. +Testing should mirror your production workload as best it can. +This test is using synthetic data. +That's why I'd recommend checking out the documentation to find what other settings you may need to test with. +For example, we tested with the default settings of 50 client connections and 3 byte payloads. +Your production workload may look different so explore all the settings! +You may find that IO threading works better for your use case than I did in this case. -If you enjoyed this read make sure to check out my blog [TippyBits.com](https://tippybits.com) where I post content like this on a regular basis. Stay curious my friends! +If you enjoyed this read make sure to check out my blog [TippyBits.com](https://tippybits.com) where I post content like this on a regular basis. +Stay curious my friends! diff --git a/content/blog/2024-12-22-az-affinity-strategy.md b/content/blog/2024-12-22-az-affinity-strategy.md index 452cc1a4..47072883 100644 --- a/content/blog/2024-12-22-az-affinity-strategy.md +++ b/content/blog/2024-12-22-az-affinity-strategy.md @@ -11,46 +11,76 @@ featured_image = "/assets/media/featured/random-04.webp" +++ How can adjusting your client library help you reduce Cloud costs and improve latency? -In this post, we dive into **Availability Zone (AZ) affinity routing** mechanics, showing how it optimizes your application's performance and cost using **Valkey GLIDE (General Language Independent Driver for the Enterprise)**. We also guide you through how to configure GLIDE to benefit from other key features. +In this post, we dive into **Availability Zone (AZ) affinity routing** mechanics, showing how it optimizes your application's performance and cost using **Valkey GLIDE (General Language Independent Driver for the Enterprise)**. +We also guide you through how to configure GLIDE to benefit from other key features. -GLIDE is an official open-source Valkey client library. GLIDE is designed for reliability, optimized performance, and high-availability, for Valkey and Redis-based applications. GLIDE is a multi-language client that supports Java, Python, and Node.js, with further languages in development. GLIDE recently added support for a key feature AZ affinity routing, which enables Valkey-based applications to direct calls specifically to server nodes in the same AZ as the client. This minimizes cross-AZ traffic, reduces latency, and lowers cloud expenses. +GLIDE is an official open-source Valkey client library. +GLIDE is designed for reliability, optimized performance, and high-availability, for Valkey and Redis-based applications. +GLIDE is a multi-language client that supports Java, Python, and Node.js, with further languages in development. +GLIDE recently added support for a key feature AZ affinity routing, which enables Valkey-based applications to direct calls specifically to server nodes in the same AZ as the client. +This minimizes cross-AZ traffic, reduces latency, and lowers cloud expenses. Before we explore AZ affinity routing, let’s understand what availability zones are, how different **read strategies** work and how they impact your application. ## Choosing the Right Read Strategy for Your Application -Distributed applications rely on scalability and resilience, often achieved by techniques like caching, sharding, and high availability. Valkey enhances these systems by acting as a robust caching layer, reducing database load and accelerating read operations. Its sharding capabilities distribute data across multiple nodes, ensuring efficient storage and access patterns, while its high availability features safeguard uptime by replicating data across the primary and replica nodes. This combination enables distributed applications to handle high traffic and recover quickly from failures, ensuring consistent performance. +Distributed applications rely on scalability and resilience, often achieved by techniques like caching, sharding, and high availability. +Valkey enhances these systems by acting as a robust caching layer, reducing database load and accelerating read operations. +Its sharding capabilities distribute data across multiple nodes, ensuring efficient storage and access patterns, while its high availability features safeguard uptime by replicating data across the primary and replica nodes. +This combination enables distributed applications to handle high traffic and recover quickly from failures, ensuring consistent performance. -In Valkey-based applications, selecting the right read strategy is required for optimizing performance and cost. Read strategies determine how read-only commands are routed, balancing factors like data freshness, latency, and throughput. +In Valkey-based applications, selecting the right read strategy is required for optimizing performance and cost. +Read strategies determine how read-only commands are routed, balancing factors like data freshness, latency, and throughput. Understanding the infrastructure that supports these strategies is key to leveraging them effectively. -**Availability Zones** are isolated locations within Cloud regions that provide redundancy and fault tolerance. They are physically separated but connected through low-latency networks. Major cloud providers like AWS, Oracle and GCP implement the concept of AZs. However, using resources across different AZs can incur increased latency and cost. +**Availability Zones** are isolated locations within Cloud regions that provide redundancy and fault tolerance. +They are physically separated but connected through low-latency networks. +Major cloud providers like AWS, Oracle and GCP implement the concept of AZs. +However, using resources across different AZs can incur increased latency and cost. GLIDE takes advantage of this infrastructure by routing reads to replica nodes within the same AZ, enabling faster responses and improved user experience. -This is particularly advantageous for applications that prioritize read throughput and can tolerate slightly stale data. For instance, websites with personalized recommendation engines rely on displaying content quickly to users rather than ensuring every update is perfectly synchronized. -Additionally, one of the most common use cases for caching is to store database query results, allowing applications to trade off absolute freshness for better performance, scalability, and cost-effectiveness. The read-from-replica strategies introduces minimal additional staleness, making it an efficient choice for such scenarios. +This is particularly advantageous for applications that prioritize read throughput and can tolerate slightly stale data. +For instance, websites with personalized recommendation engines rely on displaying content quickly to users rather than ensuring every update is perfectly synchronized. +Additionally, one of the most common use cases for caching is to store database query results, allowing applications to trade off absolute freshness for better performance, scalability, and cost-effectiveness. +The read-from-replica strategies introduces minimal additional staleness, making it an efficient choice for such scenarios. GLIDE provides flexible options tailored to your application’s needs: * ```PRIMARY```: Always read from the primary to ensure the freshness of data. -* ```PREFER_REPLICA```: Distribute requests among all replicas in a round-robin manner. If no replica is available, fall back to the primary. -* ```AZ_AFFINITY```: Prioritize replicas in the same AZ as the client. If no replicas are available in the zone, fall back to other replicas or the primary if needed. -* ```AZ_AFFINITY_REPLICAS_AND_PRIMARY```: Prioritize replicas in the same AZ as the client. If no replicas are available in the zone, fall back to the primary in the same AZ. If neither are available, fall back to other replicas or the primary in other zones. - -In Valkey 8, ```availability-zone``` configuration was introduced, allowing clients to specify the AZ for each Valkey server. GLIDE leverages this new configuration to empower its users with the ability to use AZ Affinity routing. At the time of writing, GLIDE is the only Valkey client library supporting the AZ Affinity strategies, offering a unique advantage. +* ```PREFER_REPLICA```: Distribute requests among all replicas in a round-robin manner. + If no replica is available, fall back to the primary. +* ```AZ_AFFINITY```: Prioritize replicas in the same AZ as the client. + If no replicas are available in the zone, fall back to other replicas or the primary if needed. +* ```AZ_AFFINITY_REPLICAS_AND_PRIMARY```: Prioritize replicas in the same AZ as the client. + If no replicas are available in the zone, fall back to the primary in the same AZ. + If neither are available, fall back to other replicas or the primary in other zones. + +In Valkey 8, ```availability-zone``` configuration was introduced, allowing clients to specify the AZ for each Valkey server. +GLIDE leverages this new configuration to empower its users with the ability to use AZ Affinity routing. +At the time of writing, GLIDE is the only Valkey client library supporting the AZ Affinity strategies, offering a unique advantage. ## AZ Affinity routing advantages -1. **Reduce Data Transfer Costs** Cross-zone data transfer often incurs additional charges in Cloud environments. By ensuring operations are directed to nodes within the same AZ, you can minimize or eliminate these costs. +1. **Reduce Data Transfer Costs** Cross-zone data transfer often incurs additional charges in Cloud environments. + By ensuring operations are directed to nodes within the same AZ, you can minimize or eliminate these costs. - **Example:** An application in AWS with a Valkey cluster of 2 shards, each with 1 primary and 2 replicas, the instance type is m7g.xlarge. The cluster processes 250MB of data per second and to simplify the example 100% of the traffic is read operation. 50% of this traffic crosses AZs at a cost of $0.01 per GB, the monthly cross-AZ data transfer cost would be approximately $3,285. In addition the cost of the cluster is $0.252 per hour per node. Total of $1,088 per month. By implementing AZ affinity routing, you can reduce the total cost from $4,373 to $1,088, as all traffic remains within the same AZ. + **Example:** An application in AWS with a Valkey cluster of 2 shards, each with 1 primary and 2 replicas, the instance type is m7g.xlarge. + The cluster processes 250MB of data per second and to simplify the example 100% of the traffic is read operation. + 50% of this traffic crosses AZs at a cost of $0.01 per GB, the monthly cross-AZ data transfer cost would be approximately $3,285. + In addition the cost of the cluster is $0.252 per hour per node. + Total of $1,088 per month. + By implementing AZ affinity routing, you can reduce the total cost from $4,373 to $1,088, as all traffic remains within the same AZ. -2. **Minimize Latency** Distance between AZs within the same region— for example, in AWS, is typically up to 60 miles (100 kilometers)—adds extra roundtrip latency, usually in the range of 500µs to 1000µs. By ensuring requests remain within the same AZ, you can reduce latency and improve the responsiveness of your application. +2. **Minimize Latency** Distance between AZs within the same region— for example, in AWS, is typically up to 60 miles (100 kilometers)—adds extra roundtrip latency, usually in the range of 500µs to 1000µs. + By ensuring requests remain within the same AZ, you can reduce latency and improve the responsiveness of your application. **Example 1:** - Consider a cluster with three nodes, one primary and two replicas. Each node is located in a different availability zone. The client located in az-2 along with replica-1. + Consider a cluster with three nodes, one primary and two replicas. + Each node is located in a different availability zone. + The client located in az-2 along with replica-1. **With ```PREFER_REPLICA``` strategy**: - In this case, the client will read commands from any replica that is available. It may be located in a different AZ as shown below, and the average latency is, for example, 800 microseconds. + In this case, the client will read commands from any replica that is available. + It may be located in a different AZ as shown below, and the average latency is, for example, 800 microseconds. ![PREFER_REPLICA Read strategy latency example](/assets/media/pictures/PREFER_REPLICA_strategy.png) @@ -61,22 +91,29 @@ In Valkey 8, ```availability-zone``` configuration was introduced, allowing cli ![AZ_AFFINITY Read strategy latency example](/assets/media/pictures/AZ_AFFINITY_strategy.png) **Example 2:** - Consider a cluster with three nodes, one primary and two replicas. Each node is located in a different availability zone. The client located in az-2 along with the primary node. The replicas are located in az-1 and az-3. + Consider a cluster with three nodes, one primary and two replicas. + Each node is located in a different availability zone. + The client located in az-2 along with the primary node. + The replicas are located in az-1 and az-3. **With ```AZ_AFFINITY``` strategy**: - In this case, the client attempts to read from a replica in the same AZ. Since none are available in az-2, it falls back to a replica in another AZ, such as az-1 or az-3. + In this case, the client attempts to read from a replica in the same AZ. + Since none are available in az-2, it falls back to a replica in another AZ, such as az-1 or az-3. and the average latency is, for example, about 800 microseconds. ![AZ_AFFINITY Read strategy latency example](/assets/media/pictures/AZ_AFFINITY_strategy2.png) **With `AZ_AFFINITY_REPLICAS_AND_PRIMARY` strategy**: - In this case, the client first attempts to read from a replica in the same AZ. Since no local replica exists, it reads from the primary located in az-2. The average latency is, for example, about 300 microseconds. + In this case, the client first attempts to read from a replica in the same AZ. + Since no local replica exists, it reads from the primary located in az-2. + The average latency is, for example, about 300 microseconds. ![AZ_AFFINITY_REPLICAS_AND_PRIMARY Read strategy latency example](/assets/media/pictures/AZ_AFFINITY_REPLICAS_AND_PRIMARY_strategy.png) ## Configuring AZ Affinity Connections with GLIDE -Setting up AZ affinity routing in GLIDE is simple, allowing you to leverage its full potential with just a few configuration steps. Let’s walk through the steps to enable this feature in your application. +Setting up AZ affinity routing in GLIDE is simple, allowing you to leverage its full potential with just a few configuration steps. +Let’s walk through the steps to enable this feature in your application. ### Steps to Set Up AZ Affinity Routing in GLIDE diff --git a/content/blog/2025-03-28-new-hash-table/index.md b/content/blog/2025-03-28-new-hash-table/index.md index e961e46b..98e9f8a5 100644 --- a/content/blog/2025-03-28-new-hash-table/index.md +++ b/content/blog/2025-03-28-new-hash-table/index.md @@ -11,17 +11,22 @@ featured_image = "/assets/media/featured/random-05.webp" +++ -Many workloads are bound on storing data. Being able to store more data using +Many workloads are bound on storing data. +Being able to store more data using less memory allows you to reduce the size of your clusters. -In Valkey, keys and values are stored in what's called a hash table. A hash -table works by chopping a key into a number of seemingly random bits. These bits +In Valkey, keys and values are stored in what's called a hash table. +A hash +table works by chopping a key into a number of seemingly random bits. +These bits are shaped into a memory address, pointing to where the value is supposed to be -stored. It's a very fast way of jumping directly to the right place in memory +stored. +It's a very fast way of jumping directly to the right place in memory without scanning through all the keys. For the 8.1 release, we looked into improving the performance and memory usage, -so that users can store more data using less memory. This work led us to the +so that users can store more data using less memory. +This work led us to the design of a new hash table, but first, let's take a look at the hash table that was used in Valkey until now. @@ -33,15 +38,18 @@ layout: ![dict structure](dict-structure.png) -The dict has two tables, called "table 0" and "table 1". Usually only one +The dict has two tables, called "table 0" and "table 1". +Usually only one exists, but both are used when incremental rehashing is in progress. It's a chained hash table, so if multiple keys are hashed to the same slot in -the table, their key-value entries form a linked list. That's what the "next" +the table, their key-value entries form a linked list. +That's what the "next" pointer in the `dictEntry` is for. To lookup a key "FOO" and access the value "BAR", Valkey still has to read from -memory four times. If there is a hash collision, it has to follow two more +memory four times. +If there is a hash collision, it has to follow two more pointers for each hash collision and thus read twice more from memory (the key and the next pointer). @@ -49,51 +57,65 @@ Minimize memory accesses ------------------------ One of the slower operations when looking up a key-value pair is reading from -the main RAM memory. A key point is therefore to make sure we have as few memory -accesses as possible. Ideally, the memory we want to access should already be +the main RAM memory. +A key point is therefore to make sure we have as few memory +accesses as possible. +Ideally, the memory we want to access should already be loaded in the CPU cache, which is a smaller but much faster memory belonging to the CPU. Optimizing for memory usage, we also want to minimize the number of distinct memory allocations and the number of pointers between them, because storing a -pointer needs 8 bytes in a 64-bit system. If we can save one pointer per +pointer needs 8 bytes in a 64-bit system. +If we can save one pointer per key-value pair, for 100 million keys that's almost a gigabyte. When the CPU loads some data from the main memory into the CPU cache, it does so -in fixed size blocks called cache lines. The cache-line size is 64 bytes on -almost all modern hardware. Recent work on hash tables, such as [Swiss +in fixed size blocks called cache lines. +The cache-line size is 64 bytes on +almost all modern hardware. +Recent work on hash tables, such as [Swiss tables](https://abseil.io/about/design/swisstables), are highly optimized to -store and access data within a single cache line. If the key you're looking +store and access data within a single cache line. +If the key you're looking for isn't found where you first look for it (due to a hash collision), then it -should ideally be found within the same cache line. If it is, then it's found +should ideally be found within the same cache line. +If it is, then it's found very fast once this cache line has been loaded into the CPU cache. Required features ----------------- Why not use an open-source state-of-the-art hash table implementation such as -Swiss tables? The answer is that we require some specific features, apart from +Swiss tables? +The answer is that we require some specific features, apart from the basic operations like add, lookup, replace and delete: * Incremental rehashing, so that when the hashtable is full, we don't freeze the server while the table is being resized. * Scan, a way to iterate over the hash table even if the hash table is resized - between the iterations. This is important to keep supporting the + between the iterations. + This is important to keep supporting the [SCAN](/commands/scan/) command. * Random element sampling, for commands like [RANDOMKEY](/commands/randomkey/). These aren't standard features, so we couldn't simply pick an off-the-shelf hash -table. We had to design one ourselves. +table. +We had to design one ourselves. Design ------ In the new hash table designed for Valkey 8.1, the table consists of buckets of -64 bytes, one cache line. Each bucket can store up to seven elements. Keys that -map to the same bucket are all stored in the same bucket. The bucket also -contains a metadata section, marked "m" in the figures. The bucket layout +64 bytes, one cache line. +Each bucket can store up to seven elements. +Keys that +map to the same bucket are all stored in the same bucket. +The bucket also +contains a metadata section, marked "m" in the figures. +The bucket layout including the metadata section is explained in more detail below. We've eliminated the `dictEntry` and instead embed key and value in the @@ -103,37 +125,50 @@ We've eliminated the `dictEntry` and instead embed key and value in the Assuming the `hashtable` structure is already in the CPU cache, looking up key-value entry now requires only two memory lookups: The bucket and the -`serverObject`. If there is a hash collision, the object we're looking for is +`serverObject`. +If there is a hash collision, the object we're looking for is most likely in the same bucket, so no extra memory access is required. If a bucket becomes full, the last element slot in the bucket is replaced by a -pointer to a child bucket. A child bucket has the same layout as a regular -bucket, but it's a separate allocation. The lengths of these bucket chains are +pointer to a child bucket. +A child bucket has the same layout as a regular +bucket, but it's a separate allocation. +The lengths of these bucket chains are not bounded, but long chains are very rare as long as keys are well distributed -by the hashing function. Most of the keys are stored in top-level buckets. +by the hashing function. +Most of the keys are stored in top-level buckets. ![hashtable structure](hashtable-child-buckets.png) The elements in the same bucket, or bucket chain, are stored without any -internal ordering. When inserting a new entry into the bucket, any of the free +internal ordering. +When inserting a new entry into the bucket, any of the free slots can be used. -As mentioned earlier, each bucket also contains a metadata section. The bucket +As mentioned earlier, each bucket also contains a metadata section. +The bucket metadata consists of eight bytes of which one bit indicates whether the bucket -has a child bucket or not. The next seven bits, one bit for each of the seven +has a child bucket or not. +The next seven bits, one bit for each of the seven element slots, indicates whether that slot is filled, i.e. whether it contains -an element or not. The remaining seven bytes are used for storing a one byte +an element or not. +The remaining seven bytes are used for storing a one byte secondary hash for each of the entries stored in the bucket. ![bucket structure](hash-bucket-structure.png) The secondary hash is made up of hash bits that are not used when looking up the -bucket. Out of a 64 bits hash, we need not more than 56 bits for looking up the -bucket and we use the remaining 8 bits as the secondary hash. These hash bits +bucket. +Out of a 64 bits hash, we need not more than 56 bits for looking up the +bucket and we use the remaining 8 bits as the secondary hash. +These hash bits are used for quickly eliminating mismatching entries when looking up a key -without comparing the keys. Comparing the keys of each entry in the bucket would -require an extra memory access per entry. If the secondary hash mismatches the -key we're looking for, we can immediately skip that entry. The chance of a false +without comparing the keys. +Comparing the keys of each entry in the bucket would +require an extra memory access per entry. +If the secondary hash mismatches the +key we're looking for, we can immediately skip that entry. +The chance of a false positive, meaning an entry for which the secondary hash is matching although the entry doesn't match the key were looking for, is one in 256, so this eliminates 99.6% of the false positives. @@ -144,9 +179,12 @@ Results By replacing the hash table with a different implementation, we've managed to reduce the memory usage by roughly 20 bytes per key-value pair. -The graph below shows the memory overhead for different value sizes. The -overhead is the memory usage excluding the key and the value itself. Lower is -better. (The zigzag pattern is because of unused memory resulting from the memory +The graph below shows the memory overhead for different value sizes. +The +overhead is the memory usage excluding the key and the value itself. +Lower is +better. +(The zigzag pattern is because of unused memory resulting from the memory allocator's discrete allocation sizes.) ![memory usage by version](memory-usage.png) @@ -157,15 +195,18 @@ usage is down even more, roughly 30 bytes per key-value pair. ![memory usage with expire](memory-usage-with-expire.png) In some workloads, such as when storing very small objects and when pipelining -is used extensively, the latency and CPU usage are also improved. In most cases -though this is negligible in practice. The key takeaway appears to be reduced +is used extensively, the latency and CPU usage are also improved. +In most cases +though this is negligible in practice. +The key takeaway appears to be reduced memory usage. Hashes, sets and sorted sets ---------------------------- The nested data types Hashes, Sets and Sorted sets also make use of the new hash -table when they contain a sufficiently large number of elements. The memory +table when they contain a sufficiently large number of elements. +The memory usage is down by roughly 10-20 bytes per element for these types of keys. Special thanks to Rain Valentine for the graphs and for the help with diff --git a/content/blog/2025-03-4-go-client-in-public-preview.md b/content/blog/2025-03-4-go-client-in-public-preview.md index 53c611fd..6ed9a57b 100644 --- a/content/blog/2025-03-4-go-client-in-public-preview.md +++ b/content/blog/2025-03-4-go-client-in-public-preview.md @@ -10,21 +10,26 @@ featured = false featured_image = "/assets/media/featured/default.webp" +++ -Valkey-Glide is pleased to announce the public preview release of the GLIDE(General Language Independent Driver for the Enterprise) Go client. This release brings the power and reliability of Valkey to Go developers with an API designed for performance and developer productivity. +Valkey-Glide is pleased to announce the public preview release of the GLIDE(General Language Independent Driver for the Enterprise) Go client. +This release brings the power and reliability of Valkey to Go developers with an API designed for performance and developer productivity. -Valkey GLIDE is a multi-language client for Valkey, designed for operational excellence and incorporating best practices refined through years of experience. GLIDE ensures a consistent and unified client experience across applications, regardless of the programming language. +Valkey GLIDE is a multi-language client for Valkey, designed for operational excellence and incorporating best practices refined through years of experience. +GLIDE ensures a consistent and unified client experience across applications, regardless of the programming language. -Currently, GLIDE supports Java, Node.js, and Python. This announcement introduces the Valkey GLIDE support for Go, expanding support to Go developers and providing new connectivity to Valkey servers, including both standalone and cluster deployments. +Currently, GLIDE supports Java, Node.js, and Python. +This announcement introduces the Valkey GLIDE support for Go, expanding support to Go developers and providing new connectivity to Valkey servers, including both standalone and cluster deployments. ## Why You Should Be Excited -The Go client extends Valkey GLIDE to the Go community, offering a robust, client that's built on the battle-tested Rust core. This client library is a thoughtfully designed experience for Go developers who need reliable, high-performance data access. +The Go client extends Valkey GLIDE to the Go community, offering a robust, client that's built on the battle-tested Rust core. +This client library is a thoughtfully designed experience for Go developers who need reliable, high-performance data access. ## Key Features ### Advanced Cluster Topology Management -Connect to your Valkey cluster with minimal configuration. The client automatically detects the entire cluster topology and configures connection management based on industry best practices. +Connect to your Valkey cluster with minimal configuration. +The client automatically detects the entire cluster topology and configures connection management based on industry best practices. ```go config := api.NewGlideClusterClientConfiguration(). @@ -37,27 +42,33 @@ The Go client provides advanced topology managements features such as: #### Automatic Topology Discovery -GLIDE automatically discovers all cluster nodes from a single seed node, eliminating the need to manually configure every node address. The NodeAddress can be an IP address, hostname, or fully qualified domain name (FQDN). +GLIDE automatically discovers all cluster nodes from a single seed node, eliminating the need to manually configure every node address. +The NodeAddress can be an IP address, hostname, or fully qualified domain name (FQDN). #### Dynamic Topology Maintenance -Cluster topology can change over time as nodes are added, removed, or when slot ownership changes. GLIDE implements several mechanisms to maintain an accurate view of the cluster: +Cluster topology can change over time as nodes are added, removed, or when slot ownership changes. +GLIDE implements several mechanisms to maintain an accurate view of the cluster: -- **Proactive Topology Monitoring**: GLIDE performs periodic background checks for cluster topology changes. This approach ensures a comprehensive and up-to-date view of the cluster, improving availability and reducing tail latency. +- **Proactive Topology Monitoring**: GLIDE performs periodic background checks for cluster topology changes. + This approach ensures a comprehensive and up-to-date view of the cluster, improving availability and reducing tail latency. - **Consensus-Based Resolution**: GLIDE queries multiple nodes for their topology view and selects the one with the highest agreement, reducing the risk of stale or incorrect mappings and ensuring a more accurate and up-to-date cluster view, improving the overall availability of the cluster. - **Efficient Resource Management**: GLIDE employs an efficient algorithm to compare node views and dynamically throttles client-management requests to prevent overloading Valkey servers, ensuring a balance between maintaining an up-to-date topology map and optimizing resource utilization. ### Enhanced Connection Management -Connection management in distributed systems presents unique challenges that impact performance, reliability, and resource utilization. The Go client addresses these challenges with reliable solutions: +Connection management in distributed systems presents unique challenges that impact performance, reliability, and resource utilization. +The Go client addresses these challenges with reliable solutions: #### Proactive Reconnection -GLIDE implements a background monitoring system for connection states. By detecting disconnections and initiating reconnections preemptively, the client eliminates the reconnection latency typically experienced when a request discovers a broken connection. +GLIDE implements a background monitoring system for connection states. +By detecting disconnections and initiating reconnections preemptively, the client eliminates the reconnection latency typically experienced when a request discovers a broken connection. #### Connection Storm Prevention -When network events occur, connection storms can overwhelm servers with simultaneous reconnection attempts. GLIDE mitigates this risk through backoff algorithm with jitter that distributes reconnection attempts over time, protecting servers from sudden connection surges. +When network events occur, connection storms can overwhelm servers with simultaneous reconnection attempts. +GLIDE mitigates this risk through backoff algorithm with jitter that distributes reconnection attempts over time, protecting servers from sudden connection surges. Robust connection handling with automatic reconnection strategies ensures your application remains resilient even during network instability: @@ -74,7 +85,8 @@ config := api.NewGlideClientConfiguration(). #### Multiplexed Connection -Rather than maintaining connection pools, GLIDE establishes a single multiplexed connection per cluster node. This architectural choice: +Rather than maintaining connection pools, GLIDE establishes a single multiplexed connection per cluster node. +This architectural choice: - Minimizes the total number of TCP connections to servers - Reduces system call overhead @@ -84,7 +96,8 @@ Rather than maintaining connection pools, GLIDE establishes a single multiplexed ### Built for Performance The Go client is designed from the ground up with performance in mind while still being simple to use. -The Go client provides a synchronous API for simplicity and compatibility with existing Go key-value store clients. While each individual command is blocking (following the familiar patterns in the ecosystem), the client is fully thread-safe and designed for concurrent usage: +The Go client provides a synchronous API for simplicity and compatibility with existing Go key-value store clients. +While each individual command is blocking (following the familiar patterns in the ecosystem), the client is fully thread-safe and designed for concurrent usage: ```go // Example of concurrent execution using goroutines @@ -126,7 +139,8 @@ Under the hood, the client efficiently handles these concurrent requests by: 2. Implementing thread-safe command execution 3. Efficiently routing concurrent commands to the appropriate server nodes -While the current API is synchronous, the implementation is specifically optimized for concurrent usage through Go's native goroutines. We would love feedback about whether to add async/channel-based APIs in future releases. +While the current API is synchronous, the implementation is specifically optimized for concurrent usage through Go's native goroutines. +We would love feedback about whether to add async/channel-based APIs in future releases. ## Getting Started @@ -178,7 +192,9 @@ func main() { Need to work with a Valkey cluster? -Just as easy! The Go client automatically discovers your entire cluster topology from a single seed node. The following sample shows how to connect to a Valkey cluster through a node running locally on port 7001: +Just as easy! +The Go client automatically discovers your entire cluster topology from a single seed node. +The following sample shows how to connect to a Valkey cluster through a node running locally on port 7001: ```go package main @@ -269,7 +285,11 @@ config := api.NewGlideClientConfiguration(). ## Behind the Scenes: Technical Architecture -The Valkey GLIDE Go client is built on top of the Valkey GLIDE core. The core framework is written in Rust (lib.rs), which exposes public functions. These functions are converted to a C header file using Cbindgen. The Go client then uses CGO to call these C functions, providing Go developers with an idiomatic interface while leveraging Rust's performance advantages. This architecture ensures consistent behavior across all Valkey GLIDE language implementations (Java, Python, Node.js, and Go) while maintaining performance and reliability. +The Valkey GLIDE Go client is built on top of the Valkey GLIDE core. +The core framework is written in Rust (lib.rs), which exposes public functions. +These functions are converted to a C header file using Cbindgen. +The Go client then uses CGO to call these C functions, providing Go developers with an idiomatic interface while leveraging Rust's performance advantages. +This architecture ensures consistent behavior across all Valkey GLIDE language implementations (Java, Python, Node.js, and Go) while maintaining performance and reliability. ### Component details ```txt @@ -290,7 +310,9 @@ The Valkey GLIDE Go client is built on top of the Valkey GLIDE core. The core fr ## Join the Journey -This public preview is just the beginning. We're actively developing and enhancing the Go wrapper, and we'd love your feedback and contributions. Try it out in your projects, share your experiences, and help us make it even better! +This public preview is just the beginning. +We're actively developing and enhancing the Go wrapper, and we'd love your feedback and contributions. +Try it out in your projects, share your experiences, and help us make it even better! You can join our development journey by: - Submitting issues or feature requests on our [GitHub Issues page](https://github.com/valkey-io/valkey-glide/issues) diff --git a/content/blog/2025-04-02-valkey-8-1-0-ga.md b/content/blog/2025-04-02-valkey-8-1-0-ga.md index ea96b218..421b8baf 100644 --- a/content/blog/2025-04-02-valkey-8-1-0-ga.md +++ b/content/blog/2025-04-02-valkey-8-1-0-ga.md @@ -36,9 +36,11 @@ Valkey 8.1 introduces several performance improvements that reduce latency, incr The main changes responsible for several performance improvements is the new hashtable implementation that is used both as the main key-value store in Valkey and the implementations for the Hash, Set, and Sorted Set data types. -The new hashtable implementation is a complete rewrite of the previous hashtable. The new design adopts several modern design techniques to reduce the number of allocations to store each object, which reduces the number of random memory accesses while also saving memory. +The new hashtable implementation is a complete rewrite of the previous hashtable. +The new design adopts several modern design techniques to reduce the number of allocations to store each object, which reduces the number of random memory accesses while also saving memory. -The result is we observed a roughly 20 byte reduction per key-value pair for keys without a TTL, and up to a 30 byte reduction for key-value pairs with a TTL. The new implementation also helps improve the Valkey server throughput by roughly 10% compared to 8.0 version for pipeline workloads when I/O threading is not used. +The result is we observed a roughly 20 byte reduction per key-value pair for keys without a TTL, and up to a 30 byte reduction for key-value pairs with a TTL. +The new implementation also helps improve the Valkey server throughput by roughly 10% compared to 8.0 version for pipeline workloads when I/O threading is not used. You can learn more about the design and results in [the dedicated blog post about the implementation](/blog/new-hash-table). @@ -58,11 +60,15 @@ Commands like `KEYS` and also benefit from this optimization. Following up the I/O threads improvements added in 8.0, more operations have been offloaded to the I/O thread pool in the 8.1 release, improving the throughput and latency of some operations. -In the new release, TLS connections are now able to offload the TLS negotiation to I/O threads. This change improves the rate of accepting new connections by around [300%](https://github.com/valkey-io/valkey/pull/1338). +In the new release, TLS connections are now able to offload the TLS negotiation to I/O threads. +This change improves the rate of accepting new connections by around [300%](https://github.com/valkey-io/valkey/pull/1338). -Other sources of overhead in the TLS connection handling were identified, namely in the calls to `SSL_pending()` and `ERR_clear_error()` functions, which were being called in the main event thread. By offloading these functions to the I/O threads pool, a throughput improvement was achieved in some operations. For instance, it was observed a [10%](https://github.com/valkey-io/valkey/pull/1271) improvement in `SET` operations throughput, and a [22%](https://github.com/valkey-io/valkey/pull/1271) improvement in `GET` operations throughput. +Other sources of overhead in the TLS connection handling were identified, namely in the calls to `SSL_pending()` and `ERR_clear_error()` functions, which were being called in the main event thread. +By offloading these functions to the I/O threads pool, a throughput improvement was achieved in some operations. +For instance, it was observed a [10%](https://github.com/valkey-io/valkey/pull/1271) improvement in `SET` operations throughput, and a [22%](https://github.com/valkey-io/valkey/pull/1271) improvement in `GET` operations throughput. -Replication traffic efficiency was also improved in 8.1 by offloading the reading of replication stream on the replicas to the I/O thread pool which means they can serve more read traffic. On the primaries, replication stream writes are now offloaded to the I/O thread pool. +Replication traffic efficiency was also improved in 8.1 by offloading the reading of replication stream on the replicas to the I/O thread pool which means they can serve more read traffic. +On the primaries, replication stream writes are now offloaded to the I/O thread pool. ### Replication Improvements @@ -77,15 +83,19 @@ The fork copy-on-write memory overhead is reduced by up to [47%](https://github. `ZADD` and other commands that involve floating point numbers are optimized by [`fast_float`](https://github.com/valkey-io/valkey/pull/1260) to parse floats using SIMD instructions. This optimization requires a C++ compiler, and is currently an opt-in feature at compile time. -The probabilistic hyperloglog is another great data type, used for counting unique elements in very large datasets whilst using only 12KB of memory regardless of the amount of elements. By using the modern CPUs Advanced Vector Extensions of x86, Valkey 8.1 can achieve a [12x](https://github.com/valkey-io/valkey/pull/1293) speed for the operations like `PFMERGE` and `PFCOUNT` on hyperloglog data types. +The probabilistic hyperloglog is another great data type, used for counting unique elements in very large datasets whilst using only 12KB of memory regardless of the amount of elements. +By using the modern CPUs Advanced Vector Extensions of x86, Valkey 8.1 can achieve a [12x](https://github.com/valkey-io/valkey/pull/1293) speed for the operations like `PFMERGE` and `PFCOUNT` on hyperloglog data types. Similarly, the BITCOUNT operation has been improved up to [514%](https://github.com/valkey-io/valkey/pull/1741) using AVX2 on x86. ### Active Defrag Improvements -Active Defrag has been improved to eliminate latencies greater than 1ms (https://github.com/valkey-io/valkey/pull/1242). Defrag cycle time has been reduced to 500us (with increased frequency), resulting in much more predictable latencies, with a dramatic reduction in tail latencies. +Active Defrag has been improved to eliminate latencies greater than 1ms (https://github.com/valkey-io/valkey/pull/1242). +Defrag cycle time has been reduced to 500us (with increased frequency), resulting in much more predictable latencies, with a dramatic reduction in tail latencies. -An anti-starvation protection has also been introduced in the presence of long-running commands. If a slow command delays the defrag cycle, the defrag process will run proportionately longer to ensure that the configured CPU is achieved. Given the presence of slow commands, the proportional extra time is insignificant to latency. +An anti-starvation protection has also been introduced in the presence of long-running commands. +If a slow command delays the defrag cycle, the defrag process will run proportionately longer to ensure that the configured CPU is achieved. +Given the presence of slow commands, the proportional extra time is insignificant to latency. ## Observability @@ -93,7 +103,8 @@ There are also several improvements to the observability of the system behavior ### Log Improvements -Valkey 8.1 brings new options to the format of the log file entries as well as the way timestamps are recorded in the log file. This makes it easier to consume the log files by log collecting systems. +Valkey 8.1 brings new options to the format of the log file entries as well as the way timestamps are recorded in the log file. +This makes it easier to consume the log files by log collecting systems. The format of the log file entries is controlled by the `log-format` parameter, where the default is the existing format : @@ -110,18 +121,23 @@ The formatting of the timestamp of the log file entries is controlled by the `lo ### Extending the Slowlog to Commandlog -Valkey has long had the capability to record slow commands at execution time based on the threshold set with the `slowlog-log-slower-than` parameter to keep the last `slowlog-max-len` entries. A useful tool in troubleshooting, it didn't take into account the overall round-trip to the application or the impact on network usage. With the addition of the new `COMMANDLOG` feature in Valkey 8.1, the recording of large requests and replies is now giving users great visibility in end-to-end latency. +Valkey has long had the capability to record slow commands at execution time based on the threshold set with the `slowlog-log-slower-than` parameter to keep the last `slowlog-max-len` entries. +A useful tool in troubleshooting, it didn't take into account the overall round-trip to the application or the impact on network usage. +With the addition of the new `COMMANDLOG` feature in Valkey 8.1, the recording of large requests and replies is now giving users great visibility in end-to-end latency. ### Improved Latency Insights Valkey has a built-in latency monitoring framework which samples latency-sensitive code paths such as for example fork when enabled through `latency-monitor-threshold` [latency monitor](https://valkey.io/topics/latency-monitor/). -The new feature adds to additional metrics to the `LATENCY LATEST` command that reports on the latest latency events that have been collected. The additional information in Valkey 8.1 reports on the total of the recorded latencies as well as the number of recorded spikes for this event. These additional fields allow users to better understand how often these latency events are occurring and the total impact they are causing to the system. +The new feature adds to additional metrics to the `LATENCY LATEST` command that reports on the latest latency events that have been collected. +The additional information in Valkey 8.1 reports on the total of the recorded latencies as well as the number of recorded spikes for this event. +These additional fields allow users to better understand how often these latency events are occurring and the total impact they are causing to the system. ## Extensibility -Valkey is already well known by its extensibility features. The sophisticated module system allows to extend the core system with new features developed as external modules. +Valkey is already well known by its extensibility features. +The sophisticated module system allows to extend the core system with new features developed as external modules. ### Programmability @@ -129,7 +145,8 @@ In Valkey 8.1 the module system API was extended with the support for developing This new API opens the door for the development of new language and runtime alternatives to the Lua base scripts supported by the Valkey core when using `EVAL` and `FCALL` commands. -In future releases of Valkey, we expect the emergence of new scripting engines. A good candidate is a scripting engine based on WASM, allowing `EVAL` scripts to be written in other languages than Lua and to be executed in a more secure sandbox environment. +In future releases of Valkey, we expect the emergence of new scripting engines. +A good candidate is a scripting engine based on WASM, allowing `EVAL` scripts to be written in other languages than Lua and to be executed in a more secure sandbox environment. There are also benefits for existing Lua scripts, since new Lua runtimes can be easily plugged in that provide better security properties and/or better performance. @@ -139,12 +156,16 @@ Developers that intend to build new scripting engines for Valkey should check th ### Conditional Updates -This new functionality allows Valkey users to perform conditional updates using the `SET` command if the given comparison-value matches the key’s current value. This is a not only a quality-of-life improvement for developers as they no longer need to add this condition to their application code, it also saves a roundtrip to first get a value and then compare it before a `SET`. When using the optional `GET` as part of the `SET IFEQ`, the existing value is returned regardless whether it matches the comparison-value. +This new functionality allows Valkey users to perform conditional updates using the `SET` command if the given comparison-value matches the key’s current value. +This is a not only a quality-of-life improvement for developers as they no longer need to add this condition to their application code, it also saves a roundtrip to first get a value and then compare it before a `SET`. +When using the optional `GET` as part of the `SET IFEQ`, the existing value is returned regardless whether it matches the comparison-value. ## Conclusion -Valkey 8.1 continues the path of innovation and improvements, transparently bringing more performance and reliability to the user. We look forward to hearing what you achieve with Valkey 8.1! More detail can be found in [release notes](https://github.com/valkey-io/valkey/releases/tag/8.1.0) for the 8.1 GA release. +Valkey 8.1 continues the path of innovation and improvements, transparently bringing more performance and reliability to the user. +We look forward to hearing what you achieve with Valkey 8.1! +More detail can be found in [release notes](https://github.com/valkey-io/valkey/releases/tag/8.1.0) for the 8.1 GA release. ## THANK YOU diff --git a/content/blog/2025-04-09-introducing-bloom-filters.md b/content/blog/2025-04-09-introducing-bloom-filters.md index 76a6c895..f325e0e9 100644 --- a/content/blog/2025-04-09-introducing-bloom-filters.md +++ b/content/blog/2025-04-09-introducing-bloom-filters.md @@ -11,15 +11,18 @@ featured = false featured_image = "/assets/media/featured/random-02.webp" +++ -The Valkey project is introducing Bloom Filters as a new data type via [valkey-bloom](https://github.com/valkey-io/valkey-bloom/) (BSD-3 licensed), an official Valkey Module which is compatible with Valkey versions >= 8.0. Bloom filters provide efficient, large-scale membership testing, improving performance and offering significant memory savings for high-volume applications. +The Valkey project is introducing Bloom Filters as a new data type via [valkey-bloom](https://github.com/valkey-io/valkey-bloom/) (BSD-3 licensed), an official Valkey Module which is compatible with Valkey versions >= 8.0. +Bloom filters provide efficient, large-scale membership testing, improving performance and offering significant memory savings for high-volume applications. As an example, to handle advertisement deduplication workloads and answer the question, "Has this customer seen this ad before?", Valkey developers could use the SET data type. -This is done by adding the customer IDs (of those who viewed an ad) into a `SET` object representing a particular advertisement. However, the problem with this approach is high memory usage since every item in the set is allocated. +This is done by adding the customer IDs (of those who viewed an ad) into a `SET` object representing a particular advertisement. +However, the problem with this approach is high memory usage since every item in the set is allocated. This article demonstrates how using the bloom filter data type from valkey-bloom can achieve significant memory savings, more than 93% in our example workload, while exploring its implementation, technical details, and practical recommendations. ## Introduction -Bloom filters are a space efficient probabilistic data structure that supports adding elements and checking whether elements were previously added. False positives are possible, where a filter incorrectly indicates that an element exists even though it was not added. +Bloom filters are a space efficient probabilistic data structure that supports adding elements and checking whether elements were previously added. +False positives are possible, where a filter incorrectly indicates that an element exists even though it was not added. However, Bloom Filters guarantee that false negatives do not occur, meaning that an element that was added successfully will never be reported as not existing. ![Bloom Filter Bit Vector](/assets/media/pictures/bloomfilter_bitvector.png) @@ -34,10 +37,12 @@ It is API compatible with the bloom filter command syntax of the official Valkey ## Data type overview -The "Bloom Object" is the main bloom data type structure. This is what gets created with any bloom filter creation command and this structure can act either as a "scaling bloom filter" or "non scaling bloom filter" depending on the user configuration. +The "Bloom Object" is the main bloom data type structure. +This is what gets created with any bloom filter creation command and this structure can act either as a "scaling bloom filter" or "non scaling bloom filter" depending on the user configuration. It consists of a vector of "Sub Filters" with length >= 1 in case of scaling and only 1 in case of non scaling. -The "Sub Filter" is an inner structure which is created and used within the "Bloom Object". It tracks the capacity, number of items added, and an instance of a Bloom Filter (of the specified properties). +The "Sub Filter" is an inner structure which is created and used within the "Bloom Object". +It tracks the capacity, number of items added, and an instance of a Bloom Filter (of the specified properties). ![bloom filter data type](/assets/media/pictures/bloomfilter_datatype.png) @@ -62,22 +67,30 @@ Any default creation as a result of `BF.ADD`, `BF.MADD`, `BF.INSERT` will be a s Capacity - The number of unique items that can be added before a bloom filter scales out occurs (in case of scalable bloom filters) or before any command which inserts a new item will return an error (in case of non scalable bloom filters). -False Positive Rate (FP) - The rate that controls the probability of item add/exists operations being false positives. Example: 0.001 means 1 in every 1000 operations can be a false positive. +False Positive Rate (FP) - The rate that controls the probability of item add/exists operations being false positives. +Example: 0.001 means 1 in every 1000 operations can be a false positive. ## Use cases / Memory Savings -In this example, we are simulating a very common use case of bloom filters: Advertisement Deduplication. Applications can utilize bloom filters to track whether an advertisement / promotion has already been shown to a customer and use this to prevent showing it again to the customer. +In this example, we are simulating a very common use case of bloom filters: Advertisement Deduplication. +Applications can utilize bloom filters to track whether an advertisement / promotion has already been shown to a customer and use this to prevent showing it again to the customer. -Let us assume we have 500 unique advertisements and our service has 5M customers. Both advertisements and customers are identified by a UUID (36 characters). +Let us assume we have 500 unique advertisements and our service has 5M customers. +Both advertisements and customers are identified by a UUID (36 characters). Without bloom filters, applications could use the `SET` Valkey data type such that they have a unique `SET` for every advertisement. Then, they can use the `SADD` command to track every customer who has already seen this particular advertisement by adding them to the set. -To check if a customer has seen the ad, the `SISMEMBER` or `SMISMEMBER` command can be used. This means we have 500 sets, each with 5M members. This will require ~152.57 GB of `used_memory` on a Valkey 8.0 server. +To check if a customer has seen the ad, the `SISMEMBER` or `SMISMEMBER` command can be used. +This means we have 500 sets, each with 5M members. +This will require ~152.57 GB of `used_memory` on a Valkey 8.0 server. With bloom filters, applications can create a unique bloom filter for every advertisement with the `BF.RESERVE` or `BF.INSERT` command. -Here, they can specify the exact capacity they require: 5M - which means 5M items can be added to the bloom filter. For every customer that the advertisement is shown to, the application can add the UUID of the customer onto the specific filter. -To check if a customer has seen the ad, the `BF.EXISTS` or `BF.MEXISTS` command can be used. So, we have 500 bloom filters, each with a capacity of 5M. -This will require variable memory depending on the false positive rate. In all cases (even stricter false positive rates), we can see there is a significant memory optimization compared to using the `SET` data type. +Here, they can specify the exact capacity they require: 5M - which means 5M items can be added to the bloom filter. +For every customer that the advertisement is shown to, the application can add the UUID of the customer onto the specific filter. +To check if a customer has seen the ad, the `BF.EXISTS` or `BF.MEXISTS` command can be used. +So, we have 500 bloom filters, each with a capacity of 5M. +This will require variable memory depending on the false positive rate. +In all cases (even stricter false positive rates), we can see there is a significant memory optimization compared to using the `SET` data type. | Number of Bloom Filters | Capacity | FP Rate | FP Rate Description | Total Used Memory (GB) | Memory Saved % compared to SETS | |-------------------------|----------|---------|----------------------|------------------------|----------------------------------| @@ -86,7 +99,8 @@ This will require variable memory depending on the false positive rate. In all c | 500 | 5000000 | 0.00001 | One in every 100K | 7.8 | **94.88%** | | 500 | 5000000 | 0.0000002| One in every 5M | 9.8 | **93.60%** | -In this example, we are able to benefit from 93% - 98% savings in memory usage when using Bloom Filters compared to the `SET` data type. Depending on your workload, you can expect similar results. +In this example, we are able to benefit from 93% - 98% savings in memory usage when using Bloom Filters compared to the `SET` data type. +Depending on your workload, you can expect similar results. ![SET vs Bloom Filter Memory Usage Comparison](/assets/media/pictures/bloomfilter_memusage.png) @@ -96,7 +110,8 @@ To improve server performance during serialization and deserialization of bloom The default memory usage limit of a bloom filter is defined by the `BF.BLOOM-MEMORY-USAGE-LIMIT` configuration which has a default value of 128 MB. However, the value can be tuned using the configuration above. -The implication of the memory limit is that operations involving bloom filter creations or scaling out, that result in a bloom filter with overall memory usage over the limit, will return an error. Example: +The implication of the memory limit is that operations involving bloom filter creations or scaling out, that result in a bloom filter with overall memory usage over the limit, will return an error. +Example: ``` 127.0.0.1:6379> BF.ADD ad1_filter user1 (error) ERR operation exceeds bloom object memory limit @@ -109,7 +124,9 @@ These are useful to check beforehand to ensure that your bloom filter will not f 1. Perform a memory check prior to bloom filter creation We can use the `VALIDATESCALETO` option of the `BF.INSERT` command to perform a validation whether the filter is within the memory limit. -If it is not within the limits, the command will return an error. In the example below, we see that filter1 cannot scale out and reach the capacity of 26214301 due to the memory limit. However, it can scale out and reach a capacity of 26214300. +If it is not within the limits, the command will return an error. +In the example below, we see that filter1 cannot scale out and reach the capacity of 26214301 due to the memory limit. +However, it can scale out and reach a capacity of 26214300. ``` 127.0.0.1:6379> BF.INSERT filter1 VALIDATESCALETO 26214301 (error) ERR provided VALIDATESCALETO causes bloom object to exceed memory limit @@ -118,14 +135,16 @@ If it is not within the limits, the command will return an error. In the example ``` 2. Check the maximum capacity that an existing scalable bloom filter can expand to -We can use the `BF.INFO` command to find out the maximum capacity that the scalable bloom filter can expand to hold. In this case, we can see the filter can hold 26214300 items (after scaling out until the memory limit). +We can use the `BF.INFO` command to find out the maximum capacity that the scalable bloom filter can expand to hold. +In this case, we can see the filter can hold 26214300 items (after scaling out until the memory limit). ``` 127.0.0.1:6379> BF.INFO filter1 MAXSCALEDCAPACITY (integer) 26214300 ``` To get an idea of what the memory usage looks like for the max capacity of an individual non scaling filter, we have a table below. -With a 128MB limit and default false positive rate, we can create a bloom filter with 112M as the capacity. With a 512MB limit, a bloom filter can hold 448M items. +With a 128MB limit and default false positive rate, we can create a bloom filter with 112M as the capacity. +With a 512MB limit, a bloom filter can hold 448M items. | Non Scaling Filter - Capacity | FP Rate | Memory Usage (MB) | Notes | |------------------------------|---------|-------------------|------------------------------------------| diff --git a/content/blog/2025-05-14-upgrade-stories-vol1.md b/content/blog/2025-05-14-upgrade-stories-vol1.md index 661d2f4a..1f5882b8 100644 --- a/content/blog/2025-05-14-upgrade-stories-vol1.md +++ b/content/blog/2025-05-14-upgrade-stories-vol1.md @@ -15,25 +15,51 @@ featured_image = "/assets/media/featured/random-04.webp" ## Two new Valkey users describe what it's really like to upgrade -Many potential Valkey users have told the project that they're interested in hearing more stories about companies that have decided to migrate to Valkey. This blog is the first in a series that will share our users' stories. Two organizations, Muse and 4th Whale Marketing, share a similar story: they both have Valkey in a critical place in their applications, they switched engines quickly with zero issues, and they saved money. +Many potential Valkey users have told the project that they're interested in hearing more stories about companies that have decided to migrate to Valkey. +This blog is the first in a series that will share our users' stories. +Two organizations, Muse and 4th Whale Marketing, share a similar story: they both have Valkey in a critical place in their applications, they switched engines quickly with zero issues, and they saved money. -Valkey is a multi-vendor/vendor neutral project. With the support of a large and diverse community, the project is innovating at a rapid pace. In September 2024, we released Valkey 8.0 which brought performance improvements. Six months later in March 2025, Valkey 8.1 added memory efficiency improvements, extended observability, and more performance improvements. Further, it has a permissive, open source license allowing for anyone to use, modify, and provide Valkey as a Service. This allows organizations to make changes that best fit their values, budgets, and technical constraints. Valkey provides choice and prevents lock-in by being offered across many vendors, Linux distributions, with no licensing costs. +Valkey is a multi-vendor/vendor neutral project. +With the support of a large and diverse community, the project is innovating at a rapid pace. +In September 2024, we released Valkey 8.0 which brought performance improvements. +Six months later in March 2025, Valkey 8.1 added memory efficiency improvements, extended observability, and more performance improvements. +Further, it has a permissive, open source license allowing for anyone to use, modify, and provide Valkey as a Service. +This allows organizations to make changes that best fit their values, budgets, and technical constraints. +Valkey provides choice and prevents lock-in by being offered across many vendors, Linux distributions, with no licensing costs. -According to [Muse's website](https://www.museml.com/), they are, “the first intelligent creative assistant and inspiration studio for storytellers and world builders.” Garth Henson, Director of Engineering at Muse, says they use Valkey in several ways: +According to [Muse's website](https://www.museml.com/), they are, “the first intelligent creative assistant and inspiration studio for storytellers and world builders.” +Garth Henson, Director of Engineering at Muse, says they use Valkey in several ways: * Caching: “We utilize standard HTML and payload caching to offload redundant data retrieval and computation, improving performance and efficiency.” * Pub/Sub Messaging – “Valkey’s topic-based subscriptions drive our event-driven workflows across multiple system layers and support real-time WebSocket client communication.” * Lua Scripting – “We leverage Valkey’s single-threaded Lua execution for complex and multi-stage data retrievals, ensuring consistency while avoiding concurrency issues and race conditions.” * Taxonomies & Tagging Strategies – “The ability to handle massive lists at low cost has allowed us to efficiently implement taxonomies and data mappings, making retrieval seamless.” -One of the key reasons Muse chose Valkey was that it is open source. Garth says, “Redis’ licensing change prompted us to seek a truly open source alternative that aligns with our values.” They also mentioned the cost and performance as well as Valkey being a drop-in replacement as reasons they upgraded. +One of the key reasons Muse chose Valkey was that it is open source. +Garth says, “Redis’ licensing change prompted us to seek a truly open source alternative that aligns with our values.” +They also mentioned the cost and performance as well as Valkey being a drop-in replacement as reasons they upgraded. -For them, the change was seamless. They learned about Valkey on a Thursday, began evaluating the next Monday and were fully migrated by Wednesday with zero downtime. That’s four working days from idea to production. They said that so far they’ve noticed benefits of cost efficiency, storage optimization, and performance stability since upgrading to Valkey. +For them, the change was seamless. +They learned about Valkey on a Thursday, began evaluating the next Monday and were fully migrated by Wednesday with zero downtime. +That’s four working days from idea to production. +They said that so far they’ve noticed benefits of cost efficiency, storage optimization, and performance stability since upgrading to Valkey. -[4th Whale Marketing](https://www.4thwhale.com/) is a Montreal-based company specializing in digital affiliate marketing. Founded in 2004, their seasoned team combines many years of experience in digital marketing, optimization, content creation, design, and web development +[4th Whale Marketing](https://www.4thwhale.com/) is a Montreal-based company specializing in digital affiliate marketing. +Founded in 2004, their seasoned team combines many years of experience in digital marketing, optimization, content creation, design, and web development -They use Valkey, “to store data that changes regularly (every 10 seconds or less) and needs to be available very quickly and often with the latest update possible.” The impetus for the change was that their cloud provider made it easy and cost effective which resulted in 4th Whale saving $18k USD per year. It took them 20 minutes to upgrade one instance through tooling from their cloud provider. Once everything was tested and working as expected, they upgraded their other two instances. +They use Valkey, “to store data that changes regularly (every 10 seconds or less) and needs to be available very quickly and often with the latest update possible.” +The impetus for the change was that their cloud provider made it easy and cost effective which resulted in 4th Whale saving $18k USD per year. +It took them 20 minutes to upgrade one instance through tooling from their cloud provider. +Once everything was tested and working as expected, they upgraded their other two instances. -This story of upgrading to Valkey with minimal friction and seeing great benefits is not unique to these two organizations. One provider of Valkey as a Service has shared similar experiences from companies like Tubi and Nextdoor on their testimonials page. Similarly, a year in review for Valkey shows even more stories from organizations like Verizon, Fedora, and AlmaLinux. The move and savings these organizations experienced are only possible in a level playing field, competitive, vendor neutral environment. Users can deploy Valkey wherever, whenever. Vendors can build services on top of Valkey quickly and at a low cost. As a Linux Foundation project, Valkey has no motivation to lock users in because it is controlled by no single company and will never change its license. +This story of upgrading to Valkey with minimal friction and seeing great benefits is not unique to these two organizations. +One provider of Valkey as a Service has shared similar experiences from companies like Tubi and Nextdoor on their testimonials page. +Similarly, a year in review for Valkey shows even more stories from organizations like Verizon, Fedora, and AlmaLinux. +The move and savings these organizations experienced are only possible in a level playing field, competitive, vendor neutral environment. +Users can deploy Valkey wherever, whenever. +Vendors can build services on top of Valkey quickly and at a low cost. +As a Linux Foundation project, Valkey has no motivation to lock users in because it is controlled by no single company and will never change its license. -Are you using Valkey? We'd love to include you in this series and list your company logo on this site. Please contact us by reaching out on Slack. +Are you using Valkey? +We'd love to include you in this series and list your company logo on this site. +Please contact us by reaching out on Slack. diff --git a/content/blog/2025-05-21-performance-optimization-methodology-for-valkey/index.md b/content/blog/2025-05-21-performance-optimization-methodology-for-valkey/index.md index 27d16377..710bceb9 100644 --- a/content/blog/2025-05-21-performance-optimization-methodology-for-valkey/index.md +++ b/content/blog/2025-05-21-performance-optimization-methodology-for-valkey/index.md @@ -12,7 +12,8 @@ featured = true featured_image = "/assets/media/featured/random-04.webp" +++ -Performance optimization is a multifaceted domain, particularly for high-performance systems like Valkey. While overall system performance depends on numerous factors including hardware specifications, OS configurations, network conditions, and deployment architectures, our work focuses specifically on optimizing Valkey's performance at the CPU level. +Performance optimization is a multifaceted domain, particularly for high-performance systems like Valkey. +While overall system performance depends on numerous factors including hardware specifications, OS configurations, network conditions, and deployment architectures, our work focuses specifically on optimizing Valkey's performance at the CPU level. ## Introduction @@ -20,9 +21,13 @@ When examining software CPU optimization approaches, two fundamental strategies ### Strategy 1: Maximizing Parallelism -This strategy involves redesigning software architecture to fully leverage multiple CPU cores. By effectively distributing workloads across available computing resources, applications can achieve significant throughput improvements—a critical advantage as processor core counts continue to increase. +This strategy involves redesigning software architecture to fully leverage multiple CPU cores. +By effectively distributing workloads across available computing resources, applications can achieve significant throughput improvements—a critical advantage as processor core counts continue to increase. -The I/O threading model in Valkey exemplifies this approach. As described in the Valkey blog post ["Unlock 1 Million RPS: Experience Triple the Speed with Valkey"](https://valkey.io/blog/unlock-one-million-rps/), this architecture enables Valkey to offload operations to dedicated threads, allowing better utilization of available CPU cores. Rather than handling all operations in a single thread, this model intelligently delegates tasks to multiple threads, reducing bottlenecks and improving throughput. This enhancement has demonstrated impressive scalability, enabling near-linear performance scaling with additional cores. +The I/O threading model in Valkey exemplifies this approach. +As described in the Valkey blog post ["Unlock 1 Million RPS: Experience Triple the Speed with Valkey"](https://valkey.io/blog/unlock-one-million-rps/), this architecture enables Valkey to offload operations to dedicated threads, allowing better utilization of available CPU cores. +Rather than handling all operations in a single thread, this model intelligently delegates tasks to multiple threads, reducing bottlenecks and improving throughput. +This enhancement has demonstrated impressive scalability, enabling near-linear performance scaling with additional cores. ### Strategy 2: Enhancing CPU Efficiency @@ -32,16 +37,19 @@ This strategy focuses on maximizing performance within limited CPU resources thr 2. **Improving IPC**: Optimizing how efficiently the processor executes instructions by addressing microarchitectural bottlenecks like cache misses, branch mispredictions, and memory access patterns. -Through our analysis and optimization efforts, we've identified several key methodologies that deliver significant performance improvements: eliminating redundant code, reducing lock contention, and addressing false sharing. We've also explored other techniques including asynchronous processing, batch operations, and leveraging CPU-specific instructions such as SIMD vectorization. +Through our analysis and optimization efforts, we've identified several key methodologies that deliver significant performance improvements: eliminating redundant code, reducing lock contention, and addressing false sharing. +We've also explored other techniques including asynchronous processing, batch operations, and leveraging CPU-specific instructions such as SIMD vectorization. -While parallelism allows us to "use more resources efficiently," efficiency optimizations enable us to "do more with the same resources." Both approaches are essential in a comprehensive optimization strategy, particularly for mission-critical systems like Valkey. +While parallelism allows us to "use more resources efficiently," efficiency optimizations enable us to "do more with the same resources." +Both approaches are essential in a comprehensive optimization strategy, particularly for mission-critical systems like Valkey. This article focuses primarily on the second strategy, exploring methodical approaches to improving CPU efficiency with concrete examples from our contributions to the Valkey codebase. ## Benchmarking: The Foundation for Reliable Performance Optimization -Reliable performance optimization requires consistent, reproducible measurements to evaluate whether code changes actually improve performance. Without methodical benchmarking in a controlled environment, it's impossible to accurately quantify improvements or determine if optimizations introduce regressions in other areas. +Reliable performance optimization requires consistent, reproducible measurements to evaluate whether code changes actually improve performance. +Without methodical benchmarking in a controlled environment, it's impossible to accurately quantify improvements or determine if optimizations introduce regressions in other areas. To isolate CPU performance factors and eliminate variables that might affect measurements, we've implemented the following constraints: @@ -50,11 +58,14 @@ To isolate CPU performance factors and eliminate variables that might affect mea 3. **Local network interfaces** (loopback) for client-server communication to minimize network variability, 4. **High CPU utilization** benchmark parameters to ensure we're measuring true CPU performance limits. -This controlled environment allows us to accurately attribute improvements to specific code optimizations, providing reliable measurements of throughput and latency improvements. For each optimization attempt, we establish baseline performance metrics, implement changes in isolation, and then re-measure to quantify the impact. This disciplined approach ensures that our optimizations deliver genuine benefits rather than illusory improvements that might disappear in production environments. +This controlled environment allows us to accurately attribute improvements to specific code optimizations, providing reliable measurements of throughput and latency improvements. +For each optimization attempt, we establish baseline performance metrics, implement changes in isolation, and then re-measure to quantify the impact. +This disciplined approach ensures that our optimizations deliver genuine benefits rather than illusory improvements that might disappear in production environments. ## Optimization Methodology -In the following sections, we'll share practical examples of optimization techniques applied to Valkey. These insights represent our modest contributions that might be helpful for others working on similar performance challenges. +In the following sections, we'll share practical examples of optimization techniques applied to Valkey. +These insights represent our modest contributions that might be helpful for others working on similar performance challenges. ### 1. Eliminating Redundant Code @@ -71,11 +82,13 @@ The key to finding redundant code lies in having: #### Real-World Examples -Through detailed CPU cycle hotspot analysis, we identified redundant logic in how Valkey prepares client connections for write operations. By analyzing execution patterns during high-throughput benchmarks, we discovered opportunities to eliminate unnecessary function calls in critical paths. +Through detailed CPU cycle hotspot analysis, we identified redundant logic in how Valkey prepares client connections for write operations. +By analyzing execution patterns during high-throughput benchmarks, we discovered opportunities to eliminate unnecessary function calls in critical paths. **Example 1: Optimizing Client Write Preparation** -In [PR #670](https://github.com/valkey-io/valkey/pull/670), we found redundant calls to `prepareClientToWrite()` when multiple `addReply` operations were performed consecutively. By restructuring the code to call this function only when necessary, we eliminated redundant operations in a hot path. +In [PR #670](https://github.com/valkey-io/valkey/pull/670), we found redundant calls to `prepareClientToWrite()` when multiple `addReply` operations were performed consecutively. +By restructuring the code to call this function only when necessary, we eliminated redundant operations in a hot path. **Example 2: Improving List Command Efficiency** @@ -90,19 +103,23 @@ When discussing lock overhead, we consider two aspects: 1. **Protected code scope**: The cost of operations within critical sections, 2. **Lock implementation overhead**: The cost of the synchronization mechanism itself. -Due to Valkey's single main thread design, there aren't many complex mutex-protected critical sections. Therefore, we focus on the overhead of synchronization primitives themselves, which becomes significant when the protected work is minimal. +Due to Valkey's single main thread design, there aren't many complex mutex-protected critical sections. +Therefore, we focus on the overhead of synchronization primitives themselves, which becomes significant when the protected work is minimal. -In Valkey, atomic operations are used to update global variables and shared data. While atomic operations are faster than mutex locks, they still introduce considerable overhead compared to non-atomic operations—particularly in high-throughput scenarios where these operations occur millions of times per second. +In Valkey, atomic operations are used to update global variables and shared data. +While atomic operations are faster than mutex locks, they still introduce considerable overhead compared to non-atomic operations—particularly in high-throughput scenarios where these operations occur millions of times per second. #### Real-World Examples **Thread-local Storage for Memory Tracking** -In [PR #674](https://github.com/valkey-io/valkey/pull/674), we introduced thread-local storage variables to optimize memory tracking. Previously, Valkey used atomic operations to update the global `used_memory` variable tracking memory allocation across all threads. +In [PR #674](https://github.com/valkey-io/valkey/pull/674), we introduced thread-local storage variables to optimize memory tracking. +Previously, Valkey used atomic operations to update the global `used_memory` variable tracking memory allocation across all threads. Our profiling identified that most operations on this variable were writes occurring within the same thread, with the system only occasionally reading the total memory usage across threads. -By implementing thread-local variables for each thread to track its own memory usage, we eliminated atomic operations during frequent writes. Each thread now updates its local counter using regular (non-atomic) operations, with the global value computed only when needed by summing thread-local values. +By implementing thread-local variables for each thread to track its own memory usage, we eliminated atomic operations during frequent writes. +Each thread now updates its local counter using regular (non-atomic) operations, with the global value computed only when needed by summing thread-local values. This optimization pattern is particularly effective when: 1. Most operations occur within a single thread, @@ -111,13 +128,16 @@ This optimization pattern is particularly effective when: ### 3. Eliminating False Sharing -False sharing occurs when different threads access different variables located within the same CPU cache line (typically 64 bytes). Even though threads work with different variables, the hardware treats these accesses as conflicts because they share the same cache line. +False sharing occurs when different threads access different variables located within the same CPU cache line (typically 64 bytes). +Even though threads work with different variables, the hardware treats these accesses as conflicts because they share the same cache line. -When one thread modifies its variable, the entire cache line is invalidated for all other cores, forcing them to reload the cache line even though their own variables haven't changed. This creates unnecessary cache coherence traffic and can significantly degrade performance. +When one thread modifies its variable, the entire cache line is invalidated for all other cores, forcing them to reload the cache line even though their own variables haven't changed. +This creates unnecessary cache coherence traffic and can significantly degrade performance. #### Identifying False Sharing -False sharing can be difficult to detect because it doesn't cause functional issues. Signs include: +False sharing can be difficult to detect because it doesn't cause functional issues. +Signs include: 1. **Unexplained Performance Scaling Issues**: Poor scaling despite threads working independently, 2. **High Cache Coherence Traffic**: Monitoring shows high rates of cache line invalidations, @@ -149,16 +169,21 @@ Instead of completely eliminating all false sharing (which would have degraded p ![Diagram of used memory thread layout showing false sharing mitigation](used-memory-thread-layout.png) -> "The reason we didn't take the struct padding way is the performance degradation. Because when calling functions like zmalloc_used_memory() (called in main thread mostly), the main thread will cost more cycles to fetch more cache lines (3 vs 16 cache lines). Per our benchmarking, it will have a ~3% performance degradation depending on the specific benchmark." +> "The reason we didn't take the struct padding way is the performance degradation. +> Because when calling functions like zmalloc_used_memory() (called in main thread mostly), the main thread will cost more cycles to fetch more cache lines (3 vs 16 cache lines). +> Per our benchmarking, it will have a ~3% performance degradation depending on the specific benchmark." Our solution focused on eliminating false sharing between the main thread and I/O threads while allowing it to remain among I/O threads: > "We did some tradeoff, just fixing the false sharing between main thread and io-threads, while keeping the false sharing in the io-threads for memory aggregation, because the resource of main thread is the bottleneck but resources of io-threads can be scaled." -This example illustrates that performance optimization isn't always about finding a theoretically perfect solution, but rather making intelligent tradeoffs based on real-world constraints and priorities. By focusing on the system's actual bottleneck (the main thread), we achieved better overall performance despite leaving some false sharing in place. +This example illustrates that performance optimization isn't always about finding a theoretically perfect solution, but rather making intelligent tradeoffs based on real-world constraints and priorities. +By focusing on the system's actual bottleneck (the main thread), we achieved better overall performance despite leaving some false sharing in place. ## Conclusion -The methodologies presented here demonstrate that effective performance optimization requires both systematic analysis and thoughtful implementation. By focusing on eliminating redundancy, reducing synchronization overhead, and addressing false sharing, we've achieved meaningful improvements in Valkey's performance. +The methodologies presented here demonstrate that effective performance optimization requires both systematic analysis and thoughtful implementation. +By focusing on eliminating redundancy, reducing synchronization overhead, and addressing false sharing, we've achieved meaningful improvements in Valkey's performance. -These optimizations demonstrate that even in mature, well-engineered systems, there are opportunities for performance improvement when guided by careful measurement and analysis. The key lesson is that understanding hardware characteristics and system bottlenecks enables targeted optimizations with substantial impact, even when implementation changes are relatively small. +These optimizations demonstrate that even in mature, well-engineered systems, there are opportunities for performance improvement when guided by careful measurement and analysis. +The key lesson is that understanding hardware characteristics and system bottlenecks enables targeted optimizations with substantial impact, even when implementation changes are relatively small. diff --git a/content/blog/2025-06-13-introducing-valkey-search/index.md b/content/blog/2025-06-13-introducing-valkey-search/index.md index 83c7de10..f92caec6 100644 --- a/content/blog/2025-06-13-introducing-valkey-search/index.md +++ b/content/blog/2025-06-13-introducing-valkey-search/index.md @@ -10,22 +10,37 @@ featured = false featured_image = "/assets/media/featured/random-08.webp" +++ -[Valkey-search](https://github.com/valkey-io/valkey-search) is an official Valkey module that introduces native vector similarity search capabilities. It allows you to efficiently create indexes and search through billions of vectors stored in your Valkey instances. Whether you're building semantic search, fraud detection systems, or conversational AI experiences, Valkey-Search provides a flexible and high-performance foundation for your application. It is compatible with Valkey versions 8.1.1 and above and is BSD-3-Clause licensed. +[Valkey-search](https://github.com/valkey-io/valkey-search) is an official Valkey module that introduces native vector similarity search capabilities. +It allows you to efficiently create indexes and search through billions of vectors stored in your Valkey instances. +Whether you're building semantic search, fraud detection systems, or conversational AI experiences, Valkey-Search provides a flexible and high-performance foundation for your application. +It is compatible with Valkey versions 8.1.1 and above and is BSD-3-Clause licensed. -In this blog, you'll learn how valkey-search works, explore key use cases it supports, understand its architecture and indexing model, and see how to integrate it into your own applications. You'll also gain insight into how it scales, ensures high availability, and supports hybrid queries that combine vector similarity with structured filtering. +In this blog, you'll learn how valkey-search works, explore key use cases it supports, understand its architecture and indexing model, and see how to integrate it into your own applications. +You'll also gain insight into how it scales, ensures high availability, and supports hybrid queries that combine vector similarity with structured filtering. ## Semantic Search -The ability of AI models to extract semantic meaning enables new classes of search algorithms, collectively known as semantic search. An AI model can process an input and convert it into a single high-dimension numeric vector – known as an embedding. Inputs with similar meaning will have similar embeddings. Semantic search is the process of converting a query into its embedding and searching a database of embeddings to find the most similar results. +The ability of AI models to extract semantic meaning enables new classes of search algorithms, collectively known as semantic search. +An AI model can process an input and convert it into a single high-dimension numeric vector – known as an embedding. +Inputs with similar meaning will have similar embeddings. +Semantic search is the process of converting a query into its embedding and searching a database of embeddings to find the most similar results. The semantic search process can be divided into three phases: -1. **Encode**: First, convert your input data into searchable units known as chunks. Chunking strategies are data-type specific. For example, with text one well-known chunking algorithm is to make each sentence be a chunk. Then use an AI model to generate an embedding for each chunk. The specific AI model used for encoding depends on the data type and specific use case. Many AI models are available as a service, such as Google Cloud’s [VertexAI](https://cloud.google.com/vertex-ai) or AWS’ [Bedrock](https://aws.amazon.com/bedrock/), simplifying the embedding generation process. +1. **Encode**: First, convert your input data into searchable units known as chunks. + Chunking strategies are data-type specific. + For example, with text one well-known chunking algorithm is to make each sentence be a chunk. + Then use an AI model to generate an embedding for each chunk. + The specific AI model used for encoding depends on the data type and specific use case. + Many AI models are available as a service, such as Google Cloud’s [VertexAI](https://cloud.google.com/vertex-ai) or AWS’ [Bedrock](https://aws.amazon.com/bedrock/), simplifying the embedding generation process. -2. **Index**: Store the generated embeddings along with any associated metadata in valkey-search. Each stored item is indexed with a primary key and a set of attributes spanning multiple modalities, for example, tags (categories), numbers (pricing), etc. -* **Search**: The query is converted into an embedding using the same AI model as was used in the **Encode** step above. This embedding is used with the vector search capability of valkey-search to locate the most similar vectors. The located vectors correspond to chunks of the original input that have the most similar meaning to the query. +2. **Index**: Store the generated embeddings along with any associated metadata in valkey-search. + Each stored item is indexed with a primary key and a set of attributes spanning multiple modalities, for example, tags (categories), numbers (pricing), etc. +* **Search**: The query is converted into an embedding using the same AI model as was used in the **Encode** step above. + This embedding is used with the vector search capability of valkey-search to locate the most similar vectors. + The located vectors correspond to chunks of the original input that have the most similar meaning to the query. ![Semantic search phases](images/highlevel-flow.png) @@ -41,63 +56,112 @@ Valkey-search’s ability to search billions of vectors with millisecond latenci ## Valkey-Search Architecture Overview -Valkey-search allows the creation of any number of named indexes. A valkey-search index can be thought of like a relational database table where a row is a Valkey key and a column is an attribute (field) within that key. Each index is defined to cover a portion of the Valkey keyspace and some list of attributes within those keys. Any mutation of a key within the scope of an index synchronously updates that index before that mutation command is acknowledged. Query operations can be performed on a single index, returning the located key names and optionally their contents. +Valkey-search allows the creation of any number of named indexes. +A valkey-search index can be thought of like a relational database table where a row is a Valkey key and a column is an attribute (field) within that key. +Each index is defined to cover a portion of the Valkey keyspace and some list of attributes within those keys. +Any mutation of a key within the scope of an index synchronously updates that index before that mutation command is acknowledged. +Query operations can be performed on a single index, returning the located key names and optionally their contents. -Indexes can be constructed over hash or JSON keys. For hash keys, the indexable attributes of the keys are just the hash fields. For JSON keys, the indexable attributes are identified using the JSON path notation. Regardless of key type, an index can have any number of attributes. Each attribute of an index is declared with a type and sometimes type-specific modifiers. Currently, three index attribute types are supported: Vector, Numeric and Tag. +Indexes can be constructed over hash or JSON keys. +For hash keys, the indexable attributes of the keys are just the hash fields. +For JSON keys, the indexable attributes are identified using the JSON path notation. +Regardless of key type, an index can have any number of attributes. +Each attribute of an index is declared with a type and sometimes type-specific modifiers. +Currently, three index attribute types are supported: Vector, Numeric and Tag. ### Index Creation -The [FT.CREATE](https://valkey.io/commands/ft.create/) command is used to create a new, empty index. This causes the system to automatically initiate an asynchronous background process to scan the keyspace for keys that belong in the index in a process called backfilling. The backfill process runs until the entire keyspace has been scanned for the index. The `backfill_in_progress` and `backfill_complete_percent` fields of the [FT.INFO](https://valkey.io/commands/ft.info/) command result can be used to monitor the progress of the backfill. Once the backfill is complete it need not be executed against the index again. +The [FT.CREATE](https://valkey.io/commands/ft.create/) command is used to create a new, empty index. +This causes the system to automatically initiate an asynchronous background process to scan the keyspace for keys that belong in the index in a process called backfilling. +The backfill process runs until the entire keyspace has been scanned for the index. +The `backfill_in_progress` and `backfill_complete_percent` fields of the [FT.INFO](https://valkey.io/commands/ft.info/) command result can be used to monitor the progress of the backfill. +Once the backfill is complete it need not be executed against the index again. -During the backfill process, query and ingestion operations proceed normally. Queries will be executed against the current state of the index. Newly mutated data will be placed into the index as usual and remain unaffected by the backfill process. Thus after the creation of an index – while it is backfilling – the application can be certain that queries will contain the results of all data that has been ingested *after* the creation of the index and *some* of the data ingested *before*. Once the backfill has completed then queries will consider all data covered by the index. +During the backfill process, query and ingestion operations proceed normally. +Queries will be executed against the current state of the index. +Newly mutated data will be placed into the index as usual and remain unaffected by the backfill process. +Thus after the creation of an index – while it is backfilling – the application can be certain that queries will contain the results of all data that has been ingested *after* the creation of the index and *some* of the data ingested *before*. +Once the backfill has completed then queries will consider all data covered by the index. -In cluster mode, the `FT.CREATE` command can be sent to any primary node of the cluster and the system will automatically distribute the new index definition to all cluster members. The distribution is done using a combination of the cluster bus and direct gRPC communication between nodes. In the rare case where the distribution machinery detects an inconsistency between nodes, a last-writer-wins (LWW) collision resolution protocol is invoked to enable eventual cluster-wide consistency. +In cluster mode, the `FT.CREATE` command can be sent to any primary node of the cluster and the system will automatically distribute the new index definition to all cluster members. +The distribution is done using a combination of the cluster bus and direct gRPC communication between nodes. +In the rare case where the distribution machinery detects an inconsistency between nodes, a last-writer-wins (LWW) collision resolution protocol is invoked to enable eventual cluster-wide consistency. ## Vector Search Algorithms -Valkey-search offers K Nearest Neighbor (KNN) search. Applications supply a reference vector and request that the system locate the K vectors which are closest to the reference vector using the a specified distance function (L2, IP or cosine). KNN searching is a classic problem which lacks an efficient exact ideal solution. Valkey-search addresses this problem by providing two different algorithms that the developer can select from: +Valkey-search offers K Nearest Neighbor (KNN) search. +Applications supply a reference vector and request that the system locate the K vectors which are closest to the reference vector using the a specified distance function (L2, IP or cosine). +KNN searching is a classic problem which lacks an efficient exact ideal solution. +Valkey-search addresses this problem by providing two different algorithms that the developer can select from: The first algorithm performs an exhaustive linear search, providing exactly correct answers but with a run-time that may be intolerable on large data sets. -The second algorithm addresses this problem by compromising on accuracy in exchange for shorter run-times. In other words, it runs very fast but may not deliver exactly the correct answer. This type of algorithm is often known as Approximate Nearest Neighbor (ANN). The term "recall" is used to measure the quality of an ANN algorithm result and is expressed as the ratio (or percentage) of the found answers to the correct answers, e.g., a recall of 0.95 (or 95%) means that for a search with K = 100, 95 of the correct answers were found. There is a tradeoff between the recall of an ANN algorithm and its time/space resource consumption. +The second algorithm addresses this problem by compromising on accuracy in exchange for shorter run-times. +In other words, it runs very fast but may not deliver exactly the correct answer. +This type of algorithm is often known as Approximate Nearest Neighbor (ANN). +The term "recall" is used to measure the quality of an ANN algorithm result and is expressed as the ratio (or percentage) of the found answers to the correct answers, e.g., a recall of 0.95 (or 95%) means that for a search with K = 100, 95 of the correct answers were found. +There is a tradeoff between the recall of an ANN algorithm and its time/space resource consumption. -Valkey-search supports the [Hierarchical Navigable Small Worlds](https://en.wikipedia.org/wiki/Hierarchical_navigable_small_world) (HNSW) ANN algorithm as it provides the best performance at the highest levels of recall demanded by real-time applications. The HNSW algorithm has (`O(log N)`) time complexity and gives the developer three parameters to adjust the CPU and memory consumption vs recall. The relationship between these parameters and the resulting operation latency and recall is complex and data dependent. It is recommended that developers test with data that closely approximates production environments. +Valkey-search supports the [Hierarchical Navigable Small Worlds](https://en.wikipedia.org/wiki/Hierarchical_navigable_small_world) (HNSW) ANN algorithm as it provides the best performance at the highest levels of recall demanded by real-time applications. +The HNSW algorithm has (`O(log N)`) time complexity and gives the developer three parameters to adjust the CPU and memory consumption vs recall. +The relationship between these parameters and the resulting operation latency and recall is complex and data dependent. +It is recommended that developers test with data that closely approximates production environments. ## Hybrid Query Support -Valkey-search query operations are not limited to just vector searching. Documents can contain additional metadata that can be used to enhance searches. Two types of metadata are currently supported: Numeric and Tag. Numeric metadata supports range queries, i.e., you can include or exclude documents with metadata in the particular range. Tag metadata is an enumerated list of words. Tag searches can be done with an exact word match or a prefix match (trailing wild card). +Valkey-search query operations are not limited to just vector searching. +Documents can contain additional metadata that can be used to enhance searches. +Two types of metadata are currently supported: Numeric and Tag. +Numeric metadata supports range queries, i.e., you can include or exclude documents with metadata in the particular range. +Tag metadata is an enumerated list of words. +Tag searches can be done with an exact word match or a prefix match (trailing wild card). Hybrid queries are vector query operations which have been augmented with a filter, constructed from the numeric and tag searching operators combined with the usual logical operators `AND`, `OR`, and `NOT.` -Hybrid queries are particularly powerful for real-world applications, where a mix of vector and non-vector attributes defines the relevance of results. For example, a numeric field could be used as a timestamp, meaning that search operations could be automatically confined to a particular period of time. Another example would be to use a tag field to indicate a language. +Hybrid queries are particularly powerful for real-world applications, where a mix of vector and non-vector attributes defines the relevance of results. +For example, a numeric field could be used as a timestamp, meaning that search operations could be automatically confined to a particular period of time. +Another example would be to use a tag field to indicate a language. ### Query Execution -When executing hybrid queries, valkey-search automatically selects from one of two strategies as part of the query execution planning phase. This is done by breaking down the query filter into predicates and estimating the selectivity of each predicate to estimate the least expensive execution strategy. +When executing hybrid queries, valkey-search automatically selects from one of two strategies as part of the query execution planning phase. +This is done by breaking down the query filter into predicates and estimating the selectivity of each predicate to estimate the least expensive execution strategy. -**Pre-filtering:** This algorithm has two sequential steps: first, a temporary dataset is created using only the documents which pass the filter expression, then a linear KNN similarity search of is performed on the temporary dataset. Pre-filtering is particularly effective for high selectivity queries, i.e., the filter significantly narrows down the dataset. +**Pre-filtering:** This algorithm has two sequential steps: first, a temporary dataset is created using only the documents which pass the filter expression, then a linear KNN similarity search of is performed on the temporary dataset. +Pre-filtering is particularly effective for high selectivity queries, i.e., the filter significantly narrows down the dataset. -**Inline-filtering:** In this algorithm, filtering is done *during* the vector search itself. As the HNSW search graph is traversed, each candidate document is tested against the filter criteria before being added to the result set. This method is best suited for cases where the filter isn’t highly selective, i.e., the filter matches a large amount of the dataset. +**Inline-filtering:** In this algorithm, filtering is done *during* the vector search itself. +As the HNSW search graph is traversed, each candidate document is tested against the filter criteria before being added to the result set. +This method is best suited for cases where the filter isn’t highly selective, i.e., the filter matches a large amount of the dataset. ## High Availability -Valkey-search is built on top of Valkey, leveraging its primary/replica-based architecture to provide high availability (HA). Diagram #2 shows a typical configuration of one primary and three replicas. In the event of a primary node failure, the system automatically promotes one of the replicas to become the new primary. +Valkey-search is built on top of Valkey, leveraging its primary/replica-based architecture to provide high availability (HA). +Diagram #2 shows a typical configuration of one primary and three replicas. +In the event of a primary node failure, the system automatically promotes one of the replicas to become the new primary. -Clients must send data mutation (write) commands to the primary node which are executed and then automatically asynchronously transmitted to each replica. Clients can send data read operations to any node in the cluster, recognizing that reading from a replica is eventually consistent. +Clients must send data mutation (write) commands to the primary node which are executed and then automatically asynchronously transmitted to each replica. +Clients can send data read operations to any node in the cluster, recognizing that reading from a replica is eventually consistent. -When valkey-search is used, each node, whether a primary or a replica, builds and maintains its own indexes. No additional traffic on the replication channel is generated for index maintenance. Search query operations sent to a replica will be executed against its indexes, reflecting the historical point in time of the data within that node. +When valkey-search is used, each node, whether a primary or a replica, builds and maintains its own indexes. +No additional traffic on the replication channel is generated for index maintenance. +Search query operations sent to a replica will be executed against its indexes, reflecting the historical point in time of the data within that node. ![High availability](images/ha.png) ## Scaling -Valkey-search supports all three methods of scaling: horizontal, vertical and replicas. When scaling for capacity, valkey-search behaves just like regular Valkey, i.e., increasing the memory of individual nodes (vertical scaling) or increasing the number of nodes (horizontal scaling) will increase the overall capacity. +Valkey-search supports all three methods of scaling: horizontal, vertical and replicas. +When scaling for capacity, valkey-search behaves just like regular Valkey, i.e., increasing the memory of individual nodes (vertical scaling) or increasing the number of nodes (horizontal scaling) will increase the overall capacity. -However, from a performance perspective, valkey-search behaves very differently from regular Valkey. The multi-threaded implementation of valkey-search means that additional CPUs yield up to linear increases in both query and ingestion throughput. Horizontal scaling yields linear increases in ingestion throughput but may provide little to no benefit on query throughput. If additional query throughput is required, scaling through replicas or additional CPUs is required. +However, from a performance perspective, valkey-search behaves very differently from regular Valkey. +The multi-threaded implementation of valkey-search means that additional CPUs yield up to linear increases in both query and ingestion throughput. +Horizontal scaling yields linear increases in ingestion throughput but may provide little to no benefit on query throughput. +If additional query throughput is required, scaling through replicas or additional CPUs is required. ![Scaling](images/cluster.png) @@ -105,39 +169,57 @@ However, from a performance perspective, valkey-search behaves very differently ## Snapshots -Valkey’s point-in-time RDB snapshotting mechanism is a key component for maintaining high availability, zero downtime, and minimal operational overhead. Beyond persistence and loading from disk snapshots, RDB plays a crucial role in full-sync operations, where a primary node synchronizes its in-memory data with a replica node in an HA setup. Full-sync is commonly triggered when a new replica joins the cluster but may also occur if a secondary falls too far behind due to prolonged lag. +Valkey’s point-in-time RDB snapshotting mechanism is a key component for maintaining high availability, zero downtime, and minimal operational overhead. +Beyond persistence and loading from disk snapshots, RDB plays a crucial role in full-sync operations, where a primary node synchronizes its in-memory data with a replica node in an HA setup. +Full-sync is commonly triggered when a new replica joins the cluster but may also occur if a secondary falls too far behind due to prolonged lag. Valkey-search enhances the Valkey snapshotting mechanism to include index definitions and vector indexes and is built for resilience and efficiency: -**Fast Turn-up:** New nodes must become fully operational in minimal time. While rebuilding an index on startup is an option, ingesting a large volume of vectors can be prohibitively slow, delaying system readiness. A snapshot captures not only the index metadata but also the vector index content which significantly reduces downtime and operational burden. +**Fast Turn-up:** New nodes must become fully operational in minimal time. +While rebuilding an index on startup is an option, ingesting a large volume of vectors can be prohibitively slow, delaying system readiness. +A snapshot captures not only the index metadata but also the vector index content which significantly reduces downtime and operational burden. -**Backward/Forward Compatibility:** Cluster upgrades or downgrades often result in a temporary mix of node versions. valkey-search seamlessly handles such scenarios with a serialization format based on [Protocol Buffers (Protobuf)](https://en.wikipedia.org/wiki/Protocol_Buffers), ensuring both backward and forward compatibility. This simplifies version transitions and reduces the chance of costly re-indexing. +**Backward/Forward Compatibility:** Cluster upgrades or downgrades often result in a temporary mix of node versions. valkey-search seamlessly handles such scenarios with a serialization format based on [Protocol Buffers (Protobuf)](https://en.wikipedia.org/wiki/Protocol_Buffers), ensuring both backward and forward compatibility. +This simplifies version transitions and reduces the chance of costly re-indexing. ## RediSearch API Compatibility -Valkey-search implements a subset of RediSearch’s functionality, with compatibility across key vector search APIs. This enables integration with most existing RediSearch client libraries, allowing you to continue using familiar tools. Developers already experienced with RediSearch can adopt valkey-search with minimal changes, as the vector search API remains largely consistent. +Valkey-search implements a subset of RediSearch’s functionality, with compatibility across key vector search APIs. +This enables integration with most existing RediSearch client libraries, allowing you to continue using familiar tools. +Developers already experienced with RediSearch can adopt valkey-search with minimal changes, as the vector search API remains largely consistent. ## Performance & Low Latency -Valkey-search was designed from the ground up as an in-memory secondary index. A multi-threaded architecture optimizes query and mutation processing with minimal thread contention, enabling near-linear vertical scalability. +Valkey-search was designed from the ground up as an in-memory secondary index. +A multi-threaded architecture optimizes query and mutation processing with minimal thread contention, enabling near-linear vertical scalability. -At its core, valkey-search’s threading architecture follows a common design pattern: a worker thread pool combined with task queues. It employs advanced synchronization mechanisms to maintain index consistency while minimizing contention among worker threads. By time-slicing CPU access between read and write operations, the system minimizes locks on the read path, delivering high performance and consistently low search latency. +At its core, valkey-search’s threading architecture follows a common design pattern: a worker thread pool combined with task queues. +It employs advanced synchronization mechanisms to maintain index consistency while minimizing contention among worker threads. +By time-slicing CPU access between read and write operations, the system minimizes locks on the read path, delivering high performance and consistently low search latency. -Valkey-search’s HNSW implementation is based on the OSS project [HNSWLib](https://github.com/nmslib/hnswlib). While HNSWLib is well-regarded for its speed, we have enhanced its performance and efficiency for our use case. These improvements include better SIMD utilization, promotion of CPU cache efficiency, memory utilization and more. +Valkey-search’s HNSW implementation is based on the OSS project [HNSWLib](https://github.com/nmslib/hnswlib). +While HNSWLib is well-regarded for its speed, we have enhanced its performance and efficiency for our use case. +These improvements include better SIMD utilization, promotion of CPU cache efficiency, memory utilization and more. ## Future Enhancements -This first release of valkey-search focuses on vector search, but it is designed as a general-purpose indexing subsystem. Future releases will extend both the available data types as well as provide post-query data processing facilities. +This first release of valkey-search focuses on vector search, but it is designed as a general-purpose indexing subsystem. +Future releases will extend both the available data types as well as provide post-query data processing facilities. ## Get Involved -Valkey-search is open source and ready for you to explore. Whether you're building cutting-edge AI applications or integrating vector search into existing systems, we invite you to try it out. The easiest way to get started is by visiting the [GitHub repository](https://github.com/valkey-io/valkey-search), where you'll find setup instructions, documentation, and examples. +Valkey-search is open source and ready for you to explore. +Whether you're building cutting-edge AI applications or integrating vector search into existing systems, we invite you to try it out. +The easiest way to get started is by visiting the [GitHub repository](https://github.com/valkey-io/valkey-search), where you'll find setup instructions, documentation, and examples. -We welcome contributions of all kinds - code, documentation, testing, and feedback. Join the community, file issues, open pull requests, or suggest improvements. Your involvement helps make valkey-search better for everyone. +We welcome contributions of all kinds - code, documentation, testing, and feedback. +Join the community, file issues, open pull requests, or suggest improvements. +Your involvement helps make valkey-search better for everyone. -Ready to dive in? Clone the repo, fire up the [dev container](https://hub.docker.com/r/valkey/valkey-bundle), and start building high-performance vector search with valkey-search. +Ready to dive in? +Clone the repo, fire up the [dev container](https://hub.docker.com/r/valkey/valkey-bundle), and start building high-performance vector search with valkey-search. diff --git a/content/blog/2025-06-23-valkey-bundle-one-stop-shop-for-low-latency-modern-applications/index.md b/content/blog/2025-06-23-valkey-bundle-one-stop-shop-for-low-latency-modern-applications/index.md index f262c319..40430412 100644 --- a/content/blog/2025-06-23-valkey-bundle-one-stop-shop-for-low-latency-modern-applications/index.md +++ b/content/blog/2025-06-23-valkey-bundle-one-stop-shop-for-low-latency-modern-applications/index.md @@ -13,13 +13,16 @@ featured_image = "/assets/media/featured/random-02.webp" ![valkey-bundle](images/valkey-bundle.png) -Are you looking to build low-latency, high-performance, feature-rich applications without the hassle of managing multiple dependencies? Meet *valkey-bundle* your new best friend in the world of modern application development! +Are you looking to build low-latency, high-performance, feature-rich applications without the hassle of managing multiple dependencies? +Meet *valkey-bundle* your new best friend in the world of modern application development! -*valkey-bundle* enhances developer productivity by providing easy access to four tools in addition to the Valkey 8.1.1 through one container: [Valkey JSON](https://github.com/valkey-io/valkey-json), [Valkey Bloom](https://github.com/valkey-io/valkey-bloom), [Valkey Search](https://github.com/valkey-io/valkey-search), and [Valkey LDAP](https://github.com/valkey-io/valkey-ldap). *valkey-bundle* enables teams to leverage native JSON support for reliable document data handling, while implementing efficient data filtering using bloom, vector similarity search and handling authentication through LDAP. You have all these modules to pick from, mix and match for your requirements. +*valkey-bundle* enhances developer productivity by providing easy access to four tools in addition to the Valkey 8.1.1 through one container: [Valkey JSON](https://github.com/valkey-io/valkey-json), [Valkey Bloom](https://github.com/valkey-io/valkey-bloom), [Valkey Search](https://github.com/valkey-io/valkey-search), and [Valkey LDAP](https://github.com/valkey-io/valkey-ldap). *valkey-bundle* enables teams to leverage native JSON support for reliable document data handling, while implementing efficient data filtering using bloom, vector similarity search and handling authentication through LDAP. +You have all these modules to pick from, mix and match for your requirements. *valkey-bundle* provides a simplified development experience that eliminates dependency conflicts and reduces setup time with a single container deployment, teams can simplify their CI/CD pipelines while maintaining consistency across development and production environments. -From a security perspective, *valkey-bundle* integrates enterprise grade authentication through Valkey LDAP, enabling cohesive integration with existing identity providers while maintaining strict access controls. This built-in security layer on top of existing Valkey Access Control Lists ([ACL](https://valkey.io/topics/acl/)) ensures that your data remains protected without sacrificing performance or adding complexity to your architecture. +From a security perspective, *valkey-bundle* integrates enterprise grade authentication through Valkey LDAP, enabling cohesive integration with existing identity providers while maintaining strict access controls. +This built-in security layer on top of existing Valkey Access Control Lists ([ACL](https://valkey.io/topics/acl/)) ensures that your data remains protected without sacrificing performance or adding complexity to your architecture. Besides the technical capabilities that *valkey-bundle* provides my favorite thing about this new solution is to see the Valkey community working together releasing modules catering to different use cases driven by Valkey users requests in an open forum in the discussions section of the project for example: [Implement JSON and search](https://github.com/orgs/valkey-io/discussions/212), [FEATURE: JSON/ReJSON](https://github.com/orgs/valkey-io/discussions/119), [Modules](https://github.com/orgs/valkey-io/discussions/108), and [FEATURE: Bloom Filters](https://github.com/orgs/valkey-io/discussions/215). @@ -62,11 +65,14 @@ module:name=ldap,ver=16777471,api=1,filters=0,usedby=[],using=[],options=[] ## *valkey-bundle* Features and CLI Examples -Each module in *valkey-bundle* addresses specific challenges for modern applications with low latency requirements that currently use Valkey and would like to add the functionality of JSON, VSS Search, Bloom filters, and LDAP. In this section, we explore each module currently included in *valkey-bundle* 8.1.1, understand the technical capabilities and constraints by CLI examples. +Each module in *valkey-bundle* addresses specific challenges for modern applications with low latency requirements that currently use Valkey and would like to add the functionality of JSON, VSS Search, Bloom filters, and LDAP. +In this section, we explore each module currently included in *valkey-bundle* 8.1.1, understand the technical capabilities and constraints by CLI examples. ### JSON Document Storage and Querying -[Valkey JSON](https://github.com/valkey-io/valkey-json) brings native [JSON](https://en.wikipedia.org/wiki/JSON) support to your applications, eliminating the need to serialize/deserialize data or maintain complex object-relational mappings. It implements the [RFC7159](https://datatracker.ietf.org/doc/html/rfc7159.html) and [ECMA-404](https://ecma-international.org/publications-and-standards/standards/ecma-404/) JSON standards, providing a foundation for storing and querying structured data. With support for [JSONPath](https://en.wikipedia.org/wiki/JSONPath) queries, you can perform complex query operations on nested data structures without writing custom parsing logic. +[Valkey JSON](https://github.com/valkey-io/valkey-json) brings native [JSON](https://en.wikipedia.org/wiki/JSON) support to your applications, eliminating the need to serialize/deserialize data or maintain complex object-relational mappings. +It implements the [RFC7159](https://datatracker.ietf.org/doc/html/rfc7159.html) and [ECMA-404](https://ecma-international.org/publications-and-standards/standards/ecma-404/) JSON standards, providing a foundation for storing and querying structured data. +With support for [JSONPath](https://en.wikipedia.org/wiki/JSONPath) queries, you can perform complex query operations on nested data structures without writing custom parsing logic. **Key Capabilities and Constraints:** @@ -118,11 +124,14 @@ Perform *Array* operations by inserting an item to the orders list using [`JSON. 1) (integer) 3 ``` -[Valkey JSON](https://github.com/valkey-io/valkey-json) version [1.0.0](https://github.com/valkey-io/valkey-json/releases/tag/1.0.0) included in *valkey-bundle* was released on Tuesday April 1st 2025. If you would like to dive deeper see more details in the [Valkey JSON Documentation](https://valkey.io/topics/valkey-json/) and explore the list of [commands](https://valkey.io/commands/#json) included. +[Valkey JSON](https://github.com/valkey-io/valkey-json) version [1.0.0](https://github.com/valkey-io/valkey-json/releases/tag/1.0.0) included in *valkey-bundle* was released on Tuesday April 1st 2025. +If you would like to dive deeper see more details in the [Valkey JSON Documentation](https://valkey.io/topics/valkey-json/) and explore the list of [commands](https://valkey.io/commands/#json) included. ### Efficient Data Filtering with Bloom Filters -[Valkey Bloom](https://github.com/valkey-io/valkey-bloom) implements space-efficient probabilistic data structures that allow membership testing. Use cases are de-duplication, filtering, and avoid one-hit-wonders in caching (data that is accessed exactly once and then never requested again). [Bloom filters](https://en.wikipedia.org/wiki/Bloom_filter) can reduce memory usage by up to 98% compared to the `SET` data structure while maintaining fast lookup times. +[Valkey Bloom](https://github.com/valkey-io/valkey-bloom) implements space-efficient probabilistic data structures that allow membership testing. +Use cases are de-duplication, filtering, and avoid one-hit-wonders in caching (data that is accessed exactly once and then never requested again). +[Bloom filters](https://en.wikipedia.org/wiki/Bloom_filter) can reduce memory usage by up to 98% compared to the `SET` data structure while maintaining fast lookup times. **Key Capabilities and Constraints** @@ -134,7 +143,8 @@ Perform *Array* operations by inserting an item to the orders list using [`JSON. * **Non-scaling filters**: Fixed capacity for better performance. * **Scaling filters**: Dynamic growth with configurable expansion rate. * **Performance Characteristics** - * **Time complexity**: Bloom filter operations take **O(k)** time because you must compute k different hash functions and access k different bit positions in the array for every insert or lookup operation. The time complexity is independent of the number of items stored or the size of the bit array - it only depends on the number of hash functions configured for the filter. + * **Time complexity**: Bloom filter operations take **O(k)** time because you must compute k different hash functions and access k different bit positions in the array for every insert or lookup operation. + The time complexity is independent of the number of items stored or the size of the bit array - it only depends on the number of hash functions configured for the filter. * **Performance Tip:** Start with larger initial capacities to avoid scaling. * **Accuracy Control** * Configurable false positive rate (default: 0.01 or 1%) a tradeoff between time and space for accuracy. @@ -188,11 +198,13 @@ Check for multiple items in a single roundtrip using [`BF.MEXISTS`](https://valk 3) (integer) 0 ``` -[Valkey Bloom](https://github.com/valkey-io/valkey-bloom) version [1.0.0](https://github.com/valkey-io/valkey-bloom/releases/tag/1.0.0) included in *valkey-bundle* was released on Tuesday April 1st 2025. If you would like to learn more details, commands and examples see the [Valkey Bloom Documentation](https://valkey.io/topics/bloomfilters/) and the blog [Introducing Bloom Filters for Valkey](https://valkey.io/blog/introducing-bloom-filters/). +[Valkey Bloom](https://github.com/valkey-io/valkey-bloom) version [1.0.0](https://github.com/valkey-io/valkey-bloom/releases/tag/1.0.0) included in *valkey-bundle* was released on Tuesday April 1st 2025. +If you would like to learn more details, commands and examples see the [Valkey Bloom Documentation](https://valkey.io/topics/bloomfilters/) and the blog [Introducing Bloom Filters for Valkey](https://valkey.io/blog/introducing-bloom-filters/). ### High-Performance Vector Similarity Search -[Valkey Search](https://github.com/valkey-io/valkey-search) provides your application with high performance vector similarity search capabilities, essential for modern AI-driven applications. It delivers single digit millisecond latency at 99% recall even with billions of vectors through optimized implementations of Approximate Nearest Neighbor ([ANN](https://en.wikipedia.org/wiki/Nearest_neighbor_search#Approximation_methods)) search with Hierarchical navigable small world ([HNSW](https://en.wikipedia.org/wiki/Hierarchical_navigable_small_world)) and exact matching using K-Nearest Neighbors ([KNN](https://en.wikipedia.org/wiki/Nearest_neighbor_search#Approximation_methods)) algorithms. +[Valkey Search](https://github.com/valkey-io/valkey-search) provides your application with high performance vector similarity search capabilities, essential for modern AI-driven applications. +It delivers single digit millisecond latency at 99% recall even with billions of vectors through optimized implementations of Approximate Nearest Neighbor ([ANN](https://en.wikipedia.org/wiki/Nearest_neighbor_search#Approximation_methods)) search with Hierarchical navigable small world ([HNSW](https://en.wikipedia.org/wiki/Hierarchical_navigable_small_world)) and exact matching using K-Nearest Neighbors ([KNN](https://en.wikipedia.org/wiki/Nearest_neighbor_search#Approximation_methods)) algorithms. **Key Capabilities and Constraints** @@ -244,11 +256,14 @@ Perform Hybrid query combining vector similarity with filters using [`FT.SEARCH` PARAMS 2 query_vector "$encoded_vector" ``` -[Valkey Search](https://github.com/valkey-io/valkey-search) version [1.0.1](https://github.com/valkey-io/valkey-search/releases/tag/1.0.1) included in *valkey-bundle* was released on Wednesday June 11th 2025. If you would like to learn more about the capabilities and opportunities this module provides see the [Valkey Search Documentation](https://valkey.io/topics/search/). +[Valkey Search](https://github.com/valkey-io/valkey-search) version [1.0.1](https://github.com/valkey-io/valkey-search/releases/tag/1.0.1) included in *valkey-bundle* was released on Wednesday June 11th 2025. +If you would like to learn more about the capabilities and opportunities this module provides see the [Valkey Search Documentation](https://valkey.io/topics/search/). ### Enhanced Security with existing Mechanisms with LDAP -[Valkey LDAP](https://github.com/valkey-io/valkey-ldap) integrates with your existing identity management infrastructure, providing robust authentication without requiring additional user management systems. It supports both simple *bind* and *search+bind* modes, making it compatible with various LDAP directory structures. This flexibility ensures that you can maintain enterprise security standards while leveraging the power of *valkey-bundle*. +[Valkey LDAP](https://github.com/valkey-io/valkey-ldap) integrates with your existing identity management infrastructure, providing robust authentication without requiring additional user management systems. +It supports both simple *bind* and *search+bind* modes, making it compatible with various LDAP directory structures. +This flexibility ensures that you can maintain enterprise security standards while leveraging the power of *valkey-bundle*. **Key Features** @@ -315,11 +330,13 @@ OK OK ``` -[Valkey LDAP](https://github.com/valkey-io/valkey-ldap) version [1.0.0](https://github.com/valkey-io/valkey-ldap/releases/tag/1.0.0) included in *valkey-bundle* was released on Sunday June 13th 2025. If you would like to learn more details about the capabilities read the [LDAP Authentication Documentation](https://valkey.io/topics/ldap/). +[Valkey LDAP](https://github.com/valkey-io/valkey-ldap) version [1.0.0](https://github.com/valkey-io/valkey-ldap/releases/tag/1.0.0) included in *valkey-bundle* was released on Sunday June 13th 2025. +If you would like to learn more details about the capabilities read the [LDAP Authentication Documentation](https://valkey.io/topics/ldap/). ## Getting Ready for Production Deployment -Deploying *valkey-bundle* in production requires careful consideration of persistence, configuration, monitoring, and security. These foundational elements ensure your application maintains data integrity, performs optimally, and scales reliably under production workloads. +Deploying *valkey-bundle* in production requires careful consideration of persistence, configuration, monitoring, and security. +These foundational elements ensure your application maintains data integrity, performs optimally, and scales reliably under production workloads. For example: @@ -331,7 +348,8 @@ $ docker run --name my-valkey-bundle \ ### Custom Configuration -A well-structured configuration file is essential for production deployments as it provides centralized control over all module settings, security parameters, and performance tuning options. The configuration below demonstrates a production-ready setup that balances performance, security, and resource utilization across all *valkey-bundle* modules. +A well-structured configuration file is essential for production deployments as it provides centralized control over all module settings, security parameters, and performance tuning options. +The configuration below demonstrates a production-ready setup that balances performance, security, and resource utilization across all *valkey-bundle* modules. This sample configuration file includes optimized settings for: @@ -433,13 +451,17 @@ $ docker run -v /valkey/my-valkey-bundle.conf:/usr/local/etc/valkey \ ## Real-World Example: Personalized Ad Platform -Consider a typical scenario: you're building a recommendation engine for an ad platform that needs to process JSON data, perform similarity searches, and efficiently track user interactions. Traditionally, this would require integrating and maintaining multiple services, each with its own configuration, deployment, and scaling considerations. With *valkey-bundle*, these capabilities are available out-of-the-box, all through a unified interface. +Consider a typical scenario: you're building a recommendation engine for an ad platform that needs to process JSON data, perform similarity searches, and efficiently track user interactions. +Traditionally, this would require integrating and maintaining multiple services, each with its own configuration, deployment, and scaling considerations. +With *valkey-bundle*, these capabilities are available out-of-the-box, all through a unified interface. Let's explore how we would go about creating a system that could handle complex user profiles, deliver personalized recommendations, prevent ad fatigue, and maintain enterprise grade security. ### Managing Rich User Profiles with Valkey JSON -First, we needed a flexible way to store user profiles. Valkey JSON proved perfect for this with its native JSON support. Here's what our sample user profile might look like: +First, we needed a flexible way to store user profiles. +Valkey JSON proved perfect for this with its native JSON support. +Here's what our sample user profile might look like: ```json { @@ -472,7 +494,9 @@ Update user preferences by adding the automotive category. ### Smart Recommendations with Vector Search -Here's where things get interesting. We use Valkey Search to implement vector similarity matching for product recommendations. Each product and user preference is represented as a high-dimensional vector, allowing us to find similar items quickly. +Here's where things get interesting. +We use Valkey Search to implement vector similarity matching for product recommendations. +Each product and user preference is represented as a high-dimensional vector, allowing us to find similar items quickly. Create a vector similarity index. @@ -488,7 +512,8 @@ Create a vector similarity index. OK ``` -This setup allows us to find similar products while applying business rules like category filters and price ranges. The HNSW algorithm ensures we get results in milliseconds, even with millions of products. +This setup allows us to find similar products while applying business rules like category filters and price ranges. +The HNSW algorithm ensures we get results in milliseconds, even with millions of products. Here's how we can fetch similar products based on user preferences: @@ -508,7 +533,9 @@ This query combines vector similarity search with category filtering, ensuring r ### Preventing Ad Fatigue with Bloom Filters -Nobody likes seeing the same ad repeatedly. We use Valkey Bloom to efficiently track which user each ad has been shown. The beauty of Bloom filters is their space efficiency, we can track millions of impressions using minimal memory. +Nobody likes seeing the same ad repeatedly. +We use Valkey Bloom to efficiently track which user each ad has been shown. +The beauty of Bloom filters is their space efficiency, we can track millions of impressions using minimal memory. Track ad impressions by the Ad Id ```txt @@ -535,7 +562,8 @@ With a false positive rate of just 1%, we maintain accuracy while using about 93 ### Securing It All with LDAP Authentication -Our Ad Platform needs to support multiple teams with different access levels - from account managers and content creators to data analysts and administrators. Valkey LDAP allows us to leverage existing corporate directories while implementing fine-grained access control. +Our Ad Platform needs to support multiple teams with different access levels - from account managers and content creators to data analysts and administrators. +Valkey LDAP allows us to leverage existing corporate directories while implementing fine-grained access control. #### Directory Structure and Role Mapping @@ -603,9 +631,11 @@ OK ## Conclusion -*valkey-bundle* enables modern application development of latency-sensitive and high-throughput workloads by combining essential tools in a single, maintainable container. Whether you're building a startup MVP or scaling enterprise applications, *valkey-bundle* provides the foundation for efficient, reliable, and maintainable systems. +*valkey-bundle* enables modern application development of latency-sensitive and high-throughput workloads by combining essential tools in a single, maintainable container. +Whether you're building a startup MVP or scaling enterprise applications, *valkey-bundle* provides the foundation for efficient, reliable, and maintainable systems. -Ready to get started? Here's how you can begin using *valkey-bundle* today: +Ready to get started? +Here's how you can begin using *valkey-bundle* today: **Quick Start:** diff --git a/content/blog/2025-06-30-introducing-enhanced-json-capabilities-in-valkey.md b/content/blog/2025-06-30-introducing-enhanced-json-capabilities-in-valkey.md index b7a41c35..fbff0df3 100644 --- a/content/blog/2025-06-30-introducing-enhanced-json-capabilities-in-valkey.md +++ b/content/blog/2025-06-30-introducing-enhanced-json-capabilities-in-valkey.md @@ -7,17 +7,27 @@ authors= [ "roshkhatri"] blog_type = ["Announcements"] +++ -JSON is a ubiquitous format for semi-structured data, and developers often expect native support across their technology stack, including in-memory stores like Valkey. Previously, working with JSON in Valkey required serializing entire objects as strings or flattening them into Hashes, limiting nesting. These workarounds added complexity and made updates harder than they should be. +JSON is a ubiquitous format for semi-structured data, and developers often expect native support across their technology stack, including in-memory stores like Valkey. +Previously, working with JSON in Valkey required serializing entire objects as strings or flattening them into Hashes, limiting nesting. +These workarounds added complexity and made updates harder than they should be. -That changes with the general availability of native JSON support in Valkey. You can now store, query, and update JSON documents directly, without manual parsing or transformation. This brings a cleaner model to working with semi-structured data and makes your code easier to write and maintain. Valkey JSON is fully compatible with **Valkey 8.0 and above**. It is also compliant with **RFC7159** and **ECMA-404**, adhering to widely accepted JSON standards which ensures consistent handling JSON data. +That changes with the general availability of native JSON support in Valkey. +You can now store, query, and update JSON documents directly, without manual parsing or transformation. +This brings a cleaner model to working with semi-structured data and makes your code easier to write and maintain. +Valkey JSON is fully compatible with **Valkey 8.0 and above**. +It is also compliant with **RFC7159** and **ECMA-404**, adhering to widely accepted JSON standards which ensures consistent handling JSON data. In this blog, we'll guide you through setting up the Valkey JSON module and demonstrate how to use it for some common workloads. ## Core Capabilities and Performance -Valkey JSON supports six data types-**null, boolean, number, string, object, and array**—allowing developers to represent complex, nested data structures without the constraints of traditional string serialization. Unlike other composite types, JSON objects and arrays in Valkey can contain any combination of the six value types, enabling deeply nested data models to be stored natively. +Valkey JSON supports six data types-**null, boolean, number, string, object, and array**—allowing developers to represent complex, nested data structures without the constraints of traditional string serialization. +Unlike other composite types, JSON objects and arrays in Valkey can contain any combination of the six value types, enabling deeply nested data models to be stored natively. -Internally, Valkey JSON utilizes an optimized **binary tree-like format**, which enables rapid traversal and manipulation of substructures without requiring the full document to be rewritten. This structure allows operations on specific paths to be efficient. Path-based commands like `JSON.GET`, `JSON.SET`, and `JSON.DEL` allow targeted interactions with specific elements, supporting multiple paths within a single operation. Additionally, Valkey JSON integrates with Valkey’s Access Control Lists (ACLs), introducing a `@json` command category to allow granular permissions alongside existing data types. +Internally, Valkey JSON utilizes an optimized **binary tree-like format**, which enables rapid traversal and manipulation of substructures without requiring the full document to be rewritten. +This structure allows operations on specific paths to be efficient. +Path-based commands like `JSON.GET`, `JSON.SET`, and `JSON.DEL` allow targeted interactions with specific elements, supporting multiple paths within a single operation. +Additionally, Valkey JSON integrates with Valkey’s Access Control Lists (ACLs), introducing a `@json` command category to allow granular permissions alongside existing data types. ## Getting Started with Valkey JSON @@ -66,7 +76,8 @@ Let’s take a real world example where you want to store a **list of users** in 127.0.0.1:6379> JSON.SET users $ '[{"name":"Alice","email":"alice@example.com","city":"Seattle","state":"WA"},{"name":"Bob","email":"bob@example.com","city":"Bellevue","state":"WA"},{"name":"Charlie","email":"charlie@example.com","city":"Austin","state":"TX"}]' OK ``` -This command stores a JSON array of user objects at the root path `$` under the key `users`. You can visualize it like this: +This command stores a JSON array of user objects at the root path `$` under the key `users`. +You can visualize it like this: ``` [ { @@ -109,7 +120,8 @@ Now we will retrieve only the cities associated with each user: ## Advanced JSON Queries Valkey JSON supports [JSONPath](https://goessner.net/articles/JsonPath/) expressions. -JSONPath is a query language for JSON documents, similar to XPath for XML. It allows users to select and extract specific data from a JSON document using a path-like expression. +JSONPath is a query language for JSON documents, similar to XPath for XML. +It allows users to select and extract specific data from a JSON document using a path-like expression. Let us look at some filtering using JSONPath. @@ -152,21 +164,36 @@ Below we retrieve the names of users from WA and those from other states: #### Per-User Event Counters for Ad or Notification Delivery -Valkey JSON can be used for tracking per-user counters for ad impressions, push notifications, or message deliveries. An ad platform may store a JSON document per user with nested metadata for each campaign — including impression counts, last delivery timestamps, and click history. In-place updates using `JSON.NUMINCRBY` or `JSON.SET` on specific paths (e.g., `$.ad_campaigns.ad_123.count`). This reduces network I/O and latency while ensuring atomicity. Microservices can also retrieve only the required subfields using JSONPath queries, like `$.ad_campaigns.ad_123.lastSeen`, allowing for efficient real-time decisioning. +Valkey JSON can be used for tracking per-user counters for ad impressions, push notifications, or message deliveries. +An ad platform may store a JSON document per user with nested metadata for each campaign — including impression counts, last delivery timestamps, and click history. +In-place updates using `JSON.NUMINCRBY` or `JSON.SET` on specific paths (e.g., `$.ad_campaigns.ad_123.count`). +This reduces network I/O and latency while ensuring atomicity. +Microservices can also retrieve only the required subfields using JSONPath queries, like `$.ad_campaigns.ad_123.lastSeen`, allowing for efficient real-time decisioning. ### Shared Reference Metadata Store for Microservices -Across games, e-commerce platforms, or internal developer tools, multiple microservices often need fast access to consistent, structured reference data. This can include things like product attributes, game character metadata, tax codes, or ID mappings — which are naturally stored as JSON documents. Valkey JSON can be used for centralizing this reference data in-memory. We can store JSON documents using `JSON.SET`, and services can retrieve targeted subfields using path expressions like `$.items[?(@.rarity=="epic")]` or `$.idToName["1234"]`. Updates happen in bulk during patch releases or deployment cycles, but reads are constant and latency-sensitive. By keeping this metadata in Valkey, services avoid making remote API calls or parsing local files, achieving very low lookup time even under load. +Across games, e-commerce platforms, or internal developer tools, multiple microservices often need fast access to consistent, structured reference data. +This can include things like product attributes, game character metadata, tax codes, or ID mappings — which are naturally stored as JSON documents. +Valkey JSON can be used for centralizing this reference data in-memory. +We can store JSON documents using `JSON.SET`, and services can retrieve targeted subfields using path expressions like `$.items[?(@.rarity=="epic")]` or `$.idToName["1234"]`. +Updates happen in bulk during patch releases or deployment cycles, but reads are constant and latency-sensitive. +By keeping this metadata in Valkey, services avoid making remote API calls or parsing local files, achieving very low lookup time even under load. ### Identity Graph and Profile Storage at Scale -For organization operating large-scale identity platforms — such as those in fintech, healthtech, or fraud detection — managing complex user or entity profiles is a core requirement. These profiles often include deeply nested data like names, contact info, document verification, scores, and historical activity. Valkey JSON allows each profile to be stored as a single JSON document and updated atomically as new data arrives, without needing to rewrite the entire object. Queries like `$.email`, `$.history[-1]`, or `$.risk.score` can be executed efficiently. This architecture supports concurrent reads and writes per second and can scale to multi-terabyte datasets using a mix of memory and persistent storage. +For organization operating large-scale identity platforms — such as those in fintech, healthtech, or fraud detection — managing complex user or entity profiles is a core requirement. +These profiles often include deeply nested data like names, contact info, document verification, scores, and historical activity. +Valkey JSON allows each profile to be stored as a single JSON document and updated atomically as new data arrives, without needing to rewrite the entire object. +Queries like `$.email`, `$.history[-1]`, or `$.risk.score` can be executed efficiently. +This architecture supports concurrent reads and writes per second and can scale to multi-terabyte datasets using a mix of memory and persistent storage. ## Conclusion -Before Valkey JSON, developers often had to write extra serialization code, split JSON documents across keys, make additional round trips, or rely on external document stores alongside Valkey. Now, with native JSON commands, you can store, query, and update rich, nested structures directly in-memory and in real time. This removes architectural complexity, reduces latency, and extends Valkey’s high-performance design to modern, document-centric use cases. +Before Valkey JSON, developers often had to write extra serialization code, split JSON documents across keys, make additional round trips, or rely on external document stores alongside Valkey. +Now, with native JSON commands, you can store, query, and update rich, nested structures directly in-memory and in real time. +This removes architectural complexity, reduces latency, and extends Valkey’s high-performance design to modern, document-centric use cases. Explore Valkey JSON in more depth and start building with it today! diff --git a/content/blog/2025-07-10-keyspace-save-the-date.md b/content/blog/2025-07-10-keyspace-save-the-date.md index 531cc738..4ee65f11 100644 --- a/content/blog/2025-07-10-keyspace-save-the-date.md +++ b/content/blog/2025-07-10-keyspace-save-the-date.md @@ -21,6 +21,8 @@ Breakfast, lunch, happy hour, and exclusive Valkey swag is included. Keyspace is being held in conjunction with the [Linux Foundation Open Source Summit Europe](https://events.linuxfoundation.org/open-source-summit-europe/) at the [RAI Amsterdam Convention Centre](https://www.rai.nl/en). Tickets for Open Source Summit are not required to attend Keyspace. -**Want to share _your_ Valkey story?** Date extended! [Submit your talk by July ~24~ 28](https://sessionize.com/keyspace/)! +**Want to share _your_ Valkey story?** +Date extended! +[Submit your talk by July ~24~ 28](https://sessionize.com/keyspace/)! Tickets available soon. diff --git a/content/blog/2025-07-21-valkey-on-k0rdent.md b/content/blog/2025-07-21-valkey-on-k0rdent.md index 5e073e7a..fdd36f3a 100644 --- a/content/blog/2025-07-21-valkey-on-k0rdent.md +++ b/content/blog/2025-07-21-valkey-on-k0rdent.md @@ -7,9 +7,11 @@ authors= [ "s3rj1k"] blog_type = ["Community Highlight"] +++ -Managing distributed applications across multiple Kubernetes clusters can be a complex and time-consuming process. This guide demonstrates how to streamline Valkey deployment using [k0rdent's](https://k0rdent.io/) `MultiClusterService` template, providing a practical example of modern multi-cluster application delivery. +Managing distributed applications across multiple Kubernetes clusters can be a complex and time-consuming process. +This guide demonstrates how to streamline Valkey deployment using [k0rdent's](https://k0rdent.io/) `MultiClusterService` template, providing a practical example of modern multi-cluster application delivery. -In this tutorial, we'll walk through deploying Valkey across Kubernetes clusters using k0rdent's template-driven approach. By the end of this guide, you will understand how to leverage k0rdent for simplified Valkey deployment and multi-cluster application management. +In this tutorial, we'll walk through deploying Valkey across Kubernetes clusters using k0rdent's template-driven approach. +By the end of this guide, you will understand how to leverage k0rdent for simplified Valkey deployment and multi-cluster application management. ## Prerequisites @@ -33,9 +35,11 @@ k0rdent is part of the k0* family of tools: ## What is k0rdent? -k0rdent is a Kubernetes-native, distributed container management platform that simplifies and automates the deployment, scaling, and lifecycle management of Kubernetes clusters across multi-cloud and hybrid environments by using a template-driven approach. You can think of it as a super control plane for multiple child clusters that are controlled by different CAPI providers across multi-cloud environments. +k0rdent is a Kubernetes-native, distributed container management platform that simplifies and automates the deployment, scaling, and lifecycle management of Kubernetes clusters across multi-cloud and hybrid environments by using a template-driven approach. +You can think of it as a super control plane for multiple child clusters that are controlled by different CAPI providers across multi-cloud environments. -All providers (infrastructure, cluster) are packaged as Helm templates and exposed to the consumer via an entry point object called `ClusterDeployment`. The `ClusterDeployment` object is what the consumer uses to declaratively define a new child cluster, and combined with credentials-related objects, this provides the consumer with a managed Kubernetes cluster on any platform that has existing CAPI providers. +All providers (infrastructure, cluster) are packaged as Helm templates and exposed to the consumer via an entry point object called `ClusterDeployment`. +The `ClusterDeployment` object is what the consumer uses to declaratively define a new child cluster, and combined with credentials-related objects, this provides the consumer with a managed Kubernetes cluster on any platform that has existing CAPI providers. Check out this [CNCF blog post](https://www.cncf.io/blog/2025/02/24/introducing-k0rdent-design-deploy-and-manage-kubernetes-based-idps/) for additional information. @@ -43,7 +47,9 @@ Check out this [CNCF blog post](https://www.cncf.io/blog/2025/02/24/introducing- For any child cluster under k0rdent management, the consumer can control application delivery via service template objects, meaning that it is possible to install applications into the child clusters and have everything controlled from the super-control-plane (management cluster) where k0rdent itself runs. -The k0rdent project maintains a public repository called the "[Catalog](https://catalog.k0rdent.io/latest/)" where you can find pre-built application service templates. While templates can be created locally, and there is no hard requirement to use the catalog, we'll use the catalog for a more streamlined experience with Valkey delivery to child clusters. You can find the Valkey template in the catalog at [https://catalog.k0rdent.io/latest/apps/valkey](https://catalog.k0rdent.io/latest/apps/valkey). +The k0rdent project maintains a public repository called the "[Catalog](https://catalog.k0rdent.io/latest/)" where you can find pre-built application service templates. +While templates can be created locally, and there is no hard requirement to use the catalog, we'll use the catalog for a more streamlined experience with Valkey delivery to child clusters. +You can find the Valkey template in the catalog at [https://catalog.k0rdent.io/latest/apps/valkey](https://catalog.k0rdent.io/latest/apps/valkey). ## Demo Setup Overview @@ -199,7 +205,8 @@ Let's first add a label to our new child cluster in the management cluster, wher kubectl label cluster docker-hosted-cp group=demo -n kcm-system ``` -This label is needed because we will be using a `MultiClusterService` object that can reference multiple child clusters for service/application delivery. In our case, we will use our Docker-based cluster, still, we should keep in mind that we are not restricted as to which cluster we deliver new services, it can be a single child cluster or a group of them. +This label is needed because we will be using a `MultiClusterService` object that can reference multiple child clusters for service/application delivery. +In our case, we will use our Docker-based cluster, still, we should keep in mind that we are not restricted as to which cluster we deliver new services, it can be a single child cluster or a group of them. Ok, let's do this! @@ -267,6 +274,7 @@ It might look like pure magic at first, but what you saw was how k0rdent simplif Feel free to play around with the Valkey Operator by leveraging the `MultiClusterService` object together with additional Helm Chart values, and when finished, cleaning up the environment only requires deleting the Kind cluster. -Want to explore more? Head over to the [k0rdent docs](https://docs.k0rdent.io/latest/), and join our [Slack community](https://cloud-native.slack.com/archives/C08A63Q4NCD). +Want to explore more? +Head over to the [k0rdent docs](https://docs.k0rdent.io/latest/), and join our [Slack community](https://cloud-native.slack.com/archives/C08A63Q4NCD). This is all for today, thanks for spending this time with me! diff --git a/content/blog/2025-08-04-valkey-swift/index.md b/content/blog/2025-08-04-valkey-swift/index.md index 0399306d..3fbd93ea 100644 --- a/content/blog/2025-08-04-valkey-swift/index.md +++ b/content/blog/2025-08-04-valkey-swift/index.md @@ -14,15 +14,24 @@ We are excited to introduce the preview release of [valkey-swift](https://github ## The Client -Valkey-swift is a modern swift client built with Swift concurrency in mind. Using Valkey from Swift lets you take advantage of a strongly typed API, Swift's memory and data race safety guarantees, as well as maintaining a very light memory footprint. The API uses structured concurrency; a paradigm designed to bring clarity to concurrent programming by using the structure of your code to define the lifetimes of tasks and associated resources. This allows you to reason about your code locally. The client includes the following features: +Valkey-swift is a modern swift client built with Swift concurrency in mind. +Using Valkey from Swift lets you take advantage of a strongly typed API, Swift's memory and data race safety guarantees, as well as maintaining a very light memory footprint. +The API uses structured concurrency; a paradigm designed to bring clarity to concurrent programming by using the structure of your code to define the lifetimes of tasks and associated resources. +This allows you to reason about your code locally. +The client includes the following features: ### Connection Pool -The client includes a persistent connection pool. Instead of establishing a new connection for every request, it leases a connection from a pool of existing connections. This minimizes the time and resources required to get a connection to your Valkey server. +The client includes a persistent connection pool. +Instead of establishing a new connection for every request, it leases a connection from a pool of existing connections. +This minimizes the time and resources required to get a connection to your Valkey server. ### Commands -The project uses code generation to generate all of Valkey's command set. This ensures that all of Valkey's features are available, and includes the string, list, set, sorted set, stream, hash, geospatial, hyperloglog, and pub/sub commands. Using code generation has the added bonus of allowing us to easily keep up to date with the latest Valkey command changes. All the Valkey commands are available directly from `ValkeyClient`. +The project uses code generation to generate all of Valkey's command set. +This ensures that all of Valkey's features are available, and includes the string, list, set, sorted set, stream, hash, geospatial, hyperloglog, and pub/sub commands. +Using code generation has the added bonus of allowing us to easily keep up to date with the latest Valkey command changes. +All the Valkey commands are available directly from `ValkeyClient`. ```swift try await valkeyClient.set("Key1", value: "Test") @@ -42,7 +51,9 @@ When exiting the closure the connection is auto-released, avoiding the potential ### Pipelining -Valkey Pipelining is a technique for improving performance. It sends multiple commands at the same time without waiting for the response of each individual command. It avoids the round trip time between each command, and removes the relation between receiving the response from a request and sending the next request. +Valkey Pipelining is a technique for improving performance. +It sends multiple commands at the same time without waiting for the response of each individual command. +It avoids the round trip time between each command, and removes the relation between receiving the response from a request and sending the next request. ![An image that shows non-pipelined commands waiting for each response, and pipelined commands that send a burst of commands, a technique which shows the advantage of pipelining by submitting sets of commands quickly.](images/valkey-pipelining.png) @@ -60,7 +71,8 @@ let count = try lpushResult.get() // 2 let value = try rpopResult.get() // ByteBuffer containing "entry1" string ``` -The second way to take advantage of pipelining is to use [Swift Concurrency](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/concurrency/). Because the `ValkeyConnection` type is a Swift [actor](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/concurrency#Actors) it can be used across concurrent tasks without concern for data race issues. +The second way to take advantage of pipelining is to use [Swift Concurrency](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/concurrency/). +Because the `ValkeyConnection` type is a Swift [actor](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/concurrency#Actors) it can be used across concurrent tasks without concern for data race issues. Unlike the `execute(_:)` function the commands will be sent individually but the sending of a command is not dependent on a previous command returning a response. @@ -80,7 +92,13 @@ try await valkeyClient.withConnection { connection in ### Pub/Sub -Valkey can be used as a message broker using its publish/subscribe messaging model. A subscription is a stream of messages from a channel. The easiest way to model this is with a Swift `AsyncSequence`. The valkey-swift subscription API provides a simple way to manage subscriptions with a single function call that automatically subscribes and unsubscribes from channels as needed. You provide it with a closure, it calls `SUBSCRIBE` on the channels you specified, and provides an `AsyncSequence` of messages from those channels. When you exit the closure, the connection sends the relevant `UNSUBSCRIBE` commands. This avoids the common user error of forgetting to unsubscribe from a channel once it is no longer needed. +Valkey can be used as a message broker using its publish/subscribe messaging model. +A subscription is a stream of messages from a channel. +The easiest way to model this is with a Swift `AsyncSequence`. +The valkey-swift subscription API provides a simple way to manage subscriptions with a single function call that automatically subscribes and unsubscribes from channels as needed. +You provide it with a closure, it calls `SUBSCRIBE` on the channels you specified, and provides an `AsyncSequence` of messages from those channels. +When you exit the closure, the connection sends the relevant `UNSUBSCRIBE` commands. +This avoids the common user error of forgetting to unsubscribe from a channel once it is no longer needed. ```swift try await valkeyClient.withConnection { connection in @@ -94,16 +112,21 @@ try await valkeyClient.withConnection { connection in ### Valkey Cluster -Valkey scales horizontally with a deployment called Valkey Cluster. Data is sharded across multiple Valkey servers based on the hash of the key being accessed. It also provides a level of availability, using replicas. You can continue operations even when a node fails or is unable to communicate. +Valkey scales horizontally with a deployment called Valkey Cluster. +Data is sharded across multiple Valkey servers based on the hash of the key being accessed. +It also provides a level of availability, using replicas. +You can continue operations even when a node fails or is unable to communicate. -Swift-valkey includes a cluster client `ValkeyClusterClient`. This includes support for: +Swift-valkey includes a cluster client `ValkeyClusterClient`. +This includes support for: 1. Election based cluster topology discovery and maintenance. 2. Command routing to the appropriate node based on key hashslots. 3. Handling of MOVED errors for proper cluster resharding. 4. Connection pooling and failover. 5. Circuit breaking during cluster disruptions. -The following example shows how to create a cluster client that uses `ValkeyStaticNodeDiscovery` to find the first node in the cluster. From there the client discovers the remains of the cluster topology. +The following example shows how to create a cluster client that uses `ValkeyStaticNodeDiscovery` to find the first node in the cluster. +From there the client discovers the remains of the cluster topology. ```swift let clusterClient = ValkeyClusterClient( clientConfiguration: clientConfiguration, @@ -114,7 +137,8 @@ let clusterClient = ValkeyClusterClient( ) ``` -All the standard Valkey commands are available to the cluster client. The only requirement is that if a command references two of more keys, they all come from the same shard in the cluster. +All the standard Valkey commands are available to the cluster client. +The only requirement is that if a command references two of more keys, they all come from the same shard in the cluster. ```swift try await clusterClient.xread( @@ -185,7 +209,10 @@ func testValkey(_ valkeyClient: ValkeyClient, logger: Logger) async throws { } ``` -The code above creates a client. The client needs a background process to manage its connection pool so it sets up a `TaskGroup` which runs the connection pool background process concurrently with the `testValkey` function. The code in the `testValkey` function sets the value of key "foo" to "bar" and then gets the value of key "foo". If it returns a value it is printed to the log. +The code above creates a client. +The client needs a background process to manage its connection pool so it sets up a `TaskGroup` which runs the connection pool background process concurrently with the `testValkey` function. +The code in the `testValkey` function sets the value of key "foo" to "bar" and then gets the value of key "foo". +If it returns a value it is printed to the log. To run your code use on the command line: ``` diff --git a/content/blog/2025-09-11-valkey-investment-in-open-source.md b/content/blog/2025-09-11-valkey-investment-in-open-source.md index ed1b76bc..694476d1 100644 --- a/content/blog/2025-09-11-valkey-investment-in-open-source.md +++ b/content/blog/2025-09-11-valkey-investment-in-open-source.md @@ -11,61 +11,82 @@ featured = true featured_image = "/assets/media/featured/random-04.webp" +++ -Valkey was founded just over a year ago to keep high-performance key/value storage in the open source community: free from vendor lock-in and restrictive licenses. Backed by contributors like AWS, Google Cloud, Ericsson, Oracle, Alibaba, Huawei, Tencent, Percona, Aiven, Heroku, Verizon, Chainguard, and Canonical, the project shows how “free” in open source depends on investment: time, talent, and ongoing financial support. +Valkey was founded just over a year ago to keep high-performance key/value storage in the open source community: free from vendor lock-in and restrictive licenses. +Backed by contributors like AWS, Google Cloud, Ericsson, Oracle, Alibaba, Huawei, Tencent, Percona, Aiven, Heroku, Verizon, Chainguard, and Canonical, the project shows how “free” in open source depends on investment: time, talent, and ongoing financial support. ### Built by Builders, Backed by the Linux Foundation -Valkey was created on March 28, 2024 and has solidified itself as the open-source high-performance key/value datastore that supports a variety of workloads such as caching, message queues, and can act as a primary database. Valkey is backed by the Linux Foundation, a neutral organization founded in 2000 that supports developers and technologists to scale and manage open source projects. Valkey operates under an open governance model focused on growing community contributions and adoption. +Valkey was created on March 28, 2024 and has solidified itself as the open-source high-performance key/value datastore that supports a variety of workloads such as caching, message queues, and can act as a primary database. +Valkey is backed by the Linux Foundation, a neutral organization founded in 2000 that supports developers and technologists to scale and manage open source projects. +Valkey operates under an open governance model focused on growing community contributions and adoption. ### One Year In: Growth and Momentum -In just a year’s time the project has celebrated two major releases, an increase in corporate participants from 22 to 47, is defining, innovating, and executing on its roadmap, and is growing in its adoption. Users and the community have embraced the project and they are firm in their commitment to continue to improve Valkey for the benefit of all end users. +In just a year’s time the project has celebrated two major releases, an increase in corporate participants from 22 to 47, is defining, innovating, and executing on its roadmap, and is growing in its adoption. +Users and the community have embraced the project and they are firm in their commitment to continue to improve Valkey for the benefit of all end users. ## New Valkey Features & Use Cases ### Solving Practical Problems with JSON and Bloom Filters -Two new data types, JSON and Bloom filters, expand what developers can do with Valkey, especially in distributed systems where speed and structure are equally important. These additions reduce complexity in application logic and improve how data is handled at the edge. “Adding JSON and Bloom filters to Valkey is about giving developers practical tools to solve real-world problems in distributed systems,” says Madelyn Olson, Valkey co-maintainer. +Two new data types, JSON and Bloom filters, expand what developers can do with Valkey, especially in distributed systems where speed and structure are equally important. +These additions reduce complexity in application logic and improve how data is handled at the edge. +“Adding JSON and Bloom filters to Valkey is about giving developers practical tools to solve real-world problems in distributed systems,” says Madelyn Olson, Valkey co-maintainer. -JSON support allows developers to work with rich, structured data natively, instead of relying on custom serialization or extra middleware. “JSON lets you work with rich, structured data directly in Valkey, which simplifies development and reduces glue code,” Olson explains. +JSON support allows developers to work with rich, structured data natively, instead of relying on custom serialization or extra middleware. +“JSON lets you work with rich, structured data directly in Valkey, which simplifies development and reduces glue code,” Olson explains. -[Valkey Bloom filters](https://valkey.io/topics/bloomfilters/), on the other hand, offer a compact way to perform fast checks. “Bloom filters are ideal when you need to make fast, memory-efficient existence checks, whether you're trying to catch fraud or avoid unnecessary backend calls in a high-traffic service,” adds Olson. +[Valkey Bloom filters](https://valkey.io/topics/bloomfilters/), on the other hand, offer a compact way to perform fast checks. +“Bloom filters are ideal when you need to make fast, memory-efficient existence checks, whether you're trying to catch fraud or avoid unnecessary backend calls in a high-traffic service,” adds Olson. As Olson put it, the goal is simple: “I’m really excited to see what problems our users will be able to solve with these new data types.” ### Valkey Search: Speed and Scale for AI Workloads -Google contributed a new module, [Valkey Search](https://github.com/valkey-io/valkey-search), which brings vector similarity search to Valkey. It’s fast, delivering single-digit millisecond latency and built to handle billions of vectors while maintaining over 99% recall. +Google contributed a new module, [Valkey Search](https://github.com/valkey-io/valkey-search), which brings vector similarity search to Valkey. +It’s fast, delivering single-digit millisecond latency and built to handle billions of vectors while maintaining over 99% recall. -Developers can run both approximate nearest neighbor (ANN) searches (via HNSW) and exact k-nearest neighbor (KNN) searches. It supports indexing with either Hash or [Valkey-JSON](https://github.com/valkey-io/valkey-json) data types. While Valkey Search currently focuses on vector search, future goals would extend Valkey into a broader search engine with full-text support and more indexing options. +Developers can run both approximate nearest neighbor (ANN) searches (via HNSW) and exact k-nearest neighbor (KNN) searches. +It supports indexing with either Hash or [Valkey-JSON](https://github.com/valkey-io/valkey-json) data types. +While Valkey Search currently focuses on vector search, future goals would extend Valkey into a broader search engine with full-text support and more indexing options. ### Performance, Reliability, and Security -Over the past year, contributors from companies like Ericsson, Oracle, and Percona have focused on making Valkey faster, safer, and more enterprise-ready. The following improvements showcase how Valkey is evolving to meet scaled production needs without compromising for any of its users. +Over the past year, contributors from companies like Ericsson, Oracle, and Percona have focused on making Valkey faster, safer, and more enterprise-ready. +The following improvements showcase how Valkey is evolving to meet scaled production needs without compromising for any of its users. #### Multithreading Improvements -Recent updates to Valkey’s internals improve how the system handles work across multiple threads, cutting down on lock contention and better using multi-core processors. This update significantly improves throughput under high concurrency, making the project more attractive for large-scale production use. Ericsson, one of Valkey’s core contributors, is already seeing real value in the project’s performance work. +Recent updates to Valkey’s internals improve how the system handles work across multiple threads, cutting down on lock contention and better using multi-core processors. +This update significantly improves throughput under high concurrency, making the project more attractive for large-scale production use. +Ericsson, one of Valkey’s core contributors, is already seeing real value in the project’s performance work. -Viktor Söderqvist, Ericsson Software Technology Engineer & Valkey co-maintainer, points out the core efficiency as a key reason Valkey is becoming more production-ready. “To get the most out of the CPUs and memory in terms of storage efficiency and speed, the recent hashtable redesign lately improved with SIMD techniques as well as the recent and ongoing improvements in multithreading and memory batch-prefetching techniques are exciting areas of improvement.” +Viktor Söderqvist, Ericsson Software Technology Engineer & Valkey co-maintainer, points out the core efficiency as a key reason Valkey is becoming more production-ready. +“To get the most out of the CPUs and memory in terms of storage efficiency and speed, the recent hashtable redesign lately improved with SIMD techniques as well as the recent and ongoing improvements in multithreading and memory batch-prefetching techniques are exciting areas of improvement.” #### SIMD-Accelerated Hashtable Redesign -The project’s core hashtable was reengineered to leverage SIMD instructions, allowing Valkey to process key lookups more efficiently by handling multiple operations in parallel. These low-level optimizations translate to faster response times in latency-sensitive environments. +The project’s core hashtable was reengineered to leverage SIMD instructions, allowing Valkey to process key lookups more efficiently by handling multiple operations in parallel. +These low-level optimizations translate to faster response times in latency-sensitive environments. #### Batch Memory Prefetching -New support for batch memory prefetching helps reduce cache misses by anticipating access patterns and loading data proactively. The result is smoother performance and more consistent behavior under heavy or sequential access workloads. +New support for batch memory prefetching helps reduce cache misses by anticipating access patterns and loading data proactively. +The result is smoother performance and more consistent behavior under heavy or sequential access workloads. #### LDAP Integration -LDAP integration brings centralized authentication and access control to Valkey, making it easier to deploy in enterprise environments with existing identity infrastructure. This feature addresses a common adoption barrier in security-conscious and compliance-driven organizations. +LDAP integration brings centralized authentication and access control to Valkey, making it easier to deploy in enterprise environments with existing identity infrastructure. +This feature addresses a common adoption barrier in security-conscious and compliance-driven organizations. -“A lot of our customers already rely on LDAP to manage access across their infrastructure, so bringing that to Valkey just made sense,” says Vadim Tkachenko, Co-Founder of Percona. “It’s one of those features that removes friction. You get auditability, group-based permissions, and it works with what teams already have in place.” +“A lot of our customers already rely on LDAP to manage access across their infrastructure, so bringing that to Valkey just made sense,” says Vadim Tkachenko, Co-Founder of Percona. +“It’s one of those features that removes friction. +You get auditability, group-based permissions, and it works with what teams already have in place.” #### Rust Module -Oracle is contributing a Rust-based module SDK to Valkey, aimed at improving safety and performance for low-level extensions. By adopting Rust’s strong guarantees around memory and concurrency, the project opens the door to safer, more maintainable systems integration, especially for production environments under load. +Oracle is contributing a Rust-based module SDK to Valkey, aimed at improving safety and performance for low-level extensions. +By adopting Rust’s strong guarantees around memory and concurrency, the project opens the door to safer, more maintainable systems integration, especially for production environments under load. ### The Real Investment Behind Open Source Success @@ -73,7 +94,9 @@ The investment in open source and choosing to employ contributors to the project ### What’s Happening With Valkey -On August 15, Valkey dropped the [first release candidate for 9.0](https://github.com/valkey-io/valkey/releases/tag/9.0.0-rc1). This testing release previews the new capabilities around atomic slot migrations, hash field expirations, and numbered databases in cluster mode alongside scads of performance enhancements and bug fixes. Additional release candidates are to follow with general availability of 9.0 in early autumn 2025\. +On August 15, Valkey dropped the [first release candidate for 9.0](https://github.com/valkey-io/valkey/releases/tag/9.0.0-rc1). +This testing release previews the new capabilities around atomic slot migrations, hash field expirations, and numbered databases in cluster mode alongside scads of performance enhancements and bug fixes. +Additional release candidates are to follow with general availability of 9.0 in early autumn 2025\. Parallel to the testing phase for 9.0, two events happened last month in Amsterdam: diff --git a/content/blog/2025-09-25-numbered-databases/index.md b/content/blog/2025-09-25-numbered-databases/index.md index b8014af7..8a5ed2aa 100644 --- a/content/blog/2025-09-25-numbered-databases/index.md +++ b/content/blog/2025-09-25-numbered-databases/index.md @@ -12,21 +12,37 @@ featured_image = "/blog/numbered-databases/images/move-db.drawio.png" +++ -If you explore Valkey’s documentation you might run across a feature called ‘numbered databases’ which allows you to separate the keyspace into (by default) 16 different databases. Digging into this feature reveals tantalizing ways to avoid key prefixing, house different workloads together on Valkey, and even perform patterns that are otherwise clunky. However, if you’ve done more research outside of the documentation on numbered databases you find advice like “don’t use them,” “they don’t scale,” and “they’re a bad idea.” Well, the forthcoming Valkey 9.0 changes many things with numbered databases and you’ll see in this post that advice definitely needs some updating. +If you explore Valkey’s documentation you might run across a feature called ‘numbered databases’ which allows you to separate the keyspace into (by default) 16 different databases. +Digging into this feature reveals tantalizing ways to avoid key prefixing, house different workloads together on Valkey, and even perform patterns that are otherwise clunky. +However, if you’ve done more research outside of the documentation on numbered databases you find advice like “don’t use them,” “they don’t scale,” and “they’re a bad idea.” +Well, the forthcoming Valkey 9.0 changes many things with numbered databases and you’ll see in this post that advice definitely needs some updating. -Today, a common way to conceptualize Valkey is that your keys represent a unique name for pointers to data in memory across a cluster of nodes. So, key `foo` is unique and deterministically linked to a specific node and on that node there is a memory address where the value resides. However, this misses one important detail: the database number. The reality is that key names belong to a specific numbered database and *aren’t unique* on a given instance of Valkey. To put this another way, Valkey can have the key `foo` as many times as there are numbered databases with each one pointing to different data. +Today, a common way to conceptualize Valkey is that your keys represent a unique name for pointers to data in memory across a cluster of nodes. +So, key `foo` is unique and deterministically linked to a specific node and on that node there is a memory address where the value resides. +However, this misses one important detail: the database number. +The reality is that key names belong to a specific numbered database and *aren’t unique* on a given instance of Valkey. +To put this another way, Valkey can have the key `foo` as many times as there are numbered databases with each one pointing to different data. ![one key, many databases](./images/numbered-db.drawio.png) -Historically, before Valkey’s preceding project had the ability to cluster (before version 3.0.0), using multiple numbered databases was fully supported. However, when clustering was implemented numbered databases weren’t included: a cluster had one database (DB 0) that spanned across the entire cluster. In a world where using numbered databases in your application locked you into never going to a cluster, the early advice made sense, however Valkey 9.0 adds the ability to have numbered databases on a cluster, changing everything about that advice. +Historically, before Valkey’s preceding project had the ability to cluster (before version 3.0.0), using multiple numbered databases was fully supported. +However, when clustering was implemented numbered databases weren’t included: a cluster had one database (DB 0) that spanned across the entire cluster. +In a world where using numbered databases in your application locked you into never going to a cluster, the early advice made sense, however Valkey 9.0 adds the ability to have numbered databases on a cluster, changing everything about that advice. -Why bring this feature to cluster mode in Valkey 9.0? In the intervening years since numbered databases were left out of the cluster spec, users have found a number of very handy patterns that were unfortunately limited without numbered databases. However, numbered databases aren't a panacea: read on to find out when you should stick to DB 0 and when to go for a numbered database. +Why bring this feature to cluster mode in Valkey 9.0? +In the intervening years since numbered databases were left out of the cluster spec, users have found a number of very handy patterns that were unfortunately limited without numbered databases. +However, numbered databases aren't a panacea: read on to find out when you should stick to DB 0 and when to go for a numbered database. ## Clustering and numbered databases -As mentioned earlier, the key name dictates where the key lives in the cluster and this doesn’t change for numbered databases. As a refresher, [Valkey clustering](https://valkey.io/topics/cluster-tutorial/) takes the key name as a string, runs that through a CRC-16 function, then does a modulo of 16,384 which determines the ‘slot’. Each of these slots belong to a node in the cluster. For a numbered database, each slot contains all the numbered databases, so, carrying forward the idea that you can have the same key name in each database on a single instance, in Valkey 9.0 you can have the same key multiple times in a given slot, each in their own database. In other words, numbered databases do not affect clustering: the key is still the determinate factor in calculating slots. +As mentioned earlier, the key name dictates where the key lives in the cluster and this doesn’t change for numbered databases. +As a refresher, [Valkey clustering](https://valkey.io/topics/cluster-tutorial/) takes the key name as a string, runs that through a CRC-16 function, then does a modulo of 16,384 which determines the ‘slot’. +Each of these slots belong to a node in the cluster. +For a numbered database, each slot contains all the numbered databases, so, carrying forward the idea that you can have the same key name in each database on a single instance, in Valkey 9.0 you can have the same key multiple times in a given slot, each in their own database. +In other words, numbered databases do not affect clustering: the key is still the determinate factor in calculating slots. -You can see this directly with [`CLUSTER KEYSLOT`](https://valkey.io/commands/cluster-keyslot/) and [`SELECT`](https://valkey.io/commands/select/). Take the following example: +You can see this directly with [`CLUSTER KEYSLOT`](https://valkey.io/commands/cluster-keyslot/) and [`SELECT`](https://valkey.io/commands/select/). +Take the following example: ``` > SELECT 0 @@ -43,52 +59,93 @@ OK (integer) 11058 ``` -Here the key `somekey` was set to two different values: ‘hi’ on database 0, and ‘hello’ on database 5, with `SELECT` altering the selected database. `CLUSTER KEYSLOT` was called twice: each one yielding the same slot number meaning this key will be assigned to the same node in the cluster, no matter which database is selected. +Here the key `somekey` was set to two different values: ‘hi’ on database 0, and ‘hello’ on database 5, with `SELECT` altering the selected database. +`CLUSTER KEYSLOT` was called twice: each one yielding the same slot number meaning this key will be assigned to the same node in the cluster, no matter which database is selected. ## Limitations -Numbered databases do not change the properties of how a Valkey cluster works. The keyspace of each database is still split amongst all the nodes. As a consequence, operations that need to span the entire keyspace will to be run on each node: +Numbered databases do not change the properties of how a Valkey cluster works. +The keyspace of each database is still split amongst all the nodes. +As a consequence, operations that need to span the entire keyspace will to be run on each node: * [`FLUSHDB`](https://valkey.io/commands/flushdb/) will flush the keys in the current database *on the connected node* * [`SCAN`](https://valkey.io/commands/scan/) will iteratively return keys in the current database *on the connected node.* * [`DBSIZE`](https://valkey.io/commands/dbsize/) will return the number of keys in the current database *on the connected node.* -You get the picture: if a command previously said it did something for the entire database, in cluster mode it really means for the connected node’s portion of the database. These are especially important to understand if you're planning to move an application built for non-clustered, numbered databases to a cluster. +You get the picture: if a command previously said it did something for the entire database, in cluster mode it really means for the connected node’s portion of the database. +These are especially important to understand if you're planning to move an application built for non-clustered, numbered databases to a cluster. -Additionally, numbered databases do not provide any form of resource isolation. It's tempting to point a bunch of applications to a single Valkey cluster with each application taking its own database. While this certainly *can* work, it works without resource isolation and this setup can suffer from classic noisy neighbour problems: busy applications will affect the others using the same cluster. If you're worried about resource sharing, most of the time you'll be better off just having distinct clusters for each application instead of numbered databases. +Additionally, numbered databases do not provide any form of resource isolation. +It's tempting to point a bunch of applications to a single Valkey cluster with each application taking its own database. +While this certainly *can* work, it works without resource isolation and this setup can suffer from classic noisy neighbour problems: busy applications will affect the others using the same cluster. +If you're worried about resource sharing, most of the time you'll be better off just having distinct clusters for each application instead of numbered databases. ## Where to use numbered databases If you take away one thing from this blog it should be this: **numbered databases are a form of namespacing**. -The most straight forward use case of numbered databases is when you need to separate your data logically and you can tolerate the effects of resource sharing (see above). This might be something like keeping customer data separated from one another or combining applications on to a single cluster when resources are unlikely to be an issue. In a similar manner, multiple databases are a useful debugging tool. When you’re building an application it can be difficult to see what happens inside Valkey when you make a change. If you have multiple databases you can run your original code on one database and the changed version on a different database then you can more easily see changes in how data looks in Valkey by just the connection swapping between databases. This is also a useful pattern during a migration when you want your old data to stick around while your new data is populated. - -An entirely different use of numbered databases is related to the [`MOVE`](https://valkey.io/commands/move/) command. `MOVE` allows you to change a key from one database to another *without copying the data,* meaning it uses very little resources and it’s an `O(1)` operation. This allows a couple of things: 1) you can effectively make data inaccessible from a database whilst keeping it on the same cluster node, and 2) you can replace a complex key atomically. - -Looking at the first use of `MOVE`: imagine you have some content, maybe a user submitted post, that is stored at the key “mycontent.” At some point this content gets flagged as needing to be reviewed. You might not want to *delete* this content but you also don’t want it accessible. In this case you take the content and `MOVE` it to a different database. Once it’s reviewed (or edited!) you can `MOVE` it back. Never does the data actually leave the node nor get copied. Whilst your use-case might not be the same as this, the pattern illustrates an operation useful in a variety of contexts. +The most straight forward use case of numbered databases is when you need to separate your data logically and you can tolerate the effects of resource sharing (see above). +This might be something like keeping customer data separated from one another or combining applications on to a single cluster when resources are unlikely to be an issue. +In a similar manner, multiple databases are a useful debugging tool. +When you’re building an application it can be difficult to see what happens inside Valkey when you make a change. +If you have multiple databases you can run your original code on one database and the changed version on a different database then you can more easily see changes in how data looks in Valkey by just the connection swapping between databases. +This is also a useful pattern during a migration when you want your old data to stick around while your new data is populated. + +An entirely different use of numbered databases is related to the [`MOVE`](https://valkey.io/commands/move/) command. +`MOVE` allows you to change a key from one database to another *without copying the data,* meaning it uses very little resources and it’s an `O(1)` operation. +This allows a couple of things: 1) you can effectively make data inaccessible from a database whilst keeping it on the same cluster node, and 2) you can replace a complex key atomically. + +Looking at the first use of `MOVE`: imagine you have some content, maybe a user submitted post, that is stored at the key “mycontent.” +At some point this content gets flagged as needing to be reviewed. +You might not want to *delete* this content but you also don’t want it accessible. +In this case you take the content and `MOVE` it to a different database. +Once it’s reviewed (or edited!) you can `MOVE` it back. +Never does the data actually leave the node nor get copied. +Whilst your use-case might not be the same as this, the pattern illustrates an operation useful in a variety of contexts. ![now you see me, now you don't](./images/move-db.drawio.png) -The second use of `MOVE` is similar to the first except it revolves around complex keys that contain many elements. Take, for example, a large sorted set. It’s not unusual for these keys to be quite large because the key contains thousands or millions of smaller elements. If you need to replace this key with one that contains different elements then you’d have to first `DEL` the original key, then `ZADD` thousands of elements. Doing this in a transaction would be expensive and monopolize the node, and without a transaction, it would reveal a (potentially undesirable) partial state. Instead, with multiple databases, you build up new a complex key on a different database (under no urgency) and do a much simpler `MULTI` / `EXEC` transaction of of `DEL` followed by `MOVE` to atomically make the new complex key available to the database being used to serve commands without the chance of a partial state. +The second use of `MOVE` is similar to the first except it revolves around complex keys that contain many elements. +Take, for example, a large sorted set. +It’s not unusual for these keys to be quite large because the key contains thousands or millions of smaller elements. +If you need to replace this key with one that contains different elements then you’d have to first `DEL` the original key, then `ZADD` thousands of elements. +Doing this in a transaction would be expensive and monopolize the node, and without a transaction, it would reveal a (potentially undesirable) partial state. +Instead, with multiple databases, you build up new a complex key on a different database (under no urgency) and do a much simpler `MULTI` / `EXEC` transaction of of `DEL` followed by `MOVE` to atomically make the new complex key available to the database being used to serve commands without the chance of a partial state. ![show me it when its done](./images/zadd-move.drawio.png) -This is really a form of temporal namespacing: you're taking advantage of the namespace to have two active keys under the same name both of which can be read and manipulated. You can apply this pattern to other cases: anyplace you want to make a key inaccessible for a period of time. - -> **How is key prefixing different than numbered databases?** Some of the patterns in this blog can be achieved without numbered databases and instead with key prefixing (e.g. `app0:...`, `app1:...`). Key prefixing has a few downsides when compared to numbered databases: -> * Prefixes add up at scale. Millions of keys each with repeated prefixes over the span of the whole cluster means less RAM for data. While each database does have a memory overhead it is linear relative to the number of databases used, not keys. For a deeper look at how numbered database memory overhead works, including using 10 million databases, read the comments on [valkey-io/valkey#1609](https://github.com/valkey-io/valkey/pull/1609#issuecomment-2616366819). -> * Databases are transparent to your application. To support prefixing, either your application or your client library has to be able to interpolate the prefix into each key. With numbered databases, the changes can be as simple as a number in the connection URI, not to each key name. -> * Databases avoid pattern-based iterations. Having all your keys in DB 0 then needing to iterate over the entire keyspace to affect a specific pattern is expensive and complicated. If your keys are separated into databases, this both subsets that iteration and enables some database wide commands (i.e. `FLUSHDB` instead of trying to delete keys by a pattern). +This is really a form of temporal namespacing: you're taking advantage of the namespace to have two active keys under the same name both of which can be read and manipulated. +You can apply this pattern to other cases: anyplace you want to make a key inaccessible for a period of time. + +> **How is key prefixing different than numbered databases?** +> Some of the patterns in this blog can be achieved without numbered databases and instead with key prefixing (e.g. `app0:...`, `app1:...`). +> Key prefixing has a few downsides when compared to numbered databases: +> * Prefixes add up at scale. +> Millions of keys each with repeated prefixes over the span of the whole cluster means less RAM for data. +> While each database does have a memory overhead it is linear relative to the number of databases used, not keys. +> For a deeper look at how numbered database memory overhead works, including using 10 million databases, read the comments on [valkey-io/valkey#1609](https://github.com/valkey-io/valkey/pull/1609#issuecomment-2616366819). +> * Databases are transparent to your application. +> To support prefixing, either your application or your client library has to be able to interpolate the prefix into each key. +> With numbered databases, the changes can be as simple as a number in the connection URI, not to each key name. +> * Databases avoid pattern-based iterations. +> Having all your keys in DB 0 then needing to iterate over the entire keyspace to affect a specific pattern is expensive and complicated. +> If your keys are separated into databases, this both subsets that iteration and enables some database wide commands (i.e. `FLUSHDB` instead of trying to delete keys by a pattern). ## Gotchas and future work -Aside from the aforementioned lack of resource isolation, numbered databases in clustered Valkey have a few places that you need to look out for today. First, right now numbered databases don’t have a lot of dedicated metrics, so it can be hard to gain insights into per-database resource usage. Second, the ACL system doesn’t currently address numbered databases, so you can’t meaningfully restrict access to databases (at time of writing, there is an [open pull request that addresses this](https://github.com/valkey-io/valkey/pull/2309)). Unlike in the previous project, databases are an active area of work for the Valkey project and the database abstraction holds potential as a way to implement new features. +Aside from the aforementioned lack of resource isolation, numbered databases in clustered Valkey have a few places that you need to look out for today. +First, right now numbered databases don’t have a lot of dedicated metrics, so it can be hard to gain insights into per-database resource usage. +Second, the ACL system doesn’t currently address numbered databases, so you can’t meaningfully restrict access to databases (at time of writing, there is an [open pull request that addresses this](https://github.com/valkey-io/valkey/pull/2309)). +Unlike in the previous project, databases are an active area of work for the Valkey project and the database abstraction holds potential as a way to implement new features. Finally, while numbered databases are well supported in client libraries there are rough edges: * Some client libraries artificially restrict usage to a single database in cluster mode, -* Pooled clients may naïvely manage the selected database, so a client returned to the pool after running `SELECT` might retain the database number in subsequent usage. A similar situation is possible for multiplexed clients. +* Pooled clients may naïvely manage the selected database, so a client returned to the pool after running `SELECT` might retain the database number in subsequent usage. + A similar situation is possible for multiplexed clients. -In general, watch out for three assumptions: 1) the selected database is always 0, 2) there is only one database in cluster mode, and 3) if there are multiple databases in use it isn’t in cluster mode. None of these are true in Valkey 9.0. +In general, watch out for three assumptions: 1) the selected database is always 0, 2) there is only one database in cluster mode, and 3) if there are multiple databases in use it isn’t in cluster mode. +None of these are true in Valkey 9.0. -With this in mind, Valkey 9.0 gives you the ability to divvy up that keyspace into nice neat numbered databases and spread them out over a whatever cluster you have. So, get rid of that old, outdated advice and start using them, seeing how they scale, and what a good idea number databases actually are for Valkey 9.0. +With this in mind, Valkey 9.0 gives you the ability to divvy up that keyspace into nice neat numbered databases and spread them out over a whatever cluster you have. +So, get rid of that old, outdated advice and start using them, seeing how they scale, and what a good idea number databases actually are for Valkey 9.0. diff --git a/content/blog/2025-09-30-hash-fields-expiration/index.md b/content/blog/2025-09-30-hash-fields-expiration/index.md index 04c24aef..a1860a80 100644 --- a/content/blog/2025-09-30-hash-fields-expiration/index.md +++ b/content/blog/2025-09-30-hash-fields-expiration/index.md @@ -24,7 +24,8 @@ If you stored multiple fields in a hash, you could set a TTL for the hash itself That limitation forced developers into awkward choices. -Imagine you’re running a feature flag system. You want to store all of a customer’s feature toggles inside one hash: +Imagine you’re running a feature flag system. +You want to store all of a customer’s feature toggles inside one hash: * Some flags are short-lived experiments, meant to turn off automatically after a few seconds or minutes. @@ -44,9 +45,12 @@ In order to understand the problem, it’s important to understand how expiratio Valkey uses two complementary mechanisms to reclaim expired keys: -* **Lazy expiration:** A key is deleted only when accessed. If you try to read or write an expired key, Valkey notices it has passed its TTL and deletes it immediately. This is cheap, but untouched keys would linger indefinitely and waste memory. +* **Lazy expiration:** A key is deleted only when accessed. + If you try to read or write an expired key, Valkey notices it has passed its TTL and deletes it immediately. + This is cheap, but untouched keys would linger indefinitely and waste memory. -* **Active expiration:** A background cron job runs 10 times per second, sampling a small set of keys with expiration. Expired keys are deleted until a time budget is reached, ensuring memory is reclaimed proactively without introducing latency spikes. +* **Active expiration:** A background cron job runs 10 times per second, sampling a small set of keys with expiration. + Expired keys are deleted until a time budget is reached, ensuring memory is reclaimed proactively without introducing latency spikes. For hash fields, we made a key design choice: we did not implement lazy expiration. Adding expiration checks to every [`HGET`](/commands/hget), [`HSET`](/commands/hset), or [`HDEL`](/commands/hdel) would have complicated the hot path of hash commands and risked performance regressions. @@ -58,11 +62,14 @@ how do we efficiently track and clean up expired fields inside hashes that may c when only a small subset are volatile — and an even smaller fraction are expired at any given time? The challenge is balancing three conflicting goals: -* **Keep memory usage small.** Hashes can grow to millions of fields, so metadata overhead must be minimal. +* **Keep memory usage small.** + Hashes can grow to millions of fields, so metadata overhead must be minimal. -* **Maintain fast lookups and updates.** Most hash commands run in `O(1)` time, and expiration tracking can’t change that. +* **Maintain fast lookups and updates.** + Most hash commands run in `O(1)` time, and expiration tracking can’t change that. -* **Reclaim memory efficiently.** The active expiration job is time-bounded, so we need to minimize wasted CPU cycles spent scanning unexpired fields. +* **Reclaim memory efficiently.** + The active expiration job is time-bounded, so we need to minimize wasted CPU cycles spent scanning unexpired fields. ### Approaches Considered @@ -74,7 +81,8 @@ This seemed simple: build a secondary hashtable in each Hash object which maps o ![Diagram illustrating optional solution using a secondary hashtable index](hfe-alternative-hashtable.png) -This is actually the way volatile generic keys are being tracked. Per each database, Valkey manage a secondary map mapping volatile keys. +This is actually the way volatile generic keys are being tracked. +Per each database, Valkey manage a secondary map mapping volatile keys. During active expiration process the existing job scan the secondary map and each key found to pass it's assigned TTL is expired and it's memory is reclaimed. The problem with this design option is the potential inefficiency introduced while scanning many items which should not expire. @@ -84,15 +92,19 @@ Using a radix tree to hold field names plus expirations provides sorted access f ![Diagram illustrating optional solution using a secondary radix-tree index](hfe-alternative-radixtree.png) -This is also not a new concept in Valkey. In fact this exact structure is being used to manage client connections blocked on key operations +This is also not a new concept in Valkey. +In fact this exact structure is being used to manage client connections blocked on key operations like [`BLPOP`](/commands/blpop/) and [`XREAD`](/commands/xread/). -But the memory overhead per node was high. During experiments we measured more than 54 bytes overhead per each hash field when using this type of index. +But the memory overhead per node was high. +During experiments we measured more than 54 bytes overhead per each hash field when using this type of index. #### 3. Global sorted structure -We wanted to have the ability to efficiently scan over fields which are already expired. A good way to achieve this is by using a sorted index. -Using a radix tree was possible, but the memory overhead was high. Instead we could use a more lightweight data structure like a skip list, which memory consumption is more bounded +We wanted to have the ability to efficiently scan over fields which are already expired. +A good way to achieve this is by using a sorted index. +Using a radix tree was possible, but the memory overhead was high. +Instead we could use a more lightweight data structure like a skip list, which memory consumption is more bounded and is not governed by the data atrophy. ![Diagram illustrating optional solution using a secondary skiplist index](hfe-alternative-skiplist.png) @@ -114,7 +126,8 @@ This adaptability keeps the number of buckets small while ensuring they’re fin When a new field with TTL is added, the volatile set either places it into an existing bucket or creates a new one. If a bucket grows too large, it is narrowed into smaller time windows to keep expiration scans efficient. For example: scanning 1,000 items in a single 10-second bucket may result in mostly misses, while spreading them across 10 smaller buckets avoids wasted work. -Why not always use a very small time window (e.g few milliseconds) for each bucket? The reason is memory. +Why not always use a very small time window (e.g few milliseconds) for each bucket? +The reason is memory. Recall that the buckets are managed in a Radix-Tree which introduces a high overhead per each item. When many buckets are used, the memory overhead can be high and we might end up with the same memory overhead introduced by using a Radix-Tree index. @@ -260,7 +273,8 @@ We can check the remaining TTL for the password field: > [46] ``` -The reply shows the remaining time in seconds for the field to live. We can also query the absolute expiration time: +The reply shows the remaining time in seconds for the field to live. +We can also query the absolute expiration time: ```python client.hexpiretime("User1", ["password"]) @@ -297,7 +311,8 @@ links:valkey:blogs -> { Here’s how hash field expirations help: -* Each link can have a TTL representing its “relevance window.” If a link hasn’t been accessed within a certain period, it automatically expires. +* Each link can have a TTL representing its “relevance window.” + If a link hasn’t been accessed within a certain period, it automatically expires. * Every time a user queries or updates a link, its TTL can be refreshed, keeping active links alive while letting inactive ones naturally fall off. * Expired links are removed automatically, so you don’t need extra cleanup logic and can focus on active links. @@ -323,12 +338,14 @@ link_data = client.hgetex( ## What’s Next? -What we’ve shipped so far is just the first step: the ability to set and control time-to-live at the hash field level. But we’re not stopping here. +What we’ve shipped so far is just the first step: the ability to set and control time-to-live at the hash field level. +But we’re not stopping here. Future work will focus on two main areas: reducing memory overhead and improving performance. For example, we plan to support compressed encodings for hashes with volatile fields, and to leverage modern CPU features such as memory prefetching and SIMD instructions to speed up operations. Another critical area for improvement is the active expiration job. -Today, all volatile data in Valkey is tracked in unsorted maps (hashtables). The background job must repeatedly scan these unordered sets, which means wasting CPU cycles on entries that aren’t close to expiration. +Today, all volatile data in Valkey is tracked in unsorted maps (hashtables). +The background job must repeatedly scan these unordered sets, which means wasting CPU cycles on entries that aren’t close to expiration. By introducing structured tracking—through the volatile set or even alternative approaches like [Hierarchal Time Wheels](https://www.cs.columbia.edu/~nahum/w6998/papers/sosp87-timing-wheels.pdf) —we can significantly reduce wasted work and make expiration more efficient at scale. diff --git a/content/blog/2025-10-02-50-million-zsets/index.md b/content/blog/2025-10-02-50-million-zsets/index.md index da29c2cf..7b983c04 100644 --- a/content/blog/2025-10-02-50-million-zsets/index.md +++ b/content/blog/2025-10-02-50-million-zsets/index.md @@ -12,13 +12,27 @@ featured = true featured_image = "/blog/50-million-zsets/hero-used-memory-vs-inserts-new.png" +++ -When you run infrastructure at scale, the smallest efficiencies compound into massive savings. Sorted sets (ZSETs) are the backing data structure for far more than leaderboards. They're used for time‑ordered feeds, priority queues, recommendation rankings and more. Each entry carries per‑item overhead; when you're inserting tens of millions of items, those bytes accumulate into gigabytes. The latest Valkey 8.1 release introduces a [redesigned hash table](https://valkey.io/blog/valkey-8-1-0-ga/) and other optimizations that promise lower memory usage and higher throughput. In this post, we put Valkey 8.1 under pressure by benchmarking it against Valkey 8.0, inserting 50 million members into a sorted set and measuring memory consumption and throughput along the way. +When you run infrastructure at scale, the smallest efficiencies compound into massive savings. +Sorted sets (ZSETs) are the backing data structure for far more than leaderboards. +They're used for time‑ordered feeds, priority queues, recommendation rankings and more. +Each entry carries per‑item overhead; when you're inserting tens of millions of items, those bytes accumulate into gigabytes. +The latest Valkey 8.1 release introduces a [redesigned hash table](https://valkey.io/blog/valkey-8-1-0-ga/) and other optimizations that promise lower memory usage and higher throughput. +In this post, we put Valkey 8.1 under pressure by benchmarking it against Valkey 8.0, inserting 50 million members into a sorted set and measuring memory consumption and throughput along the way. ## About Momento and Raider.IO -Momento builds enterprise‑grade real‑time data infrastructure. Our flagship service, [Momento Cache](https://gomomento.com), allows developers to focus on innovation rather than maintaining complex back‑ends. Behind the curtains, Valkey is one of the primary storage engines we operate. Its memory efficiency and predictable performance make it an ideal choice for mission‑critical workloads. By building on Valkey, we can deliver caching experiences that are fast, reliable, and cost‑effective. +Momento builds enterprise‑grade real‑time data infrastructure. +Our flagship service, [Momento Cache](https://gomomento.com), allows developers to focus on innovation rather than maintaining complex back‑ends. +Behind the curtains, Valkey is one of the primary storage engines we operate. +Its memory efficiency and predictable performance make it an ideal choice for mission‑critical workloads. +By building on Valkey, we can deliver caching experiences that are fast, reliable, and cost‑effective. -One such workload is [Raider.IO](https://raider.io), the most popular companion site for World of Warcraft players. Raider.IO maintains leaderboards that track millions of characters and guilds, updating instantly whenever a player clears a dungeon or raid. That translates into hundreds of millions of sorted set operations every day. In this environment, downtime or latency isn't acceptable. Memory efficiency and throughput directly shape the player experience. Running Valkey at hyperscale for workloads like Raider.IO means that improvements in Valkey 8.1 immediately impact both infrastructure cost and the ability to absorb peak traffic without breaking a sweat. +One such workload is [Raider.IO](https://raider.io), the most popular companion site for World of Warcraft players. +Raider.IO maintains leaderboards that track millions of characters and guilds, updating instantly whenever a player clears a dungeon or raid. +That translates into hundreds of millions of sorted set operations every day. +In this environment, downtime or latency isn't acceptable. +Memory efficiency and throughput directly shape the player experience. +Running Valkey at hyperscale for workloads like Raider.IO means that improvements in Valkey 8.1 immediately impact both infrastructure cost and the ability to absorb peak traffic without breaking a sweat. ## Benchmark Setup @@ -30,38 +44,63 @@ To provide a fair comparison, both Valkey 8.0 and Valkey 8.1.1 were run on the * 250,000 item batch size per pipeline * Metrics collected every 1,000,000 inserts (flush between runs) -The [benchmark code is open sourced](https://github.com/momentohq/sorted-set-benchmark) and straightforward to reproduce: it connects to both servers, flushes the test key, performs batched inserts, and records `used_memory`, `used_memory_rss`, total elapsed time, and throughput after each million inserts. This repeatability mirrors the ethos of Valkey's community - every optimization is measurable, and anyone can verify the results. +The [benchmark code is open sourced](https://github.com/momentohq/sorted-set-benchmark) and straightforward to reproduce: it connects to both servers, flushes the test key, performs batched inserts, and records `used_memory`, `used_memory_rss`, total elapsed time, and throughput after each million inserts. +This repeatability mirrors the ethos of Valkey's community - every optimization is measurable, and anyone can verify the results. ## Memory Usage – 8.1 vs 8.0 -Valkey 8.1's redesigned dictionary structure cuts [roughly 20–30 bytes per key](/blog/valkey-8-1-0-ga), and those savings compound with scale. The figure below charts `used_memory` during the benchmark for both versions: +Valkey 8.1's redesigned dictionary structure cuts [roughly 20–30 bytes per key](/blog/valkey-8-1-0-ga), and those savings compound with scale. +The figure below charts `used_memory` during the benchmark for both versions: ![Chart illustrating used vs inserts. It shows Valkey 8.1 with lower used memory](used-memory-vs-inserts.png) -At 1 million inserts, Valkey 8.0 used ~95 MB while Valkey 8.1 used ~81 MB. As the ZSET grew, the gap widened. By 10 million inserts, 8.0 consumed 1.06 GB versus 0.77 GB for 8.1 - **a 27% reduction**. At the end of the run (50 million inserts), 8.1 used 3.77 GB compared to 4.83 GB on 8.0, saving 1.06 GB (≈22 %). +At 1 million inserts, Valkey 8.0 used ~95 MB while Valkey 8.1 used ~81 MB. +As the ZSET grew, the gap widened. +By 10 million inserts, 8.0 consumed 1.06 GB versus 0.77 GB for 8.1 - **a 27% reduction**. +At the end of the run (50 million inserts), 8.1 used 3.77 GB compared to 4.83 GB on 8.0, saving 1.06 GB (≈22 %). -These numbers align with the release notes. Valkey's 8.1 announcement highlights lower per‑key overheads and improved data structure handling; Linuxiac notes that 8.1's architectural changes can reduce memory footprints by [approximately 20 bytes per KV pair](https://linuxiac.com/valkey-8-1-in-memory-data-store-unleashes-10-faster-throughput), with each pair normally consuming 100 bytes (a 20% reduction!). Our results also confirm a similar improvement on large ZSET workloads. +These numbers align with the release notes. +Valkey's 8.1 announcement highlights lower per‑key overheads and improved data structure handling; Linuxiac notes that 8.1's architectural changes can reduce memory footprints by [approximately 20 bytes per KV pair](https://linuxiac.com/valkey-8-1-in-memory-data-store-unleashes-10-faster-throughput), with each pair normally consuming 100 bytes (a 20% reduction!). +Our results also confirm a similar improvement on large ZSET workloads. ## Throughput and Total Time -Memory isn't the only metric that matters. Throughput determines how quickly you can fill or update a set. Although Valkey 8.0 started strong with about 661k inserts per second at the 1M mark, its throughput gradually declined as the data set grew. Valkey 8.1 maintained higher and more consistent throughput, finishing the benchmark at 573k/s compared with 532k/s for 8.0. Overall time to insert 50 million members dropped from 94 seconds on 8.0 to 87 seconds on 8.1, a 7% improvement. +Memory isn't the only metric that matters. +Throughput determines how quickly you can fill or update a set. +Although Valkey 8.0 started strong with about 661k inserts per second at the 1M mark, its throughput gradually declined as the data set grew. +Valkey 8.1 maintained higher and more consistent throughput, finishing the benchmark at 573k/s compared with 532k/s for 8.0. +Overall time to insert 50 million members dropped from 94 seconds on 8.0 to 87 seconds on 8.1, a 7% improvement. -The smoother throughput curve is just as important as the raw peak. Spiky performance complicates capacity planning, especially when running close to memory limits. By contrast, Valkey 8.1's combination of improved hash‑table implementation and I/O thread optimizations delivers predictable scaling. +The smoother throughput curve is just as important as the raw peak. +Spiky performance complicates capacity planning, especially when running close to memory limits. +By contrast, Valkey 8.1's combination of improved hash‑table implementation and I/O thread optimizations delivers predictable scaling. ## Why These Gains Matter For Raider.IO and similar workloads, these improvements translate directly into better economics and user experience: -* Lower infrastructure cost - Saving over a gigabyte per 50 M members means fewer nodes are needed to support the same dataset. At hyperscale, this compounds into significant cost reductions. -* More headroom during peaks - Efficiency gains provide a buffer during seasonal events like game expansions or esports tournaments. When leaderboards surge, there's less risk of hitting memory ceilings. +* Lower infrastructure cost - Saving over a gigabyte per 50 M members means fewer nodes are needed to support the same dataset. + At hyperscale, this compounds into significant cost reductions. +* More headroom during peaks - Efficiency gains provide a buffer during seasonal events like game expansions or esports tournaments. + When leaderboards surge, there's less risk of hitting memory ceilings. * Predictable scaling - A smoother memory growth curve and stable throughput make it easier to forecast when capacity needs to be added and to automate scaling policies. -These benefits don't just apply to leaderboards. Time‑ordered feeds (such as activity streams), job scheduling queues, recommendation rankings, rate‑limiting windows and search scoring all rely on sorted sets. In every case, per‑entry overhead multiplied by millions of entries determines whether you can do more with less. As described in the [Linux Foundation press release](https://www.linuxfoundation.org/press/linux-foundation-announces-general-availability-of-valkey-8-1), upgrading to Valkey 8.1 can reduce memory footprints for common workloads by up to 20%, helping enterprises scale while keeping costs in check. +These benefits don't just apply to leaderboards. +Time‑ordered feeds (such as activity streams), job scheduling queues, recommendation rankings, rate‑limiting windows and search scoring all rely on sorted sets. +In every case, per‑entry overhead multiplied by millions of entries determines whether you can do more with less. +As described in the [Linux Foundation press release](https://www.linuxfoundation.org/press/linux-foundation-announces-general-availability-of-valkey-8-1), upgrading to Valkey 8.1 can reduce memory footprints for common workloads by up to 20%, helping enterprises scale while keeping costs in check. ## Closing Thoughts -As an operator who lives and breathes real‑time data systems, I'm continually amazed by the pace of innovation in the Valkey community. We didn't tune any configuration knobs to achieve these results - Valkey 8.1's efficiency is built in, and the improvements materialized instantly once we upgraded. On a 50 million‑entry benchmark, the new release used 27% less memory while delivering about 8% higher throughput, and completed the workload seven seconds faster than its predecessor. Those deltas may seem small in isolation, but at hyperscale they compound into transformative savings and more resilient services. +As an operator who lives and breathes real‑time data systems, I'm continually amazed by the pace of innovation in the Valkey community. +We didn't tune any configuration knobs to achieve these results - Valkey 8.1's efficiency is built in, and the improvements materialized instantly once we upgraded. +On a 50 million‑entry benchmark, the new release used 27% less memory while delivering about 8% higher throughput, and completed the workload seven seconds faster than its predecessor. +Those deltas may seem small in isolation, but at hyperscale they compound into transformative savings and more resilient services. -If you're running sorted set heavy workloads - whether leaderboards, feeds, queues or scoring engines - I encourage you to upgrade to Valkey 8.1 and run this benchmark yourself. Interested in how Valkey 8.1 stacked up to its competitors? [So were we](https://www.gomomento.com/blog/valkey-vs-redis-memory-efficiency-at-hyperscale/)! +If you're running sorted set heavy workloads - whether leaderboards, feeds, queues or scoring engines - I encourage you to upgrade to Valkey 8.1 and run this benchmark yourself. +Interested in how Valkey 8.1 stacked up to its competitors? +[So were we](https://www.gomomento.com/blog/valkey-vs-redis-memory-efficiency-at-hyperscale/)! -Our code is [open source](https://github.com/momentohq/sorted-set-benchmark) and available to run on your own hardware. I think you'll be pleasantly surprised by how much headroom you gain and how effortlessly Valkey handles pressure. The power of open source and community‑driven engineering continues to shine through in every release. +Our code is [open source](https://github.com/momentohq/sorted-set-benchmark) and available to run on your own hardware. +I think you'll be pleasantly surprised by how much headroom you gain and how effortlessly Valkey handles pressure. +The power of open source and community‑driven engineering continues to shine through in every release. diff --git a/content/blog/2025-10-15-properly-secure-your-valkey-deployment.md b/content/blog/2025-10-15-properly-secure-your-valkey-deployment.md index af31e57f..6849b20b 100644 --- a/content/blog/2025-10-15-properly-secure-your-valkey-deployment.md +++ b/content/blog/2025-10-15-properly-secure-your-valkey-deployment.md @@ -13,33 +13,54 @@ featured_image = "/assets/media/featured/random-06.webp" Most of the production security incidents I've helped debug started with misconfigurations rather than zero-days or sophisticated exploits. -Security misconfiguration ranks as A05 in the [OWASP Top 10:2021](https://owasp.org/Top10/A05_2021-Security_Misconfiguration/), with 90% of applications tested showing some form of misconfiguration. That's staggering. And when it comes to infrastructure like Valkey, the stakes are even higher - your cache often sits at the heart of your application, touching every request. +Security misconfiguration ranks as A05 in the [OWASP Top 10:2021](https://owasp.org/Top10/A05_2021-Security_Misconfiguration/), with 90% of applications tested showing some form of misconfiguration. +That's staggering. +And when it comes to infrastructure like Valkey, the stakes are even higher - your cache often sits at the heart of your application, touching every request. -Engineers really care about security - but it is easy to overlook some crucial settings. This is especially true in the cloud, where everything moves really fast. You spin up a Valkey instance inside your VPC, it works, and you move on to the next problem. VPC can lock down your network to the outsiders - but I often see multiple teams being able to access the same VPC. This leaves systems vulnerable to insider threats as well as well intentioned people or microservices that just happen to have a bad day. But using default configurations or enabling unnecessary features can make systems [easy targets for attackers](https://socradar.io/redis-redishell-vulnerability-cve-2025-49844/). +Engineers really care about security - but it is easy to overlook some crucial settings. +This is especially true in the cloud, where everything moves really fast. +You spin up a Valkey instance inside your VPC, it works, and you move on to the next problem. +VPC can lock down your network to the outsiders - but I often see multiple teams being able to access the same VPC. +This leaves systems vulnerable to insider threats as well as well intentioned people or microservices that just happen to have a bad day. +But using default configurations or enabling unnecessary features can make systems [easy targets for attackers](https://socradar.io/redis-redishell-vulnerability-cve-2025-49844/). -Let's talk about how to actually secure a Valkey deployment. Not with a single magic bullet, but with layers that work together. +Let's talk about how to actually secure a Valkey deployment. +Not with a single magic bullet, but with layers that work together. ## Defense in Depth for Valkey -[Defense in depth](https://csrc.nist.gov/glossary/term/defense_in_depth) is a security principle where multiple layers of security controls protect against attack, eliminating or mitigating single points of compromise. For Valkey, this means building overlapping protections so no single misconfiguration leaves you completely exposed. +[Defense in depth](https://csrc.nist.gov/glossary/term/defense_in_depth) is a security principle where multiple layers of security controls protect against attack, eliminating or mitigating single points of compromise. +For Valkey, this means building overlapping protections so no single misconfiguration leaves you completely exposed. ### Network Boundaries -This is your first line of defense. Valkey is designed to be accessed by trusted clients inside trusted environments. It should never be [directly exposed to the internet](https://ine.com/blog/cve-20220543-lua-sandbox-escape-in-redis). +This is your first line of defense. +Valkey is designed to be accessed by trusted clients inside trusted environments. +It should never be [directly exposed to the internet](https://ine.com/blog/cve-20220543-lua-sandbox-escape-in-redis). -This is where putting your Valkey node inside a VPC is necessary - but not sufficient. Security groups help reinforce access limitation to make sure that only services and people who are intended to access the cluster can do so. Your CI runners probably don't need direct cache access. Each service should have just the access it needs. +This is where putting your Valkey node inside a VPC is necessary - but not sufficient. +Security groups help reinforce access limitation to make sure that only services and people who are intended to access the cluster can do so. +Your CI runners probably don't need direct cache access. +Each service should have just the access it needs. -Modern infrastructure also handles TLS seamlessly. While it is unlikely that an attacker is sniffing your packets on your cloud network, it is best practice to have encryption in transit - even within your own network. Current server hardware barely notices the handshake overhead, and Valkey picked up its TLS support back in 2020, so you rarely have to trade performance for security here. +Modern infrastructure also handles TLS seamlessly. +While it is unlikely that an attacker is sniffing your packets on your cloud network, it is best practice to have encryption in transit - even within your own network. +Current server hardware barely notices the handshake overhead, and Valkey picked up its TLS support back in 2020, so you rarely have to trade performance for security here. ### Authentication and Authorization -Authentication adds a critical layer of resiliency. The authentication layer protects you if your firewall or other protections fail, unauthenticated clients still can't access your instance. +Authentication adds a critical layer of resiliency. +The authentication layer protects you if your firewall or other protections fail, unauthenticated clients still can't access your instance. -Valkey supports [two authentication methods](https://valkey.io/topics/security/#authentication): the newer ACL system (Access Control Lists) and the legacy `requirepass`. ACLs give you more flexibility by allowing you to create users with fine-grained permissions tailored to what each service actually needs. If you already have centralized identity wiring, Valkey's [LDAP integration](https://valkey.io/topics/ldap/) plugs into that source of truth so you aren't managing a separate credential store just for the cache. +Valkey supports [two authentication methods](https://valkey.io/topics/security/#authentication): the newer ACL system (Access Control Lists) and the legacy `requirepass`. +ACLs give you more flexibility by allowing you to create users with fine-grained permissions tailored to what each service actually needs. +If you already have centralized identity wiring, Valkey's [LDAP integration](https://valkey.io/topics/ldap/) plugs into that source of truth so you aren't managing a separate credential store just for the cache. ### Command Surface and Runtime Protection -You can tighten security further by controlling which commands are available. Valkey's ACL system lets you create users with fine-grained command permissions tailored to what each service actually needs. For example, a caching service might only need read and write operations: +You can tighten security further by controlling which commands are available. +Valkey's ACL system lets you create users with fine-grained command permissions tailored to what each service actually needs. +For example, a caching service might only need read and write operations: ```bash ACL SETUSER cache_writer on >strongpassword ~cached:* +get +set +del +expire @@ -56,33 +77,50 @@ And your admin user can have full access while still being explicitly configured ACL SETUSER admin on >verystrongpassword ~* +@all ``` -This principle of least privilege means that even if credentials are compromised, an attacker is limited to only the operations the user can perform. A read-only monitoring account can't flush your entire cache or modify configurations. +This principle of least privilege means that even if credentials are compromised, an attacker is limited to only the operations the user can perform. +A read-only monitoring account can't flush your entire cache or modify configurations. For most application clients, a solid baseline is `ACL SETUSER application on >password +@all -@dangerous -@scripting`, which keeps day-to-day commands available while stripping scripting and other dangerous categories that often lead to trouble. Beyond command restrictions, focus on container-level privilege boundaries rather than dropping root inside the container. -The [official Valkey container image](https://hub.docker.com/r/valkey/valkey/) runs as root by default, which is standard practice. Container isolation provides the necessary security boundary, but the runtime still needs hardening. Restrict who can run or exec into containers, scope mounted volumes carefully, use read-only mounts for configuration files, and keep the image up to date. +The [official Valkey container image](https://hub.docker.com/r/valkey/valkey/) runs as root by default, which is standard practice. +Container isolation provides the necessary security boundary, but the runtime still needs hardening. +Restrict who can run or exec into containers, scope mounted volumes carefully, use read-only mounts for configuration files, and keep the image up to date. These controls protect against container breakout and privilege escalation — the real risks in production environments. ### Operational Controls -Once Valkey is running, your operational posture determines how quickly you can detect and contain issues. Enable logging so you can see what's happening. Monitor for unusual patterns like sudden spikes in command execution, connections from unexpected sources, or commands that shouldn't be running in your environment. +Once Valkey is running, your operational posture determines how quickly you can detect and contain issues. +Enable logging so you can see what's happening. +Monitor for unusual patterns like sudden spikes in command execution, connections from unexpected sources, or commands that shouldn't be running in your environment. -Set resource limits in your configuration. Poorly written operations or runaway commands can impact your cache's availability. `maxmemory` stops misbehaving workloads from consuming the whole node, and if you touch `timeout`, prefer the unauthenticated variant; forcing disconnects on healthy clients usually just amplifies reconnect storms. +Set resource limits in your configuration. +Poorly written operations or runaway commands can impact your cache's availability. +`maxmemory` stops misbehaving workloads from consuming the whole node, and if you touch `timeout`, prefer the unauthenticated variant; forcing disconnects on healthy clients usually just amplifies reconnect storms. -Observability is part of security! Logs and metrics turn silent failures into visible signals, and visibility is what buys you time to respond before small issues become incidents. Track authentication failures like `acl_access_denied_auth` specifically - they're usually the first sign someone is poking around where they shouldn't. +Observability is part of security! +Logs and metrics turn silent failures into visible signals, and visibility is what buys you time to respond before small issues become incidents. +Track authentication failures like `acl_access_denied_auth` specifically - they're usually the first sign someone is poking around where they shouldn't. ## The Real Reason for Layered Security -Anecdotally, I've seen too many teams implement authentication and feel like they're done. And authentication is great, it's an essential layer. But defense in depth means multiple layers of safeguards, not relying on any single control. +Anecdotally, I've seen too many teams implement authentication and feel like they're done. +And authentication is great, it's an essential layer. +But defense in depth means multiple layers of safeguards, not relying on any single control. -Here's a real scenario: You've enabled authentication. But then a developer accidentally pushes credentials into a public GitHub repo. Or a microservice inside your VPC gets compromised and its environment variables are exposed. Or credentials end up in application logs. +Here's a real scenario: You've enabled authentication. +But then a developer accidentally pushes credentials into a public GitHub repo. +Or a microservice inside your VPC gets compromised and its environment variables are exposed. +Or credentials end up in application logs. -With layered security, network segmentation catches the GitHub leak. Monitoring catches the compromised service behaving oddly. ACLs limit what an attacker can do even with credentials. +With layered security, network segmentation catches the GitHub leak. +Monitoring catches the compromised service behaving oddly. +ACLs limit what an attacker can do even with credentials. -Each layer catches what the others might miss. That's the strength of defense in depth. +Each layer catches what the others might miss. +That's the strength of defense in depth. ## Your Security Checklist @@ -92,14 +130,22 @@ Here's a good starting point: * Enable authentication: Use ACLs if your setup supports it, requirepass at minimum * Audit your command surface: Create and apply role-based ACLs to limit access * Run as non-root: Create a dedicated user for Valkey -* Review your threat model: Who has access to your VPC? What are the realistic risks? +* Review your threat model: Who has access to your VPC? + What are the realistic risks? The [Valkey security documentation](https://valkey.io/topics/security/) has detailed implementation guidance for all of this. ## Security Is a Practice, Not a Checkbox -Infrastructure evolves. New services get added. Teams grow and change. Requirements shift. +Infrastructure evolves. +New services get added. +Teams grow and change. +Requirements shift. -Security works best when it's part of how we operate, not something we set up once and forget. Review your configurations regularly. Update your approach as your architecture changes. And if you're ever unsure, the community is here. +Security works best when it's part of how we operate, not something we set up once and forget. +Review your configurations regularly. +Update your approach as your architecture changes. +And if you're ever unsure, the community is here. -**P.S.** If you need help thinking through your Valkey security setup, reach out to me on [LinkedIn](https://linkedin.com/in/allenheltondev). I'm happy to talk through it. +**P.S.** If you need help thinking through your Valkey security setup, reach out to me on [LinkedIn](https://linkedin.com/in/allenheltondev). +I'm happy to talk through it. diff --git a/content/blog/2025-10-20-1-billion-rps/index.md b/content/blog/2025-10-20-1-billion-rps/index.md index 5c7e7f6d..cbf3aa51 100644 --- a/content/blog/2025-10-20-1-billion-rps/index.md +++ b/content/blog/2025-10-20-1-billion-rps/index.md @@ -13,48 +13,87 @@ featured_image = "/assets/media/featured/random-04.webp" The upcoming Valkey 9.0 release brings major improvements in the resilience of large clusters, enabling scaling to 2,000 nodes and achieving over 1 billion requests per second, all while ensuring bounded recovery time. In this blog post, we provide an overview of how the Valkey clustering system works, along with the architectural improvements and rigorous testing that made this level of scale possible. -Valkey’s standalone configuration is a single server setup with optional replicas for availability, but all writes flow to one primary. It is one process, one dataset, zero coordination, blazing fast and simple to operate when a single machine’s CPU, memory, and NIC can carry the load. However, Valkey at-scale moves past single node limits. - -Valkey’s cluster mode shards the keyspace into **16,384 hash slots** and spreads them across multiple primaries with replicas for redundancy. Clients are cluster aware: they route commands directly to the node owning the slot and follow redirections during resharding or failover. The result is horizontal scalability, balanced throughput, and built in fault tolerance without a central coordinator. Behind the scenes, the cluster bus keeps this distributed system coherent, coordinating membership, gossip, and failover. +Valkey’s standalone configuration is a single server setup with optional replicas for availability, but all writes flow to one primary. +It is one process, one dataset, zero coordination, blazing fast and simple to operate when a single machine’s CPU, memory, and NIC can carry the load. +However, Valkey at-scale moves past single node limits. + +Valkey’s cluster mode shards the keyspace into **16,384 hash slots** and spreads them across multiple primaries with replicas for redundancy. +Clients are cluster aware: they route commands directly to the node owning the slot and follow redirections during resharding or failover. +The result is horizontal scalability, balanced throughput, and built in fault tolerance without a central coordinator. +Behind the scenes, the cluster bus keeps this distributed system coherent, coordinating membership, gossip, and failover. ![Diagram showcasing different operational mode](1B-rps-overview.png) ## Cluster Bus Overview -Under the hood, nodes coordinate over the cluster bus a persistent TCP mesh with a lightweight, gossip-based protocol. It handles `MEET` (discovery), `PING`/`PONG` heartbeats with piggybacked cluster topology, quorum-based `FAIL` decisions, replica promotion elections, and epoch-based conflict resolution so the cluster converges cleanly after partitions. Since membership, health, and slot ownership flow through gossip, it allows Valkey to scale to large node counts while remaining resilient to node and network failures. +Under the hood, nodes coordinate over the cluster bus a persistent TCP mesh with a lightweight, gossip-based protocol. +It handles `MEET` (discovery), `PING`/`PONG` heartbeats with piggybacked cluster topology, quorum-based `FAIL` decisions, replica promotion elections, and epoch-based conflict resolution so the cluster converges cleanly after partitions. +Since membership, health, and slot ownership flow through gossip, it allows Valkey to scale to large node counts while remaining resilient to node and network failures. ### Membership Discovery and Information Dissemination (Gossip) -Nodes join a Valkey cluster by sending a `MEET` message to any existing member (a seed). From there, the cluster bus, a mesh of persistent TCP links which spreads membership and topology using lightweight gossip of peers piggybacked on periodic PING/PONG heartbeats. This peer-to-peer exchange quickly converges every node in the cluster and which slots each primary owns, without any central coordinator. +Nodes join a Valkey cluster by sending a `MEET` message to any existing member (a seed). +From there, the cluster bus, a mesh of persistent TCP links which spreads membership and topology using lightweight gossip of peers piggybacked on periodic PING/PONG heartbeats. +This peer-to-peer exchange quickly converges every node in the cluster and which slots each primary owns, without any central coordinator. ![Diagram showcasing membership discovery and mesh topology formation](1B-rps-node-discovery.png) ### Cluster Bus: Failure Detection, Failover, and Epoch Update -When a node misses heartbeats beyond the configurable node-timeout, peers mark it potentially failed (`PFAIL` - suspect). If a quorum of primaries observes the timeout, they declare `FAIL` and initiate failover: the replica(s) of the failed primary becomes candidate to take over the ownership of the shard and send vote requests to all the primaries. Primaries respond and the winner is promoted to serve the affected slots. Clients that hit the old owner receive `MOVED/ASK` and transparently retry against the new primary. +When a node misses heartbeats beyond the configurable node-timeout, peers mark it potentially failed (`PFAIL` - suspect). +If a quorum of primaries observes the timeout, they declare `FAIL` and initiate failover: the replica(s) of the failed primary becomes candidate to take over the ownership of the shard and send vote requests to all the primaries. +Primaries respond and the winner is promoted to serve the affected slots. +Clients that hit the old owner receive `MOVED/ASK` and transparently retry against the new primary. ![Diagram showcasing failure detection and failover](1B-rps-failover.png) ## Major improvements to scale Cluster Bus in Valkey -Across multiple major/minor versions, the community has improved cluster stability a lot and have made multiple changes to handle various failure scenarios to heal the system in a steady manner and avoid any manual intervention. Here are few of the interesting improvements: - -* **Multiple primary failures** Failover operation across cluster is serialized. Hence, only one shard can undergo failover at a given point in time. When there are multiple primary outages across the cluster, it used to lead to collision of vote request from replica candidates of impacted shards. Due to the collision, the votes would get split and the cluster won’t reach to consensus of promoting a replica in a given cycle. With a large number of primaries failing, the cluster won’t heal automatically and further an administrator needs to manually intervene. -This problem was tackled by [Binbin Zhu](https://github.com/enjoy-binbin) in Valkey 8.1 by introducing a [ranking mechanism](https://github.com/valkey-io/valkey/pull/1018) to each shard based on lexicographic order of the shard ID. With the ranking algorithm, the shard with highest ranking would go sooner and the one with lower ranking would add additional delay to start the election for the given shard. This helped to get a consistent recovery time in a multiple primary outage. -* **Reconnection attempt storm to unavailable nodes** Profiling revealed that with multiple node failures, a large chunk of compute goes into attempting to reconnect with the already failed nodes. Each node attempts to reconnect to all the failed nodes every 100ms. This lead to significant compute usage when there are hundreds of failed nodes in the cluster. In order to prevent the cluster from getting overwhelmed, [Sarthak Aggarwal](https://github.com/sarthakaggarwal97) implemented a [throttling mechanism](https://github.com/valkey-io/valkey/pull/2154) which allows enough reconnect attempts within a configured cluster node timeout, while ensuring the server node is not overwhelmed. -* **Optimized failure report tracking** Profiling also revealed that when hundreds of nodes fail simultaneously, the surviving nodes spend a significant amount of time processing and cleaning up redundant failure reports. For example, after 499 out of 2000 nodes were killed, the remaining 1501 nodes continued to gossip about each failed node and exchange reports, even after those nodes had already been marked as failed. [Seungmin Lee](https://github.com/sungming2) optimized the [addition/removal of failure report](https://github.com/valkey-io/valkey/pull/2277) by using a radix tree to store the failure report time information rounded to every second and group multiple report together. This helps with cleaning up expired failure report efficiently as well. Further optimizations were also made to avoid duplicate failure report processing and save CPU cycles. -* **Pub/Sub System** Cluster bus system is also used for [pub/sub operations](https://valkey.io/topics/pubsub/) to provide a simplified interface for a client to connect to any node to publish data and subscribers connected on any node would receive the data. The data is transported via the cluster bus. This is quite an interesting usage of the cluster bus. However, the metadata overhead of each packet is roughly 2 KB which is quite large for small pub/sub messages. The observation was the packet header was large due to the slot ownership information (16384 bits = 2048 bytes). And that information was irrelevant for a pub/sub message. Hence, [Roshan Khatri](https://github.com/roshkhatri) introduced a [light weight message header](https://github.com/valkey-io/valkey/pull/654) (~30 bytes) to be used for efficient message transfer across nodes. This allowed pub/sub to scale better with large clusters. -Valkey also has a sharded pub/sub system which keeps the data traffic of shard channels to a given shard which is an major improvement over the global pub/sub system in cluster mode. This was also onboarded to the light weight message header. - -Valkey 9.0 has plenty of other improvements to increase the overall stability of the clustering system. All these enhancements allowed us to scale to 2,000 nodes with bounded recovery time during network partitions and below we have documented the benchmark setup and the throughput we were able to attain. +Across multiple major/minor versions, the community has improved cluster stability a lot and have made multiple changes to handle various failure scenarios to heal the system in a steady manner and avoid any manual intervention. +Here are few of the interesting improvements: + +* **Multiple primary failures** Failover operation across cluster is serialized. + Hence, only one shard can undergo failover at a given point in time. + When there are multiple primary outages across the cluster, it used to lead to collision of vote request from replica candidates of impacted shards. + Due to the collision, the votes would get split and the cluster won’t reach to consensus of promoting a replica in a given cycle. + With a large number of primaries failing, the cluster won’t heal automatically and further an administrator needs to manually intervene. +This problem was tackled by [Binbin Zhu](https://github.com/enjoy-binbin) in Valkey 8.1 by introducing a [ranking mechanism](https://github.com/valkey-io/valkey/pull/1018) to each shard based on lexicographic order of the shard ID. +With the ranking algorithm, the shard with highest ranking would go sooner and the one with lower ranking would add additional delay to start the election for the given shard. +This helped to get a consistent recovery time in a multiple primary outage. +* **Reconnection attempt storm to unavailable nodes** Profiling revealed that with multiple node failures, a large chunk of compute goes into attempting to reconnect with the already failed nodes. + Each node attempts to reconnect to all the failed nodes every 100ms. + This lead to significant compute usage when there are hundreds of failed nodes in the cluster. + In order to prevent the cluster from getting overwhelmed, [Sarthak Aggarwal](https://github.com/sarthakaggarwal97) implemented a [throttling mechanism](https://github.com/valkey-io/valkey/pull/2154) which allows enough reconnect attempts within a configured cluster node timeout, while ensuring the server node is not overwhelmed. +* **Optimized failure report tracking** Profiling also revealed that when hundreds of nodes fail simultaneously, the surviving nodes spend a significant amount of time processing and cleaning up redundant failure reports. + For example, after 499 out of 2000 nodes were killed, the remaining 1501 nodes continued to gossip about each failed node and exchange reports, even after those nodes had already been marked as failed. + [Seungmin Lee](https://github.com/sungming2) optimized the [addition/removal of failure report](https://github.com/valkey-io/valkey/pull/2277) by using a radix tree to store the failure report time information rounded to every second and group multiple report together. + This helps with cleaning up expired failure report efficiently as well. + Further optimizations were also made to avoid duplicate failure report processing and save CPU cycles. +* **Pub/Sub System** Cluster bus system is also used for [pub/sub operations](https://valkey.io/topics/pubsub/) to provide a simplified interface for a client to connect to any node to publish data and subscribers connected on any node would receive the data. + The data is transported via the cluster bus. + This is quite an interesting usage of the cluster bus. + However, the metadata overhead of each packet is roughly 2 KB which is quite large for small pub/sub messages. + The observation was the packet header was large due to the slot ownership information (16384 bits = 2048 bytes). + And that information was irrelevant for a pub/sub message. + Hence, [Roshan Khatri](https://github.com/roshkhatri) introduced a [light weight message header](https://github.com/valkey-io/valkey/pull/654) (~30 bytes) to be used for efficient message transfer across nodes. + This allowed pub/sub to scale better with large clusters. +Valkey also has a sharded pub/sub system which keeps the data traffic of shard channels to a given shard which is an major improvement over the global pub/sub system in cluster mode. +This was also onboarded to the light weight message header. + +Valkey 9.0 has plenty of other improvements to increase the overall stability of the clustering system. +All these enhancements allowed us to scale to 2,000 nodes with bounded recovery time during network partitions and below we have documented the benchmark setup and the throughput we were able to attain. ## Benchmarking -In order to scale the Valkey cluster to 1 billion requests per second (RPS) for write command, we decided to choose a SET type command to accurately reflect the scale. We have seen previous experiments where a single instance was able to achieve more than [1 million RPS](/blog/unlock-one-million-rps) so the goal was to reach 1 billion RPS with a 2,000 node cluster, where each shard has 1 primary and 1 replica. A replica is added to each shard for better availability. +In order to scale the Valkey cluster to 1 billion requests per second (RPS) for write command, we decided to choose a SET type command to accurately reflect the scale. +We have seen previous experiments where a single instance was able to achieve more than [1 million RPS](/blog/unlock-one-million-rps) so the goal was to reach 1 billion RPS with a 2,000 node cluster, where each shard has 1 primary and 1 replica. +A replica is added to each shard for better availability. **Hardware Configuration** -For this experiment, Valkey cluster was deployed on AWS `r7g.2xlarge` instance type, which is a memory optimized instance, featuring 8 cores and 64 GB memory on an ARM-based (`aarch64`) architecture. In order to generate enough traffic across all the slots, we used 750 instances of AWS `c7g.16xlarge`. +For this experiment, Valkey cluster was deployed on AWS `r7g.2xlarge` instance type, which is a memory optimized instance, featuring 8 cores and 64 GB memory on an ARM-based (`aarch64`) architecture. +In order to generate enough traffic across all the slots, we used 750 instances of AWS `c7g.16xlarge`. **System Configuration** -Note: The core assignments used in this guide are examples. Optimal core selection may vary depending on your specific system configuration and workload. +Note: The core assignments used in this guide are examples. +Optimal core selection may vary depending on your specific system configuration and workload. Each of the Valkey server nodes had 8 cores, so we decided to pin 2 cores to ensure interrupt affinity. @@ -106,7 +145,8 @@ maxmemory 50gb # Limit maximum memory utilization by the process ``` **Benchmark Configurations** -We ran the `valkey-benchmark` from 750 client instances to generate the required traffic. We used the following parameters for each of those instances. +We ran the `valkey-benchmark` from 750 client instances to generate the required traffic. +We used the following parameters for each of those instances. * Number of requests (-n): `100M` * Number of clients (-c): `1000` @@ -120,10 +160,19 @@ Overall observation has been that the throughput grows almost linearly with the ### Recovery -In the same environment, we tested the recovery time of the cluster when multiple primary nodes go down. We picked up to 50% of the primaries and killed them and let the automatic failover process to heal the write outage for a given shard. To simulate primary node failures, we sent `SIGKILL` to hard-stop the Valkey process, and let the replica take over through automated failovers. The recovery time measured here is from the moment any of the nodes discovered a primary in a `PFAIL` state until the cluster reported ok and all slots were covered again. +In the same environment, we tested the recovery time of the cluster when multiple primary nodes go down. +We picked up to 50% of the primaries and killed them and let the automatic failover process to heal the write outage for a given shard. +To simulate primary node failures, we sent `SIGKILL` to hard-stop the Valkey process, and let the replica take over through automated failovers. +The recovery time measured here is from the moment any of the nodes discovered a primary in a `PFAIL` state until the cluster reported ok and all slots were covered again. ![Diagram showcasing recovery time across various primary failure scenarios](1B-rps-recovery-time.png) ## Closing thoughts -With all these improvements made in Valkey, a cluster can now scale to 1 billion RPS using 2,000 nodes which is quite a remarkable feat. However, there is plenty of room to improve further. The steady state CPU utilization overhead from the cluster bus message transfer/processing can be reduced further by incorporating the [SWIM protocol](https://en.wikipedia.org/wiki/SWIM_Protocol) or moving the cluster bus messsage processing off the main thread into an independent separate thread. The failover logic can be made smarter as well by incorporating the AZ placement of nodes. We would also like to introduce more observability metrics/logs into the system for better manageability. All of these are being linked under the [Support Large Cluster](https://github.com/valkey-io/valkey/issues/2281) issue. Feel free to check it out and add in your suggestions. +With all these improvements made in Valkey, a cluster can now scale to 1 billion RPS using 2,000 nodes which is quite a remarkable feat. +However, there is plenty of room to improve further. +The steady state CPU utilization overhead from the cluster bus message transfer/processing can be reduced further by incorporating the [SWIM protocol](https://en.wikipedia.org/wiki/SWIM_Protocol) or moving the cluster bus messsage processing off the main thread into an independent separate thread. +The failover logic can be made smarter as well by incorporating the AZ placement of nodes. +We would also like to introduce more observability metrics/logs into the system for better manageability. +All of these are being linked under the [Support Large Cluster](https://github.com/valkey-io/valkey/issues/2281) issue. +Feel free to check it out and add in your suggestions. diff --git a/content/blog/2025-10-27-atomic-slot-migration/index.md b/content/blog/2025-10-27-atomic-slot-migration/index.md index a9859416..c539bf4f 100644 --- a/content/blog/2025-10-27-atomic-slot-migration/index.md +++ b/content/blog/2025-10-27-atomic-slot-migration/index.md @@ -11,14 +11,17 @@ featured_image = "/assets/media/featured/random-05.webp" +++ Managing the topology of a distributed database is one of the most critical and -challenging tasks for any operator. For a high-performance system like Valkey, +challenging tasks for any operator. +For a high-performance system like Valkey, moving data slots between nodes —a process known as resharding— needs to be fast, reliable, and easy. Clustered Valkey has historically supported resharding through a process known as slot migration, where one or more of the 16,384 slots is moved from one shard -to another. This slot migration process has historically led to many operational -headaches. To address this, Valkey 9.0 introduced a powerful new feature that +to another. +This slot migration process has historically led to many operational +headaches. +To address this, Valkey 9.0 introduced a powerful new feature that fundamentally improves this process: **Atomic Slot Migration**. Atomic Slot Migration includes many benefits that makes resharding painless. @@ -51,55 +54,68 @@ This was subject to the following problems: - **Higher latency for client operations**: All client writes and reads to keys in the migrating hash slot were subject to redirections through a special `-ASK` error response, which required re-execution of the command on the - target node. Redirected responses meant unexpected latency spikes during + target node. + Redirected responses meant unexpected latency spikes during migrations. - **Multi-key operation unavailability**: Commands like `MGET` and `MSET` which supply multiple keys could not always be served by a single node when slots - were migrating. When this happened, clients would receive error responses and + were migrating. + When this happened, clients would receive error responses and were expected to retry. - **Problems with large keys/collections**: Since the migration was performed one key at a time, large keys (e.g. collections with many elements) needed to - be sent as a single command. Serialization of a large key required a large + be sent as a single command. + Serialization of a large key required a large contiguous memory chunk on the source node and import of that payload required - a similar large memory chunk and a large CPU burst on the target node. In some + a similar large memory chunk and a large CPU burst on the target node. + In some cases, the memory consumption was enough to trigger out-of-memory conditions on either side, or the CPU burst could be large enough to cause a failover on the target shard due to health probes not being served. - **Slot migration latency**: The overall latency of the slot migration was bounded by how quickly the operator could send the `CLUSTER GETKEYSINSLOT` and - `MIGRATE` commands. Each batch of keys required a full round-trip-time between + `MIGRATE` commands. + Each batch of keys required a full round-trip-time between the operator's machine and the cluster, leaving a lot of waiting time that could be used to do data migration. - **Lack of resilience to failure**: If a failure condition was encountered, for example, the hash slot will not fit on the target node, undoing the slot migration is not well supported and requires replaying the listed steps in - reverse. In some cases, the hash slot may have grown while the migration was + reverse. + In some cases, the hash slot may have grown while the migration was underway, and may not fit on either the source or target node. ## The Core Idea: Migration via Replication At its heart, the new atomic slot migration process closely resembles the concepts of replication and failover which serve as the backbone for high -availability within Valkey. When atomic slot migration is requested, data is +availability within Valkey. +When atomic slot migration is requested, data is asynchronously sent from the old owner (the source node) to the new owner (the -target node). Once all data is transferred and the target is completely caught +target node). +Once all data is transferred and the target is completely caught up, the ownership is atomically transferred to the target node. This gets logically broken down into three phases: 1. **Snapshot Phase**: The source node first sends a point-in-time snapshot of - all the data in the migrating slots to the target node. The snapshot is done + all the data in the migrating slots to the target node. + The snapshot is done asynchronously through a child process, allowing the parent process to - continue serving requests. The snapshot is formatted as a stream of commands + continue serving requests. + The snapshot is formatted as a stream of commands which the target node and its replica can consume verbatim. 2. **Streaming Phase**: While the snapshot is ongoing, the source node will keep - track of all new mutations made to the migrating slots. Once the snapshotting + track of all new mutations made to the migrating slots. + Once the snapshotting completes, the source node streams all incremental changes for those slots to the target. 3. **Finalization Phase**: Once the stream of changes has been sent to the - target, the source node briefly pauses mutations. Only once the target has + target, the source node briefly pauses mutations. + Only once the target has fully processed these changes does it acquire ownership of the migrating - slots and broadcast ownership to the cluster. When the source node discovers + slots and broadcast ownership to the cluster. + When the source node discovers this, it knows it can delete the contents of those slots and redirect any paused clients to the new owner **atomically**. @@ -119,13 +135,16 @@ Slot Migration provides many desirable properties over the previous mechanism: problems previously encountered when dumping and restoring a large collection. - **A migration can easily be rolled back on cancellation or failure**: Since Valkey places the hash slots in a staging area, they are easily wipe them - independently of the rest of the database. Since this state is not broadcasted + independently of the rest of the database. + Since this state is not broadcasted to the cluster, ending the migration is a straight-forward process of cleaning - up the staging area and marking the migration as cancelled. Many failures, + up the staging area and marking the migration as cancelled. + Many failures, like out-of-memory, failover, or network partition can be handled completely by the engine. - **Greatly lowered slot migration latency**: Valkey is highly-optimized for - replication. By batching the slot migrations and using this replication-like + replication. + By batching the slot migrations and using this replication-like process, the end-to-end migration latency can lower by as much as 9x when compared to legacy slot migration through `valkey-cli`. @@ -135,15 +154,18 @@ A new family of `CLUSTER` commands gives you full control over the migration lifecycle. - [`CLUSTER MIGRATESLOTS SLOTSRANGE start-slot end-slot NODE node-id`](/commands/cluster-migrateslots/) - - This command kicks off the migration. You can specify one or more slot - ranges and the target node ID to begin pushing data. Multiple migrations can + - This command kicks off the migration. + You can specify one or more slot + ranges and the target node ID to begin pushing data. + Multiple migrations can be queued in one command by repeating the SLOTSRANGE and NODE arguments. - [`CLUSTER CANCELSLOTMIGRATIONS`](/commands/cluster-cancelslotmigrations/) - Use this command to safely cancel all ongoing slot migrations originating from the node. - [`CLUSTER GETSLOTMIGRATIONS`](/commands/cluster-getslotmigrations/) - This gives you an observable log of recent and active migrations, allowing - you to monitor the status, duration, and outcome of each job. Slot migration + you to monitor the status, duration, and outcome of each job. + Slot migration jobs are stored in memory, allowing for simple programmatic access and error handling. @@ -159,7 +181,8 @@ To make things reproducible, the test setup is outlined below: us-central1 region running Valkey 9.0.0 - Client machine is a separate `c4-standard-8` GCE VM in us-central1-f - Rebalancing is accomplished with the `valkey-cli --cluster rebalance` command, - with all parameters defaulted. The only exception is during scale in, where + with all parameters defaulted. + The only exception is during scale in, where `--cluster-weight` is used to set the weights to only allocate to 3 shards. - The cluster is filled with 40 GB of data consisting of 16 KB string valued keys @@ -167,7 +190,8 @@ To make things reproducible, the test setup is outlined below: ### Slot Migration Latency: Who's Faster? The experiment had two tests: one with no load and one with heavy read/write -load. The heavy load is simulated using [memtier-benchmark](https://github.com/RedisLabs/memtier_benchmark) with a 1:10 set/get +load. +The heavy load is simulated using [memtier-benchmark](https://github.com/RedisLabs/memtier_benchmark) with a 1:10 set/get ratio on the client machine specified above. ![Chart showing time to scale in and out when under load, from the table below](legacy-vs-atomic-latency.png) @@ -206,7 +230,8 @@ ratio on the client machine specified above. The main culprit here is unnecessary network round trips (RTTs) in legacy slot -migration. Each slot requires: +migration. +Each slot requires: - 2 RTTs to call `SETSLOT` and begin the migration - Each batch of keys in a slot requires: @@ -215,7 +240,8 @@ migration. Each slot requires: - 1 RTT for the actual migration of the key batch from source to target node - 2 RTTs to call `SETSLOT` and end the migration -Those round trip times add up. For this test case where we have: +Those round trip times add up. +For this test case where we have: - 4096 slots to move - 160 keys per slot @@ -236,23 +262,27 @@ latency. The experiment measured the throughput of a simulated [valkey-py](https://github.com/valkey-io/valkey-py) workload with 1:10 set/get -ratio while doing each scaling event. Over three trial throughput averages are +ratio while doing each scaling event. +Over three trial throughput averages are shown below. ![Chart showing queries per second over time. Atomic slot migration quickly dips and recovers, while legacy slot migration incurs a sustained dip](legacy-vs-atomic-client-impact.png) Despite atomic slot migration causing a more acute throughput hit, you can see the recovery of the client application is much faster due to far fewer topology -changes and an overall lower end-to-end latency. Each topology change needs to +changes and an overall lower end-to-end latency. +Each topology change needs to be handled by the Valkey client, so the quicker the topology changes are made, -the sooner the impact ends. By collapsing the topology changes and performing +the sooner the impact ends. +By collapsing the topology changes and performing atomic handover, atomic slot migration leads to less client impact overall than legacy slot migration. ## Under the Hood: State Machines and Control Commands To coordinate the complex dance between the two nodes, a new internal command, -[`CLUSTER SYNCSLOTS`](/commands/cluster-syncslots/), is introduced. This command +[`CLUSTER SYNCSLOTS`](/commands/cluster-syncslots/), is introduced. +This command orchestrates the state machine with the following sub-commands: - `CLUSTER SYNCSLOTS ESTABLISH SOURCE NAME SLOTSRANGE ...` @@ -287,9 +317,11 @@ slot migration from start to finish: ## Get Started Today! This new Atomic slot migration is a massive step forward for Valkey cluster -management. It provides a faster, more reliable, and overall easier mechanism +management. +It provides a faster, more reliable, and overall easier mechanism for resharding your data. So, go [download Valkey 9.0](/download/) and try Atomic Slot Migration for -yourself! A huge thank you to everyone in the community who contributed to the +yourself! +A huge thank you to everyone in the community who contributed to the design and implementation. diff --git a/content/blog/2026-01-06-valkey-helm-chart/index.md b/content/blog/2026-01-06-valkey-helm-chart/index.md index aa5eed9c..18a03862 100644 --- a/content/blog/2026-01-06-valkey-helm-chart/index.md +++ b/content/blog/2026-01-06-valkey-helm-chart/index.md @@ -10,15 +10,20 @@ featured = true featured_image = "/assets/media/featured/valkey-helm.webp" +++ -Last year, Bitnami changed how it publishes and supports many container images and Helm charts (see [charts issue #35164](https://github.com/bitnami/charts/issues/35164), [charts issue #36215](https://github.com/bitnami/charts/issues/36215), and the [Bitnami Secure Images announcement](https://news.broadcom.com/app-dev/broadcom-introduces-bitnami-secure-images-for-production-ready-containerized-applications)). Some images move behind new terms, and older tags may not be available as before. +Last year, Bitnami changed how it publishes and supports many container images and Helm charts (see [charts issue #35164](https://github.com/bitnami/charts/issues/35164), [charts issue #36215](https://github.com/bitnami/charts/issues/36215), and the [Bitnami Secure Images announcement](https://news.broadcom.com/app-dev/broadcom-introduces-bitnami-secure-images-for-production-ready-containerized-applications)). +Some images move behind new terms, and older tags may not be available as before. -If your pipelines pull Bitnami charts or images during deploys, you may experience significant operational issues: rollouts can fail with `ImagePullBackOff` or auth/404 errors, clusters can drift when staging keeps old cached images while production can't pull or resolve a different tag, and "invisible" upgrades can occur when a moved tag points to a new digest. During incidents, rollbacks may slow down or fail entirely because the old image isn't fetchable. +If your pipelines pull Bitnami charts or images during deploys, you may experience significant operational issues: rollouts can fail with `ImagePullBackOff` or auth/404 errors, clusters can drift when staging keeps old cached images while production can't pull or resolve a different tag, and "invisible" upgrades can occur when a moved tag points to a new digest. +During incidents, rollbacks may slow down or fail entirely because the old image isn't fetchable. -To reduce the impact on Valkey deployments, the community created an official, project-maintained Helm chart (request: [issue #2371](https://github.com/valkey-io/valkey/issues/2371), chart: [valkey-helm](https://github.com/valkey-io/valkey-helm)). With the official chart, you can pin chart and image versions, keep `values.yaml` in code, and upgrade on your schedule without depending on vendor policy changes. +To reduce the impact on Valkey deployments, the community created an official, project-maintained Helm chart (request: [issue #2371](https://github.com/valkey-io/valkey/issues/2371), chart: [valkey-helm](https://github.com/valkey-io/valkey-helm)). +With the official chart, you can pin chart and image versions, keep `values.yaml` in code, and upgrade on your schedule without depending on vendor policy changes. ## Why a Valkey maintained chart helps -With the official chart, you control exactly which versions you deploy, without third-party vendor policies forcing unexpected changes. Pin a chart release from the Valkey repo (for example `--version 0.9.2` from [https://github.com/valkey-io/valkey-helm](https://github.com/valkey-io/valkey-helm)) and lock the Valkey image tag in your `values.yaml`. Because the chart follows Valkey releases and docs, you can bump versions in a pull request, test in staging, then promote the same versions to production. +With the official chart, you control exactly which versions you deploy, without third-party vendor policies forcing unexpected changes. +Pin a chart release from the Valkey repo (for example `--version 0.9.2` from [https://github.com/valkey-io/valkey-helm](https://github.com/valkey-io/valkey-helm)) and lock the Valkey image tag in your `values.yaml`. +Because the chart follows Valkey releases and docs, you can bump versions in a pull request, test in staging, then promote the same versions to production. ## Capabilities in the Valkey Helm Chart @@ -38,15 +43,22 @@ For details on how to configure these capabilities and customize your deployment ## Migrating from Bitnami to the Official Valkey Chart -Because of differences in how the two charts structure resources, labels, and StatefulSets, you can't upgrade in-place from Bitnami. The charts use incompatible naming conventions and resource management approaches. Instead, deploy the official Valkey chart alongside your existing Bitnami installation and migrate the data. Plan for a brief maintenance window to ensure all writes are fully replicated before switching your applications to the new endpoints. +Because of differences in how the two charts structure resources, labels, and StatefulSets, you can't upgrade in-place from Bitnami. +The charts use incompatible naming conventions and resource management approaches. +Instead, deploy the official Valkey chart alongside your existing Bitnami installation and migrate the data. +Plan for a brief maintenance window to ensure all writes are fully replicated before switching your applications to the new endpoints. ### Before You Migrate -Review the [official chart documentation](https://github.com/valkey-io/valkey-helm/tree/main/valkey) to understand configuration options and match your current Bitnami settings. Bitnami's default configuration deploys one primary with three replicas, protected by a randomly-generated password and without TLS. The migration steps below will configure the official chart the same way — adjust the chart parameters to match your current deployment. +Review the [official chart documentation](https://github.com/valkey-io/valkey-helm/tree/main/valkey) to understand configuration options and match your current Bitnami settings. +Bitnami's default configuration deploys one primary with three replicas, protected by a randomly-generated password and without TLS. +The migration steps below will configure the official chart the same way — adjust the chart parameters to match your current deployment. -Ensure you are using Bitnami Valkey chart version 2.0.0 or higher. That release updated service names and labels from `master` to `primary` for consistency with current terminology, and the migration steps below assumes that naming convention. +Ensure you are using Bitnami Valkey chart version 2.0.0 or higher. +That release updated service names and labels from `master` to `primary` for consistency with current terminology, and the migration steps below assumes that naming convention. -The following commands should be executed from a Bash shell. You'll need `kubectl` configured to access your Kubernetes cluster, `helm` to install the new chart, and the standard utilities `grep` and `base64`. +The following commands should be executed from a Bash shell. +You'll need `kubectl` configured to access your Kubernetes cluster, `helm` to install the new chart, and the standard utilities `grep` and `base64`. ### Step 1: Find existing pods, services and namespace @@ -80,7 +92,8 @@ export PASS=$(kubectl get secret -n apps-test -l app.kubernetes.io/name=valkey,a ### Step 2: Deploy a new Valkey server -Choose an instance name for the new deployment. It must be different from the current instance to avoid overwriting resources. +Choose an instance name for the new deployment. +It must be different from the current instance to avoid overwriting resources. ```bash export NEWINSTANCE="valkey" @@ -93,9 +106,11 @@ helm repo add valkey https://valkey.io/valkey-helm/ helm repo update ``` -Create a `values.yaml` file that matches your current deployment, for details on the configuration options, check the chart [README](https://github.com/valkey-io/valkey-helm/tree/main/valkey) and [values.yaml](https://github.com/valkey-io/valkey-helm/blob/main/valkey/values.yaml). The script below will generate a file that matches the default Bitnami Valkey configuration: +Create a `values.yaml` file that matches your current deployment, for details on the configuration options, check the chart [README](https://github.com/valkey-io/valkey-helm/tree/main/valkey) and [values.yaml](https://github.com/valkey-io/valkey-helm/blob/main/valkey/values.yaml). +The script below will generate a file that matches the default Bitnami Valkey configuration: -**Note**: The example below provides the password as plain-text for simplicity. In production, store the password in a Kubernetes Secret and reference it using the `auth.usersExistingSecret` setting. +**Note**: The example below provides the password as plain-text for simplicity. +In production, store the password in a Kubernetes Secret and reference it using the `auth.usersExistingSecret` setting. ```bash cat << EOF > values.yaml @@ -178,7 +193,8 @@ new-valkey-cli info replication | grep '^\(role\|master_host\|master_link_status ### Step 4: Enter maintenance window -Pause all clients connecting to the Valkey server deployed using Bitnami's chart. The failover process will pause client writes, ensure changes are replicated, and promote the new instance to primary: +Pause all clients connecting to the Valkey server deployed using Bitnami's chart. +The failover process will pause client writes, ensure changes are replicated, and promote the new instance to primary: ```bash # Retrieve the new instance Pod IP @@ -196,7 +212,8 @@ new-valkey-cli info | grep '^role:' ### Step 5: Switch clients to new endpoints -Update all clients to use the new Valkey read-write and read-only endpoints which are exposed as services. To list the service endpoints: +Update all clients to use the new Valkey read-write and read-only endpoints which are exposed as services. +To list the service endpoints: ```bash echo "Read-Write (primary): $NEWINSTANCE.$NAMESPACE.svc.cluster.local" @@ -205,10 +222,14 @@ echo "Read-only (all instances): $NEWINSTANCE-read.$NAMESPACE.svc.cluster.local" ## What's next for Valkey Helm? -The chart [milestones](https://github.com/valkey-io/valkey-helm/milestones) outlines the planned improvements for the official Valkey Helm chart, which is being actively developed in the open at the [valkey-io/valkey-helm](https://github.com/valkey-io/valkey-helm) repository. High-availability via Sentinel for automated failover is the next upcoming feature [#22](https://github.com/valkey-io/valkey-helm/issues/22), alongside more control over data persistence [#88](https://github.com/valkey-io/valkey-helm/issues/88), followed by Cluster support [#18](https://github.com/valkey-io/valkey-helm/issues/18). +The chart [milestones](https://github.com/valkey-io/valkey-helm/milestones) outlines the planned improvements for the official Valkey Helm chart, which is being actively developed in the open at the [valkey-io/valkey-helm](https://github.com/valkey-io/valkey-helm) repository. +High-availability via Sentinel for automated failover is the next upcoming feature [#22](https://github.com/valkey-io/valkey-helm/issues/22), alongside more control over data persistence [#88](https://github.com/valkey-io/valkey-helm/issues/88), followed by Cluster support [#18](https://github.com/valkey-io/valkey-helm/issues/18). ## Get started today -If you currently rely on Bitnami, test this chart in a dev cluster and try your normal workflows. The official Valkey Helm chart provides a stable, community-maintained path forward that puts you in control of your deployment lifecycle. +If you currently rely on Bitnami, test this chart in a dev cluster and try your normal workflows. +The official Valkey Helm chart provides a stable, community-maintained path forward that puts you in control of your deployment lifecycle. -If something is missing or you encounter issues, the Valkey community is here to help. Open an issue at [valkey-io/valkey-helm](https://github.com/valkey-io/valkey-helm/issues) or reach out on the [#valkey-helm](https://valkey-oss-developer.slack.com/archives/C09JZ6N2AAV) Slack channel. Your feedback helps ensure the chart grows in the right direction for the entire community. +If something is missing or you encounter issues, the Valkey community is here to help. +Open an issue at [valkey-io/valkey-helm](https://github.com/valkey-io/valkey-helm/issues) or reach out on the [#valkey-helm](https://valkey-oss-developer.slack.com/archives/C09JZ6N2AAV) Slack channel. +Your feedback helps ensure the chart grows in the right direction for the entire community. diff --git a/content/blog/2026-01-22-2025-year-end/index.md b/content/blog/2026-01-22-2025-year-end/index.md index 4b6f29c6..0725a894 100644 --- a/content/blog/2026-01-22-2025-year-end/index.md +++ b/content/blog/2026-01-22-2025-year-end/index.md @@ -7,10 +7,12 @@ authors= ["kyledvs", "crystalpham"] blog_type = ["Community Highlight"] +++ -As we kick off 2026, it’s a great moment to pause, reflect, and celebrate what the Valkey project and its community has accomplished together. This past year marked an important chapter for Valkey, one defined by growth, collaboration, and a shared commitment to building an open, high-performance key-value store for everyone. +As we kick off 2026, it’s a great moment to pause, reflect, and celebrate what the Valkey project and its community has accomplished together. +This past year marked an important chapter for Valkey, one defined by growth, collaboration, and a shared commitment to building an open, high-performance key-value store for everyone. ## 2025 Key Milestones -This past year brought meaningful progress across the Valkey ecosystem. Some highlights: +This past year brought meaningful progress across the Valkey ecosystem. +Some highlights: * [Valkey bundle release](https://valkey.io/blog/valkey-bundle-one-stop-shop-for-low-latency-modern-applications/): which brought together the modules @@ -33,25 +35,33 @@ Valkey 9.0 brings innovation, long-requested features, and improvements to class * [Valkey swift](https://valkey.io/blog/valkey-swift/) ## Community Growth -In 2025, the Valkey project had 346 active contributors which are individuals who performed activities such as commits, issues, or pull requests during the selected time period. (Source: [LFX analytics](https://insights.linuxfoundation.org/project/valkey?timeRange=past365days&start=2025-01-15&end=2026-01-15)) +In 2025, the Valkey project had 346 active contributors which are individuals who performed activities such as commits, issues, or pull requests during the selected time period. +(Source: [LFX analytics](https://insights.linuxfoundation.org/project/valkey?timeRange=past365days&start=2025-01-15&end=2026-01-15)) ## 2025 events recap -We hosted our first Valkey conference, [Keyspace Amsterdam](https://events.linuxfoundation.org/keyspace/), in 2025. Here are few photos from the event. +We hosted our first Valkey conference, [Keyspace Amsterdam](https://events.linuxfoundation.org/keyspace/), in 2025. +Here are few photos from the event. ![Keyspace-Amsterdam](IMG_9.jpeg) ![Keyspace-Amsterdam](IMG_10.jpeg) ![Keyspace-Amsterdam](IMG_11.jpeg) -While in [Keyspace Beijing](https://valkey.io/events/keyspace-beijing-2025/), some of the Valkey community members joined a panel to share insights on Valkey and real‑world adoption. More than 65+ in-person and 1,000+ on-stream consisting of developers, SREs, and DevOps professionals came together to exchange ideas, share best practices, and explore new use cases powered by Valkey. +While in [Keyspace Beijing](https://valkey.io/events/keyspace-beijing-2025/), some of the Valkey community members joined a panel to share insights on Valkey and real‑world adoption. +More than 65+ in-person and 1,000+ on-stream consisting of developers, SREs, and DevOps professionals came together to exchange ideas, share best practices, and explore new use cases powered by Valkey. ![Keyspace-Beijing](image3.jpg) ![Keyspace-Beijing](image4.jpg) -At [AWS re:Invent](https://reinvent.awsevents.com/) in Las Vegas, Valkey took over the Strip’s iconic Taco Bell Cantina for the three-floor House of Valkey, turning the conference into a true party hub. Attendees enjoyed deep technical conversations, live performers, giveaways, and exclusive swag. +At [AWS re:Invent](https://reinvent.awsevents.com/) in Las Vegas, Valkey took over the Strip’s iconic Taco Bell Cantina for the three-floor House of Valkey, turning the conference into a true party hub. +Attendees enjoyed deep technical conversations, live performers, giveaways, and exclusive swag. ![House-of-Valkey](image1.png) ![House-of-Valkey](image2.png) -At [Open Source Summit Japan](https://www.youtube.com/watch?v=8-trRjBr81I&list=PLbzoR-pLrL6pRN6kobVnmu0rY2RLLczAj), Madelyn Olson of the Valkey Technical Steering Committee and Roberto Luna Rojas, Sr. Developer Advocate, presented sessions on open source governance, Linux packaging, community transitions, and GitHub best practices. [Watch the session here.](https://www.youtube.com/watch?v=eW3uLjIj69g) +At [Open Source Summit Japan](https://www.youtube.com/watch?v=8-trRjBr81I&list=PLbzoR-pLrL6pRN6kobVnmu0rY2RLLczAj), Madelyn Olson of the Valkey Technical Steering Committee and Roberto Luna Rojas, Sr. Developer Advocate, presented sessions on open source governance, Linux packaging, community transitions, and GitHub best practices. +[Watch the session here.](https://www.youtube.com/watch?v=eW3uLjIj69g) -Beyond those key highlights, the Valkey team and community stayed active throughout the year, showing up at many events around the world. [SymfonyCon Amsterdam](https://live.symfony.com/2025-amsterdam-con/) added a playful splash to the calendar as the Symfony community marked its 20th anniversary with bouncy balls, ball pits, and cake. Valkey also made its mark at [NDC London](https://ndcconferences.com/), where attendees met Sr. OSS Developer Advocate, Nigel Brown and stocked up on Valkey beanies and stickers. Valkey’s presence extended even further across [PyCon Africa](https://za.pycon.org/), [PyCon Australia](https://2025.pycon.org.au/), [Laracon](https://laracon.us/), [Aspara](https://www.alibabacloud.com/en/apsara-conference?_p_lc=1), and more continuing to build meaningful connections and celebrate the growing global Valkey community. +Beyond those key highlights, the Valkey team and community stayed active throughout the year, showing up at many events around the world. +[SymfonyCon Amsterdam](https://live.symfony.com/2025-amsterdam-con/) added a playful splash to the calendar as the Symfony community marked its 20th anniversary with bouncy balls, ball pits, and cake. +Valkey also made its mark at [NDC London](https://ndcconferences.com/), where attendees met Sr. OSS Developer Advocate, Nigel Brown and stocked up on Valkey beanies and stickers. +Valkey’s presence extended even further across [PyCon Africa](https://za.pycon.org/), [PyCon Australia](https://2025.pycon.org.au/), [Laracon](https://laracon.us/), [Aspara](https://www.alibabacloud.com/en/apsara-conference?_p_lc=1), and more continuing to build meaningful connections and celebrate the growing global Valkey community. ![valkey-events](image5.jpg) ![valkey-events](image6.jpg) ![valkey-events](image7.jpg) @@ -82,7 +92,8 @@ We’re excited about what’s ahead and committed to evolving the Valkey projec ## Thank You -Thank you to everyone who contributed code, tested releases, filed issues, shared feedback, or adopted Valkey in production. Your continued involvement strengthens and advances the Valkey project. +Thank you to everyone who contributed code, tested releases, filed issues, shared feedback, or adopted Valkey in production. +Your continued involvement strengthens and advances the Valkey project. ## Get Involved diff --git a/content/blog/2026-02-04-valkey-newsletter-new/index.md b/content/blog/2026-02-04-valkey-newsletter-new/index.md index 3beab179..77c5e2e1 100644 --- a/content/blog/2026-02-04-valkey-newsletter-new/index.md +++ b/content/blog/2026-02-04-valkey-newsletter-new/index.md @@ -8,7 +8,8 @@ blog_type = ["Announcements"] +++ Valkey is moving fast and the easiest way to stay ahead is to [subscribe](/blog/valkey-newsletter-new/#email-signup) to the official Valkey newsletter. -From new releases and roadmap milestones to community highlights and upcoming events, our newsletter is your single source of truth for everything happening across the Valkey ecosystem. No digging, no second-guessing — just the updates that matter, delivered straight to you. +From new releases and roadmap milestones to community highlights and upcoming events, our newsletter is your single source of truth for everything happening across the Valkey ecosystem. +No digging, no second-guessing — just the updates that matter, delivered straight to you. When you subscribe, you’ll get: * Breaking updates on new releases, features, and project announcements. @@ -21,4 +22,5 @@ If you care about Valkey — or rely on it — this is how you stay in the loop. 👉 [Subscribe](/blog/valkey-newsletter-new/#email-signup) now and stay connected. Subscription is open to everyone, so invite a teammate, a collaborator, or any open source enthusiast who doesn’t want to miss what’s coming next. -Valkey is growing! Make sure you’re part of the conversation. +Valkey is growing! +Make sure you’re part of the conversation. diff --git a/content/blog/2026-02-19-operational-lessons/index.md b/content/blog/2026-02-19-operational-lessons/index.md index d860b6d7..972ec430 100644 --- a/content/blog/2026-02-19-operational-lessons/index.md +++ b/content/blog/2026-02-19-operational-lessons/index.md @@ -11,9 +11,11 @@ featured = true featured_image = "/assets/media/featured/random-04.webp" +++ -Engineers operating large-scale systems face a consistent challenge: what works at moderate scale often breaks in subtle ways as systems grow. Recently, contributors and platform teams gathered at the [Unlocked Conference](https://www.unlockedconf.io) to compare notes on what actually happens when Valkey is under real production load. +Engineers operating large-scale systems face a consistent challenge: what works at moderate scale often breaks in subtle ways as systems grow. +Recently, contributors and platform teams gathered at the [Unlocked Conference](https://www.unlockedconf.io) to compare notes on what actually happens when Valkey is under real production load. -What follows are high-level observations from the day — directional insights that kept resurfacing across talks, questions, and small-group discussions. For teams running or evaluating Valkey, these represent the operational questions large-scale deployments are asking right now. +What follows are high-level observations from the day — directional insights that kept resurfacing across talks, questions, and small-group discussions. +For teams running or evaluating Valkey, these represent the operational questions large-scale deployments are asking right now. ## Scale Changes the Nature of Problems @@ -21,57 +23,85 @@ As [Khawaja Shams](https://www.linkedin.com/in/kshams/) put it during the openin > "Scale exposes all truths." -Across multiple conversations throughout the day, the recurring theme was what changes once systems cross certain thresholds. Latency that once felt negligible becomes visible. Client behavior that looked harmless begins to shape tail latencies. Operational shortcuts that worked at small volumes introduce instability when workloads grow. +Across multiple conversations throughout the day, the recurring theme was what changes once systems cross certain thresholds. +Latency that once felt negligible becomes visible. +Client behavior that looked harmless begins to shape tail latencies. +Operational shortcuts that worked at small volumes introduce instability when workloads grow. -The takeaway was that scale changes *which questions you should be asking*. Conversations shift from "does it work?" to "what happens when it's stressed?" +The takeaway was that scale changes *which questions you should be asking*. +Conversations shift from "does it work?" to "what happens when it's stressed?" -This aligns with recent work in Valkey such as [Atomic Slot Migration](https://valkey.io/blog/atomic-slot-migration/), [I/O threading improvements](https://valkey.io/blog/valkey-8-1-0-ga/#i-o-threads-improvements) introduced in Valkey 8.0, and [copy-avoidance paths](https://github.com/valkey-io/valkey/pull/2078) for large replies. These changes reflect lessons learned at scale, where larger clusters, heavier payloads, and higher concurrency expose constraints that smaller deployments rarely encounter. +This aligns with recent work in Valkey such as [Atomic Slot Migration](https://valkey.io/blog/atomic-slot-migration/), [I/O threading improvements](https://valkey.io/blog/valkey-8-1-0-ga/#i-o-threads-improvements) introduced in Valkey 8.0, and [copy-avoidance paths](https://github.com/valkey-io/valkey/pull/2078) for large replies. +These changes reflect lessons learned at scale, where larger clusters, heavier payloads, and higher concurrency expose constraints that smaller deployments rarely encounter. ## Predictability Over Peak Throughput -Another frequently mentioned topic was reducing tail latency rather than maximizing peak throughput. A large gap between your P99 and P999 latency reveals instability caused by issues such as bursty traffic, background work, large payloads, or similar workload characteristics. The practical lesson is that outages often come from edge cases rather than the happy path. +Another frequently mentioned topic was reducing tail latency rather than maximizing peak throughput. +A large gap between your P99 and P999 latency reveals instability caused by issues such as bursty traffic, background work, large payloads, or similar workload characteristics. +The practical lesson is that outages often come from edge cases rather than the happy path. [Madelyn Olson](https://www.linkedin.com/in/madelyn-olson-valkey/) shared the five guiding performance principles at Valkey: ![Valkey Performance Principles Screenshot](valkey-performance-principles.jpg) -With *"provide predictable user latency"* listed as the second principle, it's clear that consistency is a deliberate priority for the project. It's treated as a first-order goal alongside scalability and simplicity. +With *"provide predictable user latency"* listed as the second principle, it's clear that consistency is a deliberate priority for the project. +It's treated as a first-order goal alongside scalability and simplicity. -A small percentage of multi-megabyte values can distort tail percentiles even when average latency and overall throughput appear stable — behavior that Khawaja Shams explored in a [deep dive on large object handling](https://www.gomomento.com/blog/large-objects-ruin-the-party-valkey-9-tames-them/). During her systems engineering session, [Daniela Miao](https://www.linkedin.com/in/danielamiao/) emphasized a similar principle: performance work often begins by raising the floor of latency behavior before chasing peak numbers. Building predictable systems requires designing for these edge cases explicitly rather than assuming "typical" request sizes. +A small percentage of multi-megabyte values can distort tail percentiles even when average latency and overall throughput appear stable — behavior that Khawaja Shams explored in a [deep dive on large object handling](https://www.gomomento.com/blog/large-objects-ruin-the-party-valkey-9-tames-them/). +During her systems engineering session, [Daniela Miao](https://www.linkedin.com/in/danielamiao/) emphasized a similar principle: performance work often begins by raising the floor of latency behavior before chasing peak numbers. +Building predictable systems requires designing for these edge cases explicitly rather than assuming "typical" request sizes. -Valkey 9.0 introduced reply copy-avoidance paths for large values, significantly reducing the time the main event loop can be blocked by multi-megabyte responses. It's a concrete example of the broader shift from chasing peak numbers to bounding worst-case behavior so latency distributions remain stable as workloads evolve. +Valkey 9.0 introduced reply copy-avoidance paths for large values, significantly reducing the time the main event loop can be blocked by multi-megabyte responses. +It's a concrete example of the broader shift from chasing peak numbers to bounding worst-case behavior so latency distributions remain stable as workloads evolve. ## Payload Size and Bandwidth Shape Outcomes -While the prior discussion focused on latency variance inside the engine, another recurring theme was variance introduced by traffic moving across the network. With high-performance systems, bottlenecks often emerge from the *shape* of traffic rather than raw CPU or memory limits. At Unlocked, teams described systems where CPU and memory looked healthy, yet latency variance and node failures increased once payload sizes grew or request patterns shifted. +While the prior discussion focused on latency variance inside the engine, another recurring theme was variance introduced by traffic moving across the network. +With high-performance systems, bottlenecks often emerge from the *shape* of traffic rather than raw CPU or memory limits. +At Unlocked, teams described systems where CPU and memory looked healthy, yet latency variance and node failures increased once payload sizes grew or request patterns shifted. -Nodes can fail not from CPU exhaustion or memory pressure alone, but from the sheer volume of bytes moving across the network. As Ignacio "Nacho" Alvarez from Mercado Libre put it: +Nodes can fail not from CPU exhaustion or memory pressure alone, but from the sheer volume of bytes moving across the network. +As Ignacio "Nacho" Alvarez from Mercado Libre put it: > "Nodes dying because of the volume of bytes moving in and out was the hardest problem to solve." Bandwidth becomes a primary bottleneck and incident driver — a reminder that network throughput and payload variability can dominate system behavior long before standard utilization metrics indicate trouble. -Instead of asking "are we out of CPU or memory?", teams found themselves asking "what are we actually sending over the wire?" Payload size distribution, network behavior, and client request patterns frequently ended up being primary cost drivers compared to processor utilization alone. Nacho recounted that monitoring how large those requests were and how unevenly they arrived were crucial to Mercado Libre's stability. +Instead of asking "are we out of CPU or memory?", teams found themselves asking "what are we actually sending over the wire?" +Payload size distribution, network behavior, and client request patterns frequently ended up being primary cost drivers compared to processor utilization alone. +Nacho recounted that monitoring how large those requests were and how unevenly they arrived were crucial to Mercado Libre's stability. -This awareness is visible in recent Valkey releases as well. Valkey 9.0 added [pipeline memory prefetching](https://github.com/valkey-io/valkey/pull/2092) to smooth bursty workloads and [Multipath TCP](https://github.com/valkey-io/valkey/pull/1811) support to reduce network-induced latency, alongside [large-cluster resilience improvements](https://valkey.io/blog/1-billion-rps/) aimed at keeping end-to-end latency stable at higher node counts. Taken together, these changes point less toward chasing peak throughput numbers and more toward limiting the impact of uneven traffic and network variability. +This awareness is visible in recent Valkey releases as well. +Valkey 9.0 added [pipeline memory prefetching](https://github.com/valkey-io/valkey/pull/2092) to smooth bursty workloads and [Multipath TCP](https://github.com/valkey-io/valkey/pull/1811) support to reduce network-induced latency, alongside [large-cluster resilience improvements](https://valkey.io/blog/1-billion-rps/) aimed at keeping end-to-end latency stable at higher node counts. +Taken together, these changes point less toward chasing peak throughput numbers and more toward limiting the impact of uneven traffic and network variability. ## Community Participation Is the Multiplier -One of the strongest signals coming out of Unlocked wasn’t a feature announcement or benchmark — it was how openly engineers were exchanging operational lessons. Maintainers, platform teams, and end users were comparing migration strategies, performance regressions, and tooling approaches throughout the day. As Khawaja put it during the opening remarks, the goal is to ”*share what you learn and talk about the outages you caused — we’re among friends.*” +One of the strongest signals coming out of Unlocked wasn’t a feature announcement or benchmark — it was how openly engineers were exchanging operational lessons. +Maintainers, platform teams, and end users were comparing migration strategies, performance regressions, and tooling approaches throughout the day. +As Khawaja put it during the opening remarks, the goal is to ”*share what you learn and talk about the outages you caused — we’re among friends.*” -This culture of openness reflects what’s happening in Valkey itself. According to the [Valkey 2025 Year-End Review](https://valkey.io/blog/2025-year-end/), more than *300 contributors* authored commits, reviewed code, or opened issues over the course of the year. Participation here spanned testing releases, proposing features, building tooling, documenting deployment patterns, and sharing production lessons that shape future improvements. +This culture of openness reflects what’s happening in Valkey itself. +According to the [Valkey 2025 Year-End Review](https://valkey.io/blog/2025-year-end/), more than *300 contributors* authored commits, reviewed code, or opened issues over the course of the year. +Participation here spanned testing releases, proposing features, building tooling, documenting deployment patterns, and sharing production lessons that shape future improvements. -For operators, that amount of involvement means bugs are discovered across a wider variety of real workloads, migration paths are validated by multiple organizations before becoming common practice, and performance fixes are grounded in production behavior rather than synthetic benchmarks alone. Stability improvements and tooling changes arrive already pressure-tested across different infrastructure types and scale points. +For operators, that amount of involvement means bugs are discovered across a wider variety of real workloads, migration paths are validated by multiple organizations before becoming common practice, and performance fixes are grounded in production behavior rather than synthetic benchmarks alone. +Stability improvements and tooling changes arrive already pressure-tested across different infrastructure types and scale points. -In this sense, contributions act as a multiplier. Shared experience compounds into better tooling and more predictable systems across the ecosystem. What was visible in hallway conversations and session Q&A at Unlocked mirrors what’s happening in these repositories every day: a project evolving through collective operational knowledge. +In this sense, contributions act as a multiplier. +Shared experience compounds into better tooling and more predictable systems across the ecosystem. +What was visible in hallway conversations and session Q&A at Unlocked mirrors what’s happening in these repositories every day: a project evolving through collective operational knowledge. ## What This Means for Operators Across sessions and discussions, several operational priorities surfaced repeatedly for teams running or evaluating Valkey: -- Monitor P99 and P999 latency, not just medians. Tail percentiles reveal the edge cases that cause outages while median latency still looks stable. -- Instrument payload size distribution alongside traditional metrics. Bandwidth saturation often appears before CPU or memory pressure signals trouble. -- Treat traffic shape as a first-class metric. Bursty workloads, background work, and large responses frequently explain instability better than raw request counts. +- Monitor P99 and P999 latency, not just medians. + Tail percentiles reveal the edge cases that cause outages while median latency still looks stable. +- Instrument payload size distribution alongside traditional metrics. + Bandwidth saturation often appears before CPU or memory pressure signals trouble. +- Treat traffic shape as a first-class metric. + Bursty workloads, background work, and large responses frequently explain instability better than raw request counts. These recommendations reflect the operational questions teams managing Valkey at scale are actively solving. diff --git a/content/blog/2026-02-25-introducing-valkey-admin/index.md b/content/blog/2026-02-25-introducing-valkey-admin/index.md index a6de5d29..1b9dc8af 100644 --- a/content/blog/2026-02-25-introducing-valkey-admin/index.md +++ b/content/blog/2026-02-25-introducing-valkey-admin/index.md @@ -11,13 +11,25 @@ featured = true featured_image = "/blog/introducing-valkey-admin/images/hero.jpg" +++ -Do you ever wonder why we still manage Valkey the same way we always have? The honest answer is that it works. And once something works, it tends to stick around. - -You spin up a Valkey cluster. Maybe it's three nodes. Maybe it's thirty. You need to inspect a key, so you open a terminal, start `valkey-cli`, connect, run a command, read the output, then do it again. If you need to understand what's happening across the cluster, that usually means opening more terminals. More SSH sessions. More mental bookkeeping. - -At some point, you're carrying around a model of the cluster that only exists in your head or maybe on a napkin next to your desk. It's easy to check a key on one node and assume it looks the same everywhere else. It's also an easy way to make mistakes. - -This is how many of us learned to work with Valkey, and it's still how a lot of day-to-day debugging happens today. Familiarity, though, doesn't always mean efficiency. In practice, it often means friction we've just learned to tolerate. +Do you ever wonder why we still manage Valkey the same way we always have? +The honest answer is that it works. +And once something works, it tends to stick around. + +You spin up a Valkey cluster. +Maybe it's three nodes. +Maybe it's thirty. +You need to inspect a key, so you open a terminal, start `valkey-cli`, connect, run a command, read the output, then do it again. +If you need to understand what's happening across the cluster, that usually means opening more terminals. +More SSH sessions. +More mental bookkeeping. + +At some point, you're carrying around a model of the cluster that only exists in your head or maybe on a napkin next to your desk. +It's easy to check a key on one node and assume it looks the same everywhere else. +It's also an easy way to make mistakes. + +This is how many of us learned to work with Valkey, and it's still how a lot of day-to-day debugging happens today. +Familiarity, though, doesn't always mean efficiency. +In practice, it often means friction we've just learned to tolerate. Enter Valkey Admin. @@ -26,51 +38,79 @@ Much of this thinking was shared recently by [Rong Zhang](https://www.linkedin.c ## What is Valkey Admin? Valkey Admin is an application that gives you a direct, visual interface to your Valkey clusters. -Immediately upon connecting, you can see the shape of the cluster itself: which nodes are primaries, which are replicas, and how individual nodes are behaving. From there, you can drill into node dashboards, view key metrics, and understand what's happening without reconstructing the picture manually. +Immediately upon connecting, you can see the shape of the cluster itself: which nodes are primaries, which are replicas, and how individual nodes are behaving. +From there, you can drill into node dashboards, view key metrics, and understand what's happening without reconstructing the picture manually. -Key management is a first-class workflow. You can browse keys interactively, inspect values, check TTLs, look at sizes and data structures, modify or remove keys, and search or filter by prefix. All Valkey data types are supported, and the goal is to make inspection and troubleshooting as straightforward as possible. +Key management is a first-class workflow. +You can browse keys interactively, inspect values, check TTLs, look at sizes and data structures, modify or remove keys, and search or filter by prefix. +All Valkey data types are supported, and the goal is to make inspection and troubleshooting as straightforward as possible. -Valkey Admin also includes tools for diagnosing performance problems. It can identify hot keys using low-overhead analysis when LFU is enabled, or fall back to configurable sampling when it isn't. Command logs surface slow commands, large requests, and large replies, making it easier to understand why latency changes instead of just noticing that it did. +Valkey Admin also includes tools for diagnosing performance problems. +It can identify hot keys using low-overhead analysis when LFU is enabled, or fall back to configurable sampling when it isn't. +Command logs surface slow commands, large requests, and large replies, making it easier to understand why latency changes instead of just noticing that it did. ![Screenshot of hot key monitoring in Valkey Admin](images/hot-key-monitoring.jpg) -The application also embeds the `valkey-cli`. You run the same commands you already know, but with added context, including the ability to diff results between runs, so changes in state are highly visible. +The application also embeds the `valkey-cli`. +You run the same commands you already know, but with added context, including the ability to diff results between runs, so changes in state are highly visible. -This isn't meant to replace a full monitoring stack, and it's not trying to be a wall of dashboards. If you already have Grafana and alerting in place, Valkey Admin lives somewhere between ad-hoc CLI usage and long-term metrics. It's the tool you reach for when you need to understand what's happening right now. +This isn't meant to replace a full monitoring stack, and it's not trying to be a wall of dashboards. +If you already have Grafana and alerting in place, Valkey Admin lives somewhere between ad-hoc CLI usage and long-term metrics. +It's the tool you reach for when you need to understand what's happening right now. -This type of admin tooling is part of the operational surface of a datastore. For systems that run critical workloads, the tooling must be inspectable, extensible, and governed by the same open principles as the system itself. Rather than relying on a black-box admin interface with opaque trade-offs and closed roadmaps, Valkey Admin is built to be something the community can understand and evolve over time. +This type of admin tooling is part of the operational surface of a datastore. +For systems that run critical workloads, the tooling must be inspectable, extensible, and governed by the same open principles as the system itself. +Rather than relying on a black-box admin interface with opaque trade-offs and closed roadmaps, Valkey Admin is built to be something the community can understand and evolve over time. ## When things go wrong -If you've ever debugged a cache issue late at night, you know how quickly context switching becomes the real problem. The issue itself is already stressful. The last thing you want at 2am is to double-check which node you're connected to or mentally reconstruct slot ownership across a cluster. +If you've ever debugged a cache issue late at night, you know how quickly context switching becomes the real problem. +The issue itself is already stressful. +The last thing you want at 2am is to double-check which node you're connected to or mentally reconstruct slot ownership across a cluster. -The same friction shows up during development. Verifying cache behavior often means writing a throwaway script, running a handful of commands, or re-learning `SCAN` syntax just to confirm that something worked. Most of us already have at least one of those scripts lying around. Writing another one every time isn't a great use of time or effort. +The same friction shows up during development. +Verifying cache behavior often means writing a throwaway script, running a handful of commands, or re-learning `SCAN` syntax just to confirm that something worked. +Most of us already have at least one of those scripts lying around. +Writing another one every time isn't a great use of time or effort. -Valkey Admin isn't an attempt to replace the command line. It's an acknowledgment that some workflows are easier, faster, and less error-prone when you can see what's happening instead of inferring it. +Valkey Admin isn't an attempt to replace the command line. +It's an acknowledgment that some workflows are easier, faster, and less error-prone when you can see what's happening instead of inferring it. ## Early design choices -One of the key technical decisions in Valkey Admin is the use of [Valkey GLIDE](https://github.com/valkey-io/valkey-glide) for the client layer. GLIDE provides a shared, high-performance core with thin language bindings, avoiding the need to re-implement protocol handling, clustering logic, and connection management independently in every language. +One of the key technical decisions in Valkey Admin is the use of [Valkey GLIDE](https://github.com/valkey-io/valkey-glide) for the client layer. +GLIDE provides a shared, high-performance core with thin language bindings, avoiding the need to re-implement protocol handling, clustering logic, and connection management independently in every language. -GLIDE's architecture is a [strong fit for admin and observability workloads](https://aws.amazon.com/about-aws/whats-new/2025/06/valkey-glide-2-0-go-opentelemetry-pipeline-batching) that involve fan-out access patterns and high concurrency. It provides more predictable behavior, tighter alignment with Valkey's internals, and a simpler foundation for building production-grade tooling at scale. +GLIDE's architecture is a [strong fit for admin and observability workloads](https://aws.amazon.com/about-aws/whats-new/2025/06/valkey-glide-2-0-go-opentelemetry-pipeline-batching) that involve fan-out access patterns and high concurrency. +It provides more predictable behavior, tighter alignment with Valkey's internals, and a simpler foundation for building production-grade tooling at scale. -These same considerations shaped how Valkey Admin is delivered. It is built with [React](https://react.dev/) and [TypeScript](https://www.typescriptlang.org/), and runs as an [Electron](https://www.electronjs.org/) application on macOS and Linux, with support for Windows via WSL. That choice allows the tool to remain fast, responsive, and close to the developer's workflow, without requiring a separate deployment or service to get started. +These same considerations shaped how Valkey Admin is delivered. +It is built with [React](https://react.dev/) and [TypeScript](https://www.typescriptlang.org/), and runs as an [Electron](https://www.electronjs.org/) application on macOS and Linux, with support for Windows via WSL. +That choice allows the tool to remain fast, responsive, and close to the developer's workflow, without requiring a separate deployment or service to get started. The project is fully open source, and contributions are encouraged both to improve the tool itself and to adapt it to the different environments Valkey runs in. ## Where it's headed -Valkey Admin focuses on reducing day-to-day overhead of operating cache clusters, not trying to be an all-encompassing admin platform. During the Unlocked talk, Zhang was careful not to over-promise a long-term roadmap, instead pointing to areas the community is actively exploring. +Valkey Admin focuses on reducing day-to-day overhead of operating cache clusters, not trying to be an all-encompassing admin platform. +During the Unlocked talk, Zhang was careful not to over-promise a long-term roadmap, instead pointing to areas the community is actively exploring. > *"Valkey Admin is about solving the day-to-day problems Valkey users face understanding cluster topology, identifying performance bottlenecks, and managing keys without having to piece everything together by hand."* > Rong Zhang, Product Manager, AWS (Unlocked Conference) -Based on early feedback, the focus areas include deeper analysis of large keys, improved visualization for complex data types, stronger auth and access control, and a web-native version for Kubernetes or Docker Compose. According to Zhang, there's also interest in AI-assisted observability that explains what changed and why, assisting operators at an entirely new level. +Based on early feedback, the focus areas include deeper analysis of large keys, improved visualization for complex data types, stronger auth and access control, and a web-native version for Kubernetes or Docker Compose. +According to Zhang, there's also interest in AI-assisted observability that explains what changed and why, assisting operators at an entirely new level. ## Getting started -Valkey Admin is currently in preview, but you can try it today by cloning the [repository](https://github.com/valkey-io/valkey-admin) and running `./quickstart.sh`. The script installs dependencies, builds the application, and spins up a local Valkey cluster so there's something to connect to immediately. A few minutes later, you have a working desktop app. +Valkey Admin is currently in preview, but you can try it today by cloning the [repository](https://github.com/valkey-io/valkey-admin) and running `./quickstart.sh`. +The script installs dependencies, builds the application, and spins up a local Valkey cluster so there's something to connect to immediately. +A few minutes later, you have a working desktop app. -From there, you add a connection to your own Valkey instance and start working. There's no lengthy setup process and no configuration file you need to get exactly right before the tool becomes useful. +From there, you add a connection to your own Valkey instance and start working. +There's no lengthy setup process and no configuration file you need to get exactly right before the tool becomes useful. -There's also a web version available via `./quickstart-web.sh`. It doesn't include some Electron-specific features, such as hot key tracking and command logs, but it's useful for quick inspection during development. +There's also a web version available via `./quickstart-web.sh`. +It doesn't include some Electron-specific features, such as hot key tracking and command logs, but it's useful for quick inspection during development. -Most of us would rather spend time building systems than managing infrastructure details by hand. If Valkey Admin helps reduce that overhead, then it's doing its job. +Most of us would rather spend time building systems than managing infrastructure details by hand. +If Valkey Admin helps reduce that overhead, then it's doing its job. -If you manage Valkey clusters and find yourself bouncing between terminals more than you'd like, it's worth trying. And if something feels awkward or incomplete, [opening an issue](https://github.com/valkey-io/valkey-admin/issues) or contributing back is part of how the tool improves. +If you manage Valkey clusters and find yourself bouncing between terminals more than you'd like, it's worth trying. +And if something feels awkward or incomplete, [opening an issue](https://github.com/valkey-io/valkey-admin/issues) or contributing back is part of how the tool improves. diff --git a/content/blog/2026-03-10-valkey-search-1_2/index.md b/content/blog/2026-03-10-valkey-search-1_2/index.md index 42b4f434..6d4f3630 100644 --- a/content/blog/2026-03-10-valkey-search-1_2/index.md +++ b/content/blog/2026-03-10-valkey-search-1_2/index.md @@ -16,10 +16,14 @@ Valkey Search enables searching terabytes of data with latency as low as microse Until now, Valkey Search focused on vector similarity, enabling a wide range of workloads such as semantic search and AI workloads (see [launch blog](https://valkey.io/blog/introducing-valkey-search/)). But if you needed to filter your data by numeric attributes such as price ranges, match on exact attributes such as color or size, or search within text attributes such as product reviews, you had to build that yourself. -With Valkey Search 1.2, that changes. In this post, we'll walk through what's new, show how it works, and explore the use cases these capabilities unlock. +With Valkey Search 1.2, that changes. +In this post, we'll walk through what's new, show how it works, and explore the use cases these capabilities unlock. ## Searching Your Valkey Data -Valkey Search uses indexes to organize your data by searchable attributes, so queries can find matching keys without scanning every document. To get started with search, you first define an index over the attributes you want to search. Valkey Search supports four query types — full-text, tag, numeric range, and vector similarity, which you can use independently or combine with boolean operators. For example, consider an e-commerce retailer Acme.inc using Valkey to store their product catalog who creates an index like this: +Valkey Search uses indexes to organize your data by searchable attributes, so queries can find matching keys without scanning every document. +To get started with search, you first define an index over the attributes you want to search. +Valkey Search supports four query types — full-text, tag, numeric range, and vector similarity, which you can use independently or combine with boolean operators. +For example, consider an e-commerce retailer Acme.inc using Valkey to store their product catalog who creates an index like this: ``` FT.CREATE product_index ON HASH SCHEMA description TEXT @@ -29,7 +33,8 @@ FT.CREATE product_index ON HASH SCHEMA rating NUMERIC SORTABLE review vector HNSW 6 TYPE FLOAT32 DIM 768 DISTANCE_METRIC COSINE ``` -This creates an index called `product_index` over hash keys, indexing `description` as a full-text searchable attribute, `color` and `manufacturer` as exact-match tags, `price` and `rating` as sortable numeric attributes, and `review` as a vector attribute for similarity search. With this index in place, you can now query across all four types: +This creates an index called `product_index` over hash keys, indexing `description` as a full-text searchable attribute, `color` and `manufacturer` as exact-match tags, `price` and `rating` as sortable numeric attributes, and `review` as a vector attribute for similarity search. +With this index in place, you can now query across all four types: **Full-text Search:** Full-text search (FTS) helps you retrieve relevant documents by matching words and phrases within larger text when you do not have an exact identifier or a structured attribute value. You can use full-text queries to retrieve documents by matching keywords, phrases, or patterns such as prefix, suffix, wildcard, and fuzzy queries (typo-tolerant), anywhere in your document index. @@ -53,7 +58,8 @@ This returns matching products with all their indexed attributes: 4) "product:1042" ... ``` -**Tag Search:** Tag queries filter documents by checking attribute values for exact matches against the provided value. Tag attributes are best for structured categorical data where queries rely on exact value matching. +**Tag Search:** Tag queries filter documents by checking attribute values for exact matches against the provided value. +Tag attributes are best for structured categorical data where queries rely on exact value matching. You can treat tag as a specialized alternative to text for attributes that you want to match as discrete values such as userIDs, categories, and status flags. This makes tag a great fit to express conditions like "category is earphones **and** size is small, but color is **not** red." Tag filtering shines in use cases such as streaming and gaming platforms to retrieve metadata by exact identifiers such as user ID, region, or genre to power real-time stats and fast in-app filtering. @@ -62,7 +68,8 @@ For example, when a shopper on Acme.inc filters for earphones manufactured by "s ``` FT.SEARCH product_index "@manufacturer:{shopnow} @color:{white}" ``` -**Numeric Range Queries:** Range search retrieves documents by filtering and sorting over numeric and time attributes using comparisons such as greater than, less than, and between. This makes it ideal for applications that query attributes such as scores, price bands, time windows, inventory thresholds, distances, and timestamps. +**Numeric Range Queries:** Range search retrieves documents by filtering and sorting over numeric and time attributes using comparisons such as greater than, less than, and between. +This makes it ideal for applications that query attributes such as scores, price bands, time windows, inventory thresholds, distances, and timestamps. Valkey Search supports range-based queries with microsecond latencies, making it a strong fit for real-time leaderboards where you rank and retrieve content by numeric metrics such as scores, downloads, or engagement with updates reflected immediately. Range queries are also well suited for financial transactions or time series data, enabling ultra-fast lookups by amounts, fees, date ranges, and risk scores to power customer-facing applications, personalization, or real-time monitoring. For example, when a shopper on Acme.inc sets the price slider to $50–$100 and filters by 4-star and above, the app can query the numeric index: @@ -70,7 +77,8 @@ For example, when a shopper on Acme.inc sets the price slider to $50–$100 and FT.SEARCH product_index "@price:[50 100] @rating:[4 +inf]" ``` **Hybrid Queries:** Valkey Search lets you combine full-text, tag, numeric range, and vector similarity clauses in a single query so you can retrieve relevant results. -Hybrid queries are ideal for applications that need to query across multiple attribute types in one request. For example, a product discovery query might combine vector similarity over reviews for semantic meaning, a tag filter for category and availability, a numeric range for price, and full-text search over product titles — all in a single request. +Hybrid queries are ideal for applications that need to query across multiple attribute types in one request. +For example, a product discovery query might combine vector similarity over reviews for semantic meaning, a tag filter for category and availability, a numeric range for price, and full-text search over product titles — all in a single request. This eliminates the need to stitch together multiple queries or round-trips, making it a natural fit for recommendation systems, media platforms, and real-time operational workflows. Combining our examples from above, when a shopper on Acme.inc searches for "noise cancelling earphones" and filters for products in "white" color, under $150, that are good for running, the app can combine all of this into a single query: ``` @@ -82,8 +90,10 @@ Here, the query is searching through vector representations of product reviews t Aggregations help you analyze and summarize the results of a search query, instead of returning a raw list of matching documents. You can use `GROUPBY` to form groups on any indexed attribute such as category, brand, region, and time, apply `REDUCE` functions such as `COUNT`, `SUM`, and `AVG` to compute per-group statistics, and use `APPLY` to create computed attributes on the fly. You can then refine and shape the output with post-aggregation `FILTER`, `SORTBY`, and `LIMIT`, chaining stages together to build multi-step workflows in a single query. -This makes aggregations a strong fit for low-latency lightweight analytics directly on indexed Valkey data, without the need to export large result sets to the application layer. Some applications of aggregations include: -1. Faceted navigation and filtering: Power dynamic filtering UIs using aggregations to compute real-time counts over the current result set (for example by category, brand, price band, rating, or availability), enabling users to narrow down search results with instant feedback on available options. You can also group and count items by attribute such as genre, tags, language, or creator to power structured browsing and category-level summaries across large catalogs. +This makes aggregations a strong fit for low-latency lightweight analytics directly on indexed Valkey data, without the need to export large result sets to the application layer. +Some applications of aggregations include: +1. Faceted navigation and filtering: Power dynamic filtering UIs using aggregations to compute real-time counts over the current result set (for example by category, brand, price band, rating, or availability), enabling users to narrow down search results with instant feedback on available options. + You can also group and count items by attribute such as genre, tags, language, or creator to power structured browsing and category-level summaries across large catalogs. 2. Real-time statistics: Use aggregations to compute grouped rankings for powering in-app flows such as trending items by recent engagement, category leaders by revenue, or top performers by region. 3. Analytics and reporting: Generate live counts and summary metrics to power operational dashboards, or generate on-demand reports for analysis and decision making without hitting backend databases. For example, Acme.inc can populate the count of earphones available from “shopnow” in each price band on the webpage using: @@ -113,16 +123,26 @@ Separately, in cluster mode, read-after-write consistency applies per primary of If you write a key to a primary, searches sent to that primary see the change after the write returns, but a fan-out query spanning multiple shards does not have a single global transactional view. ### Scale to Terabytes of Data Valkey Search includes built-in support for cluster mode, enabling you to scale to terabytes of data without requiring application or client code changes. -In cluster mode, Valkey Search creates indexes that span multiple shards by maintaining a separate index on each node for the keys belonging to that node's slot range. When you create, update, or drop an index on any primary, Valkey Search propagates that change to all nodes. +In cluster mode, Valkey Search creates indexes that span multiple shards by maintaining a separate index on each node for the keys belonging to that node's slot range. +When you create, update, or drop an index on any primary, Valkey Search propagates that change to all nodes. You can scale read throughput by distributing Search queries evenly across primary nodes so that no single node becomes a bottleneck, or by routing some Search queries to replicas. You can increase throughput by scaling to instances with more vCPUs, allowing multithreading to scale throughput linearly for both querying and ingesting, or by adding replicas to increase query throughput. For queries, the coordinating node that receives the query request, packages a query plan and sends it to every shard (to run on either primaries or replicas). -A node within each shard performs the search and fetches its matching keys, then returns results for the coordinator to merge. Because the fan-out and merge logic exists on every cluster node, any node can coordinate a query. For mutations, the primary owning the slot handles updates: when a key is added, updated, or deleted, only that primary updates its index directly, and the change replicates to its replicas. +A node within each shard performs the search and fetches its matching keys, then returns results for the coordinator to merge. +Because the fan-out and merge logic exists on every cluster node, any node can coordinate a query. +For mutations, the primary owning the slot handles updates: when a key is added, updated, or deleted, only that primary updates its index directly, and the change replicates to its replicas. ## Getting Started -Valkey Search 1.2 extends search to text, tag, and numeric attribute types and adds result aggregation capabilities such as filtering, sorting, grouping, and computing metrics. Whether you're building cutting-edge AI applications, latency-sensitive search experiences, or integrating search into existing systems, we invite you to try it out. -To get started with Valkey Search, visit the [Valkey Search GitHub repository](https://github.com/valkey-io/valkey-search) and the [Valkey Bundle on Docker Hub](https://hub.docker.com/r/valkey/valkey-bundle). The official Valkey Bundle image provides the fastest path to running Valkey with preloaded modules, including Valkey Search, so you can begin building search and aggregation workflows without manual module setup. You can connect using official Valkey client libraries such as Valkey GLIDE, valkey-py, valkey-go, and valkey-java, as well as other Redis-compatible clients. Valkey Search is available under the BSD-3-Clause license. You can learn more about Valkey Search through our [documentation](https://valkey.io/topics/search/). +Valkey Search 1.2 extends search to text, tag, and numeric attribute types and adds result aggregation capabilities such as filtering, sorting, grouping, and computing metrics. +Whether you're building cutting-edge AI applications, latency-sensitive search experiences, or integrating search into existing systems, we invite you to try it out. +To get started with Valkey Search, visit the [Valkey Search GitHub repository](https://github.com/valkey-io/valkey-search) and the [Valkey Bundle on Docker Hub](https://hub.docker.com/r/valkey/valkey-bundle). +The official Valkey Bundle image provides the fastest path to running Valkey with preloaded modules, including Valkey Search, so you can begin building search and aggregation workflows without manual module setup. +You can connect using official Valkey client libraries such as Valkey GLIDE, valkey-py, valkey-go, and valkey-java, as well as other Redis-compatible clients. +Valkey Search is available under the BSD-3-Clause license. +You can learn more about Valkey Search through our [documentation](https://valkey.io/topics/search/). -Get Involved: [Join the Valkey Search community](https://github.com/valkey-io/valkey-search), file issues, open pull requests, or suggest improvements. We welcome contributions of all kinds - code, documentation, testing, and feedback. Your involvement helps make Valkey Search better for everyone. +Get Involved: [Join the Valkey Search community](https://github.com/valkey-io/valkey-search), file issues, open pull requests, or suggest improvements. +We welcome contributions of all kinds - code, documentation, testing, and feedback. +Your involvement helps make Valkey Search better for everyone. > **Note:** As of March 13, 2026, if you want to use Valkey Search 1.2 features on docker, use the current valkey/valkey-bundle:unstable image. diff --git a/content/blog/2026-03-27-valkey-tooling-primitives.md b/content/blog/2026-03-27-valkey-tooling-primitives.md index 215c4898..61ee2f42 100644 --- a/content/blog/2026-03-27-valkey-tooling-primitives.md +++ b/content/blog/2026-03-27-valkey-tooling-primitives.md @@ -11,59 +11,114 @@ featured = true featured_image = "/assets/media/featured/random-04.webp" +++ -Valkey is protocol-compatible with Redis and supports the full Redis 7.2.4 command API. That's one of its greatest strengths - existing clients are largely compatible, the learning curve is not steep. It's also, quietly, a problem for tooling. +Valkey is protocol-compatible with Redis and supports the full Redis 7.2.4 command API. +That's one of its greatest strengths - existing clients are largely compatible, the learning curve is not steep. +It's also, quietly, a problem for tooling. -Because compatibility means every tool built before Valkey existed technically "works" with it - tools that haven't been updated to take advantage of what Valkey now offers natively. And when something works well enough, nobody builds a better version. Why would they? +Because compatibility means every tool built before Valkey existed technically "works" with it - tools that haven't been updated to take advantage of what Valkey now offers natively. +And when something works well enough, nobody builds a better version. +Why would they? -The release of [Valkey Admin](https://github.com/valkey-io/valkey-admin) is a signal that the community already knows this is a problem worth solving. It's also a useful frame for the broader question: what do Valkey's newer primitives actually make possible, and are the tools keeping up? +The release of [Valkey Admin](https://github.com/valkey-io/valkey-admin) is a signal that the community already knows this is a problem worth solving. +It's also a useful frame for the broader question: what do Valkey's newer primitives actually make possible, and are the tools keeping up? ## Primitives that deserve purpose-built tooling -[LATENCY history](https://valkey.io/commands/latency-history/) has been in Valkey (and Redis before it) for a while, but it's consistently underused because the data is rarely captured continuously. Valkey maintains a history of latency events - fork operations, AOF flushes, AOF rewrites. When you collect this over time, questions like "did our latency spike coincide with an AOF flush?" become answerable. Without continuous collection, you're left staring at the current state and reasoning backward with no evidence. +[LATENCY history](https://valkey.io/commands/latency-history/) has been in Valkey (and Redis before it) for a while, but it's consistently underused because the data is rarely captured continuously. +Valkey maintains a history of latency events - fork operations, AOF flushes, AOF rewrites. +When you collect this over time, questions like "did our latency spike coincide with an AOF flush?" become answerable. +Without continuous collection, you're left staring at the current state and reasoning backward with no evidence. Valkey has taken this further with two primitives that have no Redis equivalent. -[COMMANDLOG](https://valkey.io/commands/commandlog-get/) (8.1+) is the clearest example. Unlike SLOWLOG, which only flags commands that exceed an execution time threshold, COMMANDLOG tracks by three separate criteria: slow execution, large request payloads, and large reply payloads. +[COMMANDLOG](https://valkey.io/commands/commandlog-get/) (8.1+) is the clearest example. +Unlike SLOWLOG, which only flags commands that exceed an execution time threshold, COMMANDLOG tracks by three separate criteria: slow execution, large request payloads, and large reply payloads. -The distinction matters more than it looks. A command retrieving a 50MB hash may execute quickly - the data is in memory, the read is fast - but it's saturating your network, causing tail latency for every other client sharing that connection, and buffering data in ways that won't show up in slowlog at all. You end up with rising P99 latency and no obvious culprit, because the traditional tool for finding slow commands says everything is fine. COMMANDLOG with large-reply tracking shows you exactly which command patterns are the problem - something that simply wasn't possible to diagnose this way before. +The distinction matters more than it looks. +A command retrieving a 50MB hash may execute quickly - the data is in memory, the read is fast - but it's saturating your network, causing tail latency for every other client sharing that connection, and buffering data in ways that won't show up in slowlog at all. +You end up with rising P99 latency and no obvious culprit, because the traditional tool for finding slow commands says everything is fine. +COMMANDLOG with large-reply tracking shows you exactly which command patterns are the problem - something that simply wasn't possible to diagnose this way before. -[CLUSTER SLOT-STATS](https://valkey.io/commands/cluster-slot-stats/) (8.0+) gives you per-slot key counts, reads, writes, and CPU usage across a cluster. Before this, shard balancing was largely a guessing game based on aggregate node metrics - you could see that a node was hot, but not which slots were driving it. With SLOT-STATS you can identify specific hot slots and make targeted rebalancing decisions backed by actual data rather than intuition. +[CLUSTER SLOT-STATS](https://valkey.io/commands/cluster-slot-stats/) (8.0+) gives you per-slot key counts, reads, writes, and CPU usage across a cluster. +Before this, shard balancing was largely a guessing game based on aggregate node metrics - you could see that a node was hot, but not which slots were driving it. +With SLOT-STATS you can identify specific hot slots and make targeted rebalancing decisions backed by actual data rather than intuition. ## Purpose-built tooling exists, and it's coming to Valkey -Redis recognized this early. Redis Insight and the Redis Insight VS Code extension exist precisely because the generic tools weren't enough - operators needed something that understood Redis's data model, its operational commands, and how developers actually interact with it day to day. The investment made sense because the tool could be built around the specific primitives Redis exposed. +Redis recognized this early. +Redis Insight and the Redis Insight VS Code extension exist precisely because the generic tools weren't enough - operators needed something that understood Redis's data model, its operational commands, and how developers actually interact with it day to day. +The investment made sense because the tool could be built around the specific primitives Redis exposed. -Valkey is getting the same treatment. [Valkey Admin](https://github.com/valkey-io/valkey-admin) - the project's own operator tool, and the closest thing to a Valkey-native alternative to Redis Insight - is a clear signal that the community recognizes this. On the editor side, a VS Code extension for Valkey brings the same workflow into the development environment. But the point isn't any specific tool. The point is that the category needs to exist, and it needs to keep pace with what Valkey is shipping. +Valkey is getting the same treatment. +[Valkey Admin](https://github.com/valkey-io/valkey-admin) - the project's own operator tool, and the closest thing to a Valkey-native alternative to Redis Insight - is a clear signal that the community recognizes this. +On the editor side, a VS Code extension for Valkey brings the same workflow into the development environment. +But the point isn't any specific tool. +The point is that the category needs to exist, and it needs to keep pace with what Valkey is shipping. -There's a harder problem underneath this though: most of Valkey's operational data is ephemeral by design. The slowlog is a circular buffer. COMMANDLOG entries don't persist across restarts. Command patterns that caused a latency spike hours ago leave no trace unless something was collecting continuously. Purpose-built tooling needs to solve for persistence, not just presentation. +There's a harder problem underneath this though: most of Valkey's operational data is ephemeral by design. +The slowlog is a circular buffer. +COMMANDLOG entries don't persist across restarts. +Command patterns that caused a latency spike hours ago leave no trace unless something was collecting continuously. +Purpose-built tooling needs to solve for persistence, not just presentation. ## The right analogy -You can use JavaScript for backend services. Node.js is perfectly capable, the ecosystem is vast, and a lot of teams do it. But if you need high throughput or tight memory control, you probably want Go or Rust - not because JS is broken, but because the problem warrants a better fit. The same logic applies to desktop tooling: Electron works, and it ships fast, but you're bundling a browser engine to display a web UI. It runs, but it carries a lot of weight for what it's doing. +You can use JavaScript for backend services. +Node.js is perfectly capable, the ecosystem is vast, and a lot of teams do it. +But if you need high throughput or tight memory control, you probably want Go or Rust - not because JS is broken, but because the problem warrants a better fit. +The same logic applies to desktop tooling: Electron works, and it ships fast, but you're bundling a browser engine to display a web UI. +It runs, but it carries a lot of weight for what it's doing. -Redis-compatible tools work with Valkey for the same reason Node.js works for backends. They operate at the wire protocol level, which is compatible. But Valkey-specific primitives like COMMANDLOG have no Redis equivalent, so no Redis-era tool has a UI for it, a Prometheus exporter for it, or a way to persist and query its history. You can call it from the CLI, but that's about it. The fit just isn't there. +Redis-compatible tools work with Valkey for the same reason Node.js works for backends. +They operate at the wire protocol level, which is compatible. +But Valkey-specific primitives like COMMANDLOG have no Redis equivalent, so no Redis-era tool has a UI for it, a Prometheus exporter for it, or a way to persist and query its history. +You can call it from the CLI, but that's about it. +The fit just isn't there. ## What's coming in 9.1 makes this more urgent Two PRs currently targeting 9.1 illustrate where Valkey is headed. -The first is per-thread I/O utilization metrics ([PR #2463](https://github.com/valkey-io/valkey/pull/2463)). New `used_active_time_io_thread_N` fields in `INFO` will expose how much time each I/O thread actually spends doing work versus waiting for it. Since Valkey's I/O threads do busy polling, CPU utilization alone is misleading - a thread can show near 100% CPU while barely processing any work. The new fields use a monotonic clock to measure active time, making real utilization calculable over any time window. Paired with COMMANDLOG, this opens up an interesting class of correlations: if large-request or large-reply patterns coincide with high I/O thread active time, you're likely looking at bandwidth saturation rather than a compute bottleneck. +The first is per-thread I/O utilization metrics ([PR #2463](https://github.com/valkey-io/valkey/pull/2463)). +New `used_active_time_io_thread_N` fields in `INFO` will expose how much time each I/O thread actually spends doing work versus waiting for it. +Since Valkey's I/O threads do busy polling, CPU utilization alone is misleading - a thread can show near 100% CPU while barely processing any work. +The new fields use a monotonic clock to measure active time, making real utilization calculable over any time window. +Paired with COMMANDLOG, this opens up an interesting class of correlations: if large-request or large-reply patterns coincide with high I/O thread active time, you're likely looking at bandwidth saturation rather than a compute bottleneck. -The second is CLUSTERSCAN ([PR #2934](https://github.com/valkey-io/valkey/pull/2934)), a new cluster-native SCAN command that iterates across all slots while handling MOVED redirections automatically. The cursor format encodes slot information and a fingerprint of the memory layout - if the cluster reshards mid-scan, it restarts from the affected slot rather than returning an error. For tooling this changes what cluster-wide key inspection can look like. Every current tool handles this with node-by-node iteration. CLUSTERSCAN makes a cleaner approach possible. +The second is CLUSTERSCAN ([PR #2934](https://github.com/valkey-io/valkey/pull/2934)), a new cluster-native SCAN command that iterates across all slots while handling MOVED redirections automatically. +The cursor format encodes slot information and a fingerprint of the memory layout - if the cluster reshards mid-scan, it restarts from the affected slot rather than returning an error. +For tooling this changes what cluster-wide key inspection can look like. +Every current tool handles this with node-by-node iteration. +CLUSTERSCAN makes a cleaner approach possible. -Both of these need tooling adoption to be useful at scale. The I/O thread metrics need continuous collection - a one-time snapshot tells you nothing about what thread utilization looked like during the incident window. CLUSTERSCAN needs tooling to implement it before operators benefit from it in their debugging workflows. Features that don't have good tooling get underused, regardless of how good the implementation is. +Both of these need tooling adoption to be useful at scale. +The I/O thread metrics need continuous collection - a one-time snapshot tells you nothing about what thread utilization looked like during the incident window. +CLUSTERSCAN needs tooling to implement it before operators benefit from it in their debugging workflows. +Features that don't have good tooling get underused, regardless of how good the implementation is. ## The observability gap -The reason this keeps coming up is that Valkey's development has accelerated. 8.0 shipped multi-threaded I/O and SLOT-STATS. 8.1 added COMMANDLOG. 9.0 brought hash field expiration, atomic slot migration, and multi-database cluster mode. Each of these adds operational surface. +The reason this keeps coming up is that Valkey's development has accelerated. +8.0 shipped multi-threaded I/O and SLOT-STATS. +8.1 added COMMANDLOG. +9.0 brought hash field expiration, atomic slot migration, and multi-database cluster mode. +Each of these adds operational surface. -Hash field expiration introduces TTL behavior at a new granularity - reasoning about memory behavior requires visibility into expiring-key counts at the field level, not just the key level. Atomic slot migration changes how resharding works - tooling for planning and monitoring migrations needs to understand the new model. And so on. +Hash field expiration introduces TTL behavior at a new granularity - reasoning about memory behavior requires visibility into expiring-key counts at the field level, not just the key level. +Atomic slot migration changes how resharding works - tooling for planning and monitoring migrations needs to understand the new model. +And so on. -The community has invested heavily in the core. The more the ecosystem builds tools that treat Valkey's primitives as first-class features - not as Redis extensions to be gracefully ignored - the more value operators actually get out of them. +The community has invested heavily in the core. +The more the ecosystem builds tools that treat Valkey's primitives as first-class features - not as Redis extensions to be gracefully ignored - the more value operators actually get out of them. ## Tooling is an ongoing topic, not a one-time decision -Valkey's development isn't slowing down. New primitives will keep landing, each adding operational surface that existing tools weren't built to handle. The gap between what Valkey exposes and what the tooling ecosystem can see isn't a problem to solve once - it's something to keep pace with. +Valkey's development isn't slowing down. +New primitives will keep landing, each adding operational surface that existing tools weren't built to handle. +The gap between what Valkey exposes and what the tooling ecosystem can see isn't a problem to solve once - it's something to keep pace with. -The good news is the community is already moving. [Valkey Admin](https://github.com/valkey-io/valkey-admin) is open source and in preview, actively looking for contributions. A [VS Code extension for Valkey](https://github.com/BetterDB-inc/vscode) is also available if you prefer working from the editor. If you're building something in this space or have operational lessons worth sharing, [reach out on LinkedIn](https://www.linkedin.com/in/kivanow) - happy to talk through it. +The good news is the community is already moving. +[Valkey Admin](https://github.com/valkey-io/valkey-admin) is open source and in preview, actively looking for contributions. +A [VS Code extension for Valkey](https://github.com/BetterDB-inc/vscode) is also available if you prefer working from the editor. +If you're building something in this space or have operational lessons worth sharing, [reach out on LinkedIn](https://www.linkedin.com/in/kivanow) - happy to talk through it. diff --git a/content/blog/2026-04-15-victory-at-hackncstate/index.md b/content/blog/2026-04-15-victory-at-hackncstate/index.md index 33f4b482..d20481ed 100644 --- a/content/blog/2026-04-15-victory-at-hackncstate/index.md +++ b/content/blog/2026-04-15-victory-at-hackncstate/index.md @@ -9,9 +9,11 @@ blog_type = ["Events"] The telecommunications industry is facing growing trust challenges as communication networks become targets for increasingly sophisticated fraud. -On February 14-15, 2026, 371 students and 15 teams came together at [HackNC State 2026](https://hackncstate.org/) to tackle this challenge within 24 hours. The Valkey project, under [The Linux Foundation](https://www.linuxfoundation.org/), invited the participants to compete in an API challenge choosing from the proposed topics or design a novel use case for an ultra fast in-memory, open source database. +On February 14-15, 2026, 371 students and 15 teams came together at [HackNC State 2026](https://hackncstate.org/) to tackle this challenge within 24 hours. +The Valkey project, under [The Linux Foundation](https://www.linuxfoundation.org/), invited the participants to compete in an API challenge choosing from the proposed topics or design a novel use case for an ultra fast in-memory, open source database. -Among many impressive teams, Team Catphish rose to the occasion. They earned the “Best Use of Valkey API” award for developing a voice identity layer to help telecom providers detect and prevent fraud. +Among many impressive teams, Team Catphish rose to the occasion. +They earned the “Best Use of Valkey API” award for developing a voice identity layer to help telecom providers detect and prevent fraud. ![hackncstate1](image2.png) @@ -21,15 +23,25 @@ The following reflections were authored by Team Catphish winners: *Ahmed Hassan, ## **The Problem the Team Chose and Why** -The idea for Catphish started with a simple observation: voice cloning technology has become remarkably convincing. Modern tools such as ElevenLabs can reproduce human speech patterns so accurately that distinguishing between a real voice and a synthetic one is becoming increasingly difficult. +The idea for Catphish started with a simple observation: voice cloning technology has become remarkably convincing. +Modern tools such as ElevenLabs can reproduce human speech patterns so accurately that distinguishing between a real voice and a synthetic one is becoming increasingly difficult. -During the team’s initial brainstorming session, the discussion quickly turned to the growing number of scams involving cloned voices. One scenario stood out. Imagine receiving a phone call that sounds exactly like a family member asking for urgent help, when in reality the voice has been generated by AI. Incidents like this are no longer hypothetical. AI-powered voice scams have already caused millions of dollars in losses as attackers impersonate relatives, executives, or banking customers. +During the team’s initial brainstorming session, the discussion quickly turned to the growing number of scams involving cloned voices. +One scenario stood out. +Imagine receiving a phone call that sounds exactly like a family member asking for urgent help, when in reality the voice has been generated by AI. +Incidents like this are no longer hypothetical. +AI-powered voice scams have already caused millions of dollars in losses as attackers impersonate relatives, executives, or banking customers. -Traditional voice authentication systems attempt to answer a single question: “Does this voice match the registered user?” However, this approach leaves a major vulnerability. If an attacker can generate a convincing voice clone, the system may still accept it as legitimate. +Traditional voice authentication systems attempt to answer a single question: “Does this voice match the registered user?” +However, this approach leaves a major vulnerability. +If an attacker can generate a convincing voice clone, the system may still accept it as legitimate. -The team realized that most systems focus on verifying the sound of the voice but rarely verify whether the speaker actually understands what they are saying. Humans naturally interpret instructions and respond to them, while many text-to-speech systems simply read the text they are given. +The team realized that most systems focus on verifying the sound of the voice but rarely verify whether the speaker actually understands what they are saying. +Humans naturally interpret instructions and respond to them, while many text-to-speech systems simply read the text they are given. -This insight led to the core idea behind Catphish. Instead of only verifying who is speaking, the system also verifies how they respond to dynamic prompts. By testing a user’s cognitive response rather than only their vocal characteristics, the system can better distinguish between a real human speaker and an AI-generated voice. +This insight led to the core idea behind Catphish. +Instead of only verifying who is speaking, the system also verifies how they respond to dynamic prompts. +By testing a user’s cognitive response rather than only their vocal characteristics, the system can better distinguish between a real human speaker and an AI-generated voice. ![hackncstate2](image1.png) @@ -40,42 +52,77 @@ Hackathons move quickly, so within the first few hours, the team began defining Ahmed mapped out the overall user flow and created lo-fi wireframes so the team could visualize the MVP and understand how users would interact with the authentication process. -Around the same time, Tristan suggested using Valkey for storage. Initially, there were some doubts, since many hackathon teams default to traditional relational databases. After testing Valkey locally, however, the advantages quickly became clear. Its in-memory architecture allowed voice data and session information to be retrieved almost instantly, which is critical for real-time authentication systems. - -With the infrastructure decision made, development moved quickly. Nolan researched existing voice authentication approaches and explored how they could be implemented within the scope of a 24-hour project. That research helped shape the system’s two-layer authentication model. - -The first layer verifies the speaker’s identity using voice embeddings generated from recorded audio. These embeddings capture unique vocal characteristics that can be compared against previously enrolled samples. -The second layer verifies cognitive understanding using dynamic prompts. Instead of asking users to read a fixed phrase such as “The sky is blue,” the system generates instructions like “Count from one to five.” A human naturally responds with the sequence of numbers, while a text-to-speech system often reads the instruction itself word-for-word. This behavioral difference helps the system detect AI-generated voices. +Around the same time, Tristan suggested using Valkey for storage. +Initially, there were some doubts, since many hackathon teams default to traditional relational databases. +After testing Valkey locally, however, the advantages quickly became clear. +Its in-memory architecture allowed voice data and session information to be retrieved almost instantly, which is critical for real-time authentication systems. + +With the infrastructure decision made, development moved quickly. +Nolan researched existing voice authentication approaches and explored how they could be implemented within the scope of a 24-hour project. +That research helped shape the system’s two-layer authentication model. + +The first layer verifies the speaker’s identity using voice embeddings generated from recorded audio. +These embeddings capture unique vocal characteristics that can be compared against previously enrolled samples. +The second layer verifies cognitive understanding using dynamic prompts. +Instead of asking users to read a fixed phrase such as “The sky is blue,” the system generates instructions like “Count from one to five.” +A human naturally responds with the sequence of numbers, while a text-to-speech system often reads the instruction itself word-for-word. +This behavioral difference helps the system detect AI-generated voices. To support the system, Valkey was used to store several types of data, including voice embeddings for enrolled users, session data for authentication attempts, time-limited challenge prompts, API keys for tenant authentication, and rate-limiting counters. -Because Valkey is a key-value store, development was extremely fast. The team did not need to design schemas or run database migrations, which allowed them to focus on implementing the core authentication logic. -Valkey’s low-latency access also ensured that retrieving voice embeddings occurred in milliseconds. For a pipeline that includes audio recording, AI processing, and verification scoring, minimizing database latency was critical for maintaining a responsive user experience. +Because Valkey is a key-value store, development was extremely fast. +The team did not need to design schemas or run database migrations, which allowed them to focus on implementing the core authentication logic. +Valkey’s low-latency access also ensured that retrieving voice embeddings occurred in milliseconds. +For a pipeline that includes audio recording, AI processing, and verification scoring, minimizing database latency was critical for maintaining a responsive user experience. -As the core system began to take shape, the team also considered how organizations might deploy the technology. Rameez proposed positioning Catphish as a B2B API service using a redirect-based flow similar to authentication or payment links used by companies like Stripe. Instead of verifying identity through a traditional two-factor authentication code sent by SMS or an authenticator app, users would be redirected to a voice verification page. First-time users enroll their voice, and future logins compare the recorded voice with the stored embedding while also verifying the cognitive prompt response. +As the core system began to take shape, the team also considered how organizations might deploy the technology. +Rameez proposed positioning Catphish as a B2B API service using a redirect-based flow similar to authentication or payment links used by companies like Stripe. +Instead of verifying identity through a traditional two-factor authentication code sent by SMS or an authenticator app, users would be redirected to a voice verification page. +First-time users enroll their voice, and future logins compare the recorded voice with the stored embedding while also verifying the cognitive prompt response. ## **Challenges the Team Faced** One of the biggest challenges was designing prompts that could reliably distinguish between human responses and AI-generated speech. -The team experimented with several prompt formats during development. Some prompts were too simple and could easily be reproduced by text-to-speech systems, while others were overly complex and risked frustrating legitimate users. Accessibility was also an important consideration since prompts needed to remain understandable for a wide range of users. +The team experimented with several prompt formats during development. +Some prompts were too simple and could easily be reproduced by text-to-speech systems, while others were overly complex and risked frustrating legitimate users. +Accessibility was also an important consideration since prompts needed to remain understandable for a wide range of users. -Eventually, the team converged on multi-step cognitive prompts that are simple for humans but difficult for AI systems to interpret. These prompts combine small tasks such as saying a number, spelling a word, or responding to a short instruction. This approach became the system’s strongest signal for detecting synthetic voices. +Eventually, the team converged on multi-step cognitive prompts that are simple for humans but difficult for AI systems to interpret. +These prompts combine small tasks such as saying a number, spelling a word, or responding to a short instruction. +This approach became the system’s strongest signal for detecting synthetic voices. -Another challenge involved balancing security and usability. Voice verification relies on similarity scoring between embeddings, and selecting the right threshold is critical. If the threshold is too strict, legitimate users may be rejected. If it is too permissive, attackers may succeed. After testing several configurations, the team settled on an approximate similarity threshold of 85 percent. +Another challenge involved balancing security and usability. +Voice verification relies on similarity scoring between embeddings, and selecting the right threshold is critical. +If the threshold is too strict, legitimate users may be rejected. +If it is too permissive, attackers may succeed. +After testing several configurations, the team settled on an approximate similarity threshold of 85 percent. -Maintaining real-time performance was another challenge. The authentication pipeline includes several processing steps, including audio capture, embedding generation, speech analysis, database lookups, and verification scoring. Each step needed to be optimized to prevent noticeable delays during login. Valkey’s fast in-memory access played a key role in keeping the system responsive. +Maintaining real-time performance was another challenge. +The authentication pipeline includes several processing steps, including audio capture, embedding generation, speech analysis, database lookups, and verification scoring. +Each step needed to be optimized to prevent noticeable delays during login. +Valkey’s fast in-memory access played a key role in keeping the system responsive. ## **Demo Time and Lessons Learned** -By the final hours of the hackathon, the team had a working demonstration of the Catphish system. The demo simulated a banking login environment. +By the final hours of the hackathon, the team had a working demonstration of the Catphish system. +The demo simulated a banking login environment. When users attempted to sign in, they were redirected to the Catphish verification page, where they recorded their voice and responded to a dynamic prompt. -If the voice embedding matched the enrolled user and the prompt was answered correctly, authentication succeeded. If the system detected either a mismatched voice or an AI-generated response, the login attempt was rejected. -The demonstration helped illustrate the potential real-world applications of the system. Industries such as banking, healthcare, telecommunications, and enterprise software could integrate voice verification as an additional authentication factor to help prevent identity fraud. -The hackathon also produced several important lessons. First, infrastructure choices matter. Using Valkey significantly reduced development friction and allowed the team to build a real-time system without spending time configuring complex databases. Second, AI can help detect AI-generated content. Models trained to analyze speech patterns can identify subtle signals that may not be obvious to humans. Finally, identity verification is evolving. Traditional methods such as two-factor authentication codes sent via SMS or generated by authenticator apps are increasingly vulnerable, and approaches that combine voice authentication with behavioral analysis may become an important component of future security systems. +If the voice embedding matched the enrolled user and the prompt was answered correctly, authentication succeeded. +If the system detected either a mismatched voice or an AI-generated response, the login attempt was rejected. +The demonstration helped illustrate the potential real-world applications of the system. +Industries such as banking, healthcare, telecommunications, and enterprise software could integrate voice verification as an additional authentication factor to help prevent identity fraud. +The hackathon also produced several important lessons. +First, infrastructure choices matter. +Using Valkey significantly reduced development friction and allowed the team to build a real-time system without spending time configuring complex databases. +Second, AI can help detect AI-generated content. +Models trained to analyze speech patterns can identify subtle signals that may not be obvious to humans. +Finally, identity verification is evolving. +Traditional methods such as two-factor authentication codes sent via SMS or generated by authenticator apps are increasingly vulnerable, and approaches that combine voice authentication with behavioral analysis may become an important component of future security systems. # Get Involved To learn more and explore ways to get involved in the community: If you would like to contribute to the mission, please consider joining the [Valkey community here](https://valkey.io/community/), where community members contribute and shape the future of the Valkey project. -Valkey is moving fast and the easiest way to stay ahead is to [subscribe to the official Valkey newsletter](https://valkey.io/blog/valkey-newsletter-new/#email-signup). You can also follow along on Valkey social channels for the latest Valkey community news, event recaps, and project developments ([LinkedIn](https://www.linkedin.com/company/valkey/), [X](https://x.com/valkey_io), and [BlueSky](https://bsky.app/profile/valkeyio.bsky.social)). \ No newline at end of file +Valkey is moving fast and the easiest way to stay ahead is to [subscribe to the official Valkey newsletter](https://valkey.io/blog/valkey-newsletter-new/#email-signup). +You can also follow along on Valkey social channels for the latest Valkey community news, event recaps, and project developments ([LinkedIn](https://www.linkedin.com/company/valkey/), [X](https://x.com/valkey_io), and [BlueSky](https://bsky.app/profile/valkeyio.bsky.social)). \ No newline at end of file diff --git a/content/blog/2026-04-22-valkey-swift-1.0/index.md b/content/blog/2026-04-22-valkey-swift-1.0/index.md index 821ea8f2..495fcc2f 100644 --- a/content/blog/2026-04-22-valkey-swift-1.0/index.md +++ b/content/blog/2026-04-22-valkey-swift-1.0/index.md @@ -9,17 +9,22 @@ blog_type = ["Announcements"] [extra] featured_image = "/assets/media/featured/random-04.webp" +++ -Last summer, we [introduced the preview release](https://valkey.io/blog/valkey-swift/) of [valkey-swift](https://github.com/valkey-io/valkey-swift). This 1.0 release delivers a production-ready client with stable APIs that takes full advantage of all the modern features of Swift 6. +Last summer, we [introduced the preview release](https://valkey.io/blog/valkey-swift/) of [valkey-swift](https://github.com/valkey-io/valkey-swift). +This 1.0 release delivers a production-ready client with stable APIs that takes full advantage of all the modern features of Swift 6. ## Introduction -Valkey-swift is a production-grade Swift client built with modern Swift features in mind. Using Valkey with Swift provides strongly typed APIs with clean semantics, memory-safety and data-race-safety guarantees, and a very light memory footprint. The client API uses Swift's structured concurrency — a paradigm designed to bring clarity to concurrent programming by using the structure of your code to automatically define the lifetimes of tasks and associated resources. This allows you to write clean concurrent code without worrying about its side effects like race conditions and connection leaks. +Valkey-swift is a production-grade Swift client built with modern Swift features in mind. +Using Valkey with Swift provides strongly typed APIs with clean semantics, memory-safety and data-race-safety guarantees, and a very light memory footprint. +The client API uses Swift's structured concurrency — a paradigm designed to bring clarity to concurrent programming by using the structure of your code to automatically define the lifetimes of tasks and associated resources. +This allows you to write clean concurrent code without worrying about its side effects like race conditions and connection leaks. ## Core Features Valkey-swift has included these core features since our preview release in August 2025: -- Support for all available Valkey commands. Custom code generation tools keep us in sync with the latest commands that Valkey offers. +- Support for all available Valkey commands. + Custom code generation tools keep us in sync with the latest commands that Valkey offers. - Cluster-mode-compatible client with cluster-aware routing, dynamic topology discovery, and handling cluster MOVED redirections. - Command pipelining to improve performance by batching multiple commands in a single request and connection. - Support for publish and subscribe to message queues by running multiple subscriptions on a single connection. @@ -28,22 +33,29 @@ Valkey-swift has included these core features since our preview release in Augus ## What's New in valkey-swift 1.0 -Since the preview release, we have made significant improvements to the cluster client. Cluster mode error handling is now more robust, with seamless support for ASK and MOVED redirections, and TRYAGAIN errors. We reduced downtime during failovers and connection loss from 30 seconds to under 2 seconds. +Since the preview release, we have made significant improvements to the cluster client. +Cluster mode error handling is now more robust, with seamless support for ASK and MOVED redirections, and TRYAGAIN errors. +We reduced downtime during failovers and connection loss from 30 seconds to under 2 seconds. -The cluster client also now has feature parity with the standard client. It supports cluster-level pipelines and transactions by splitting pipelines across the correct shards, so you don't have to worry about the location of your keys. We have also improved subscription connection management where both the standalone and the cluster client now allocate a single shared connection for all subscriptions instead of allocating a connection for each subscription. +The cluster client also now has feature parity with the standard client. +It supports cluster-level pipelines and transactions by splitting pipelines across the correct shards, so you don't have to worry about the location of your keys. +We have also improved subscription connection management where both the standalone and the cluster client now allocate a single shared connection for all subscriptions instead of allocating a connection for each subscription. -Finally, both standalone and cluster clients support reading from replicas for scaling reads. Currently, we only support round-robin-based replica selection, but we intend to extend this to include latency aware and AZ-aware methods. +Finally, both standalone and cluster clients support reading from replicas for scaling reads. +Currently, we only support round-robin-based replica selection, but we intend to extend this to include latency aware and AZ-aware methods. Other improvements in version 1.0 include: - Support for new commands from Valkey 9.0. - Support for distributed tracing. -- Dynamic command pipelines defined at runtime. Previously a series of pipelined commands could only be defined at compile time. +- Dynamic command pipelines defined at runtime. + Previously a series of pipelined commands could only be defined at compile time. - Client configuration for accessing a numbered database. - Support for the Valkey module valkey-search. ## What’s Next -Valkey-swift is constantly adding new features. Planned features include: +Valkey-swift is constantly adding new features. +Planned features include: - Sentinel mode support. - Cluster-wide multi-key commands. @@ -52,5 +64,6 @@ Valkey-swift is constantly adding new features. Planned features include: ## Contributing -Valkey-swift is open source under the Apache 2.0 license, and contributions are welcome — bug reports, feature requests, and pull requests. Check out open [issues](https://github.com/valkey-io/valkey-swift/issues) on GitHub for a good starting point. +Valkey-swift is open source under the Apache 2.0 license, and contributions are welcome — bug reports, feature requests, and pull requests. +Check out open [issues](https://github.com/valkey-io/valkey-swift/issues) on GitHub for a good starting point. diff --git a/content/blog/2026-04-23-valkey-at-laracon-india-2026/index.md b/content/blog/2026-04-23-valkey-at-laracon-india-2026/index.md index 54dcbc5b..ee1fa95f 100644 --- a/content/blog/2026-04-23-valkey-at-laracon-india-2026/index.md +++ b/content/blog/2026-04-23-valkey-at-laracon-india-2026/index.md @@ -36,9 +36,13 @@ Over the two-day event, we had the privilege of speaking with more than 100 deve A few questions came up repeatedly: -* **"Is Valkey really a drop-in replacement for Redis OSS?"** — Yes. Valkey is fully protocol-compatible with Redis OSS 7.2, meaning existing Laravel applications work seamlessly without any code changes. -* **"What's the story behind Valkey?"** — Valkey was created to ensure the community always has access to a truly open source, permissively licensed (BSD 3-Clause) key-value store. It is governed by the Linux Foundation and maintained by contributors from a wide range of organizations worldwide. -* **"Can I run Valkey anywhere?"** — Absolutely. Valkey runs on premises, in any cloud environment, or in hybrid deployments. You control where your data lives. +* **"Is Valkey really a drop-in replacement for Redis OSS?"** — Yes. + Valkey is fully protocol-compatible with Redis OSS 7.2, meaning existing Laravel applications work seamlessly without any code changes. +* **"What's the story behind Valkey?"** — Valkey was created to ensure the community always has access to a truly open source, permissively licensed (BSD 3-Clause) key-value store. + It is governed by the Linux Foundation and maintained by contributors from a wide range of organizations worldwide. +* **"Can I run Valkey anywhere?"** — Absolutely. + Valkey runs on premises, in any cloud environment, or in hybrid deployments. + You control where your data lives. * **"What about performance?"** — Valkey 8.x delivers up to **230% performance improvement** over Valkey 7.2, supporting up to **1.2 million operations per second per server** and up to **1 billion operations per second per cluster** in version 9.0, all with sub-millisecond latency. The energy at the booth was a clear signal: developers want open-source software they can trust, inspect, and run anywhere; and Valkey delivers exactly that. @@ -87,9 +91,11 @@ REDIS_HOST=redis.example.com REDIS_HOST=valkey.example.com ``` -That's it. You are on Valkey. +That's it. +You are on Valkey. -No code refactoring. No compatibility issues. +No code refactoring. +No compatibility issues. Your existing Laravel configuration for cache, sessions, queues, and broadcasting continues to work exactly as before. @@ -185,7 +191,15 @@ event(new OrderShipped($orded)); ## The Open Source Advantage -It would be easy to frame Valkey purely as a performance story, and the numbers are genuinely impressive. But the deeper story is about what open source software means for the developer community. When a project is governed by a neutral foundation, licensed permissively, and built by contributors who aren't beholden to a single commercial interest, developers can build on it with confidence. They know the rules won't change. They know the community has a voice. They know their contributions matter. That's what Valkey represents, and it's why the response at Laracon India was so enthusiastic. The Laravel community has always understood the value of open-source software. Valkey fits right in. +It would be easy to frame Valkey purely as a performance story, and the numbers are genuinely impressive. +But the deeper story is about what open source software means for the developer community. +When a project is governed by a neutral foundation, licensed permissively, and built by contributors who aren't beholden to a single commercial interest, developers can build on it with confidence. +They know the rules won't change. +They know the community has a voice. +They know their contributions matter. +That's what Valkey represents, and it's why the response at Laracon India was so enthusiastic. +The Laravel community has always understood the value of open-source software. +Valkey fits right in. ## Join the Valkey Community @@ -196,7 +210,8 @@ Whether you're adopting Valkey in your next project, contributing to the codebas * **GitHub**: [github.com/valkey-io/valkey](https://github.com/valkey-io/valkey) — Star the repo, open issues, and contribute * **Website**: [valkey.io](https://valkey.io/) — Documentation, release notes, and community resources * If you would like to contribute to the mission, please consider joining the [Valkey community](https://valkey.io/community/), where community members contribute and shape the future of the Valkey project. -* Valkey is moving fast and the easiest way to stay ahead is to [subscribe](https://valkey.io/blog/valkey-newsletter-new/#email-signup) to the official Valkey newsletter. You can also follow along on Valkey social channels for the latest Valkey community news, event recaps, and project developments ([LinkedIn](https://www.linkedin.com/company/valkey/), [X](https://x.com/valkey_io), and [BlueSky](https://bsky.app/profile/valkeyio.bsky.social)). +* Valkey is moving fast and the easiest way to stay ahead is to [subscribe](https://valkey.io/blog/valkey-newsletter-new/#email-signup) to the official Valkey newsletter. + You can also follow along on Valkey social channels for the latest Valkey community news, event recaps, and project developments ([LinkedIn](https://www.linkedin.com/company/valkey/), [X](https://x.com/valkey_io), and [BlueSky](https://bsky.app/profile/valkeyio.bsky.social)). ## Closing Thoughts diff --git a/content/blog/2026-04-28-on-release-candidates/index.md b/content/blog/2026-04-28-on-release-candidates/index.md index 73de0888..e8442b58 100644 --- a/content/blog/2026-04-28-on-release-candidates/index.md +++ b/content/blog/2026-04-28-on-release-candidates/index.md @@ -10,25 +10,49 @@ featured = true featured_image = "/assets/media/featured/random-05.webp" +++ -A *release candidate* (RC) just came out for Valkey. You’ve likely heard of the term before but do you know what it *really* means, especially in terms of Valkey? And do you know if you should care about this release? If any of those questions pique your interest, read on. - -Before pulling apart the specific reasons to use a release candidate, it’s important to talk about generally available (GA) releases in Valkey. Valkey broadly follows the SemVer spec so there are two types of GA releases in Valkey: *feature* and *patch*. Valkey has two types of *feature* releases: major release (N.0.0: for example 8.0.0, 9.0.0, etc.) and minor release (X.N.0: 8.1.0, 9.1.0, etc.). Alternately, *patch* releases are patches (X.X.N: 7.2.6, 8.0.1, 8.1.1, etc.). - -For each feature release, there is at least one release candidate. A release candidate is a trial release for the GA : the release *should* include all user-surfaced features and changes of planned for the GA. ‘Should’ in the previous sentence is doing a lot of heavy lifting: because the RC is a trial it doesn’t mean it’s perfect. Indeed, a great time to have a release oopsy is during a release candidate, not the GA. The other component is that *internal* changes may not make it to the first release candidate known as ‘rc1’. After the first release there may be subsequent release candidates in sequential order: ‘rc2’, ‘rc3’, and so on. There are as many release candidates as needed but typically expect 2 or 3 release candidates per GA version. After the final release candidate there is the GA release of the version with the delta between the final RC and GA intended to be small. Patche releases typically don’t have release candidates as they are designed to only fix bugs and consequently the scope is more limited. +A *release candidate* (RC) just came out for Valkey. +You’ve likely heard of the term before but do you know what it *really* means, especially in terms of Valkey? +And do you know if you should care about this release? +If any of those questions pique your interest, read on. + +Before pulling apart the specific reasons to use a release candidate, it’s important to talk about generally available (GA) releases in Valkey. +Valkey broadly follows the SemVer spec so there are two types of GA releases in Valkey: *feature* and *patch*. +Valkey has two types of *feature* releases: major release (N.0.0: for example 8.0.0, 9.0.0, etc.) and minor release (X.N.0: 8.1.0, 9.1.0, etc.). +Alternately, *patch* releases are patches (X.X.N: 7.2.6, 8.0.1, 8.1.1, etc.). + +For each feature release, there is at least one release candidate. +A release candidate is a trial release for the GA : the release *should* include all user-surfaced features and changes of planned for the GA. +‘Should’ in the previous sentence is doing a lot of heavy lifting: because the RC is a trial it doesn’t mean it’s perfect. +Indeed, a great time to have a release oopsy is during a release candidate, not the GA. +The other component is that *internal* changes may not make it to the first release candidate known as ‘rc1’. +After the first release there may be subsequent release candidates in sequential order: ‘rc2’, ‘rc3’, and so on. +There are as many release candidates as needed but typically expect 2 or 3 release candidates per GA version. +After the final release candidate there is the GA release of the version with the delta between the final RC and GA intended to be small. +Patche releases typically don’t have release candidates as they are designed to only fix bugs and consequently the scope is more limited. ![A diagram showing GA, RC, major, minor, and patch](rc-blog-diagram.png) ## Who should and shouldn’t use a release candidate? -Release candidates are intended for testing, so if you have a need to try out Valkey before the generally available release, then *maybe* a release candidate is something you should take for a spin. Release candidates are a great opportunity to provide feedback on changes, especially if whatever you build has an impact beyond just your own project. If you build tools, frameworks, platforms, integrations, packages, hardware, or modules you probably want to test out at least the first RC and pay attention to the release notes of the later RCs to understand if you need to test further. +Release candidates are intended for testing, so if you have a need to try out Valkey before the generally available release, then *maybe* a release candidate is something you should take for a spin. +Release candidates are a great opportunity to provide feedback on changes, especially if whatever you build has an impact beyond just your own project. +If you build tools, frameworks, platforms, integrations, packages, hardware, or modules you probably want to test out at least the first RC and pay attention to the release notes of the later RCs to understand if you need to test further. -Valkey has a very strict interpretation of compatibility and goes to great lengths to make sure the the API just doesn’t break. So, if you’re concerned about the Valkey API continuing to be compatible with your bespoke software, it’s probably not necessary to try out every release candidate and you can just adopt at the generally available stage. Also, keep in mind that a release candidate is never intended for a production system: it could have bugs or exploits that aren’t clearly disclosed later. +Valkey has a very strict interpretation of compatibility and goes to great lengths to make sure the the API just doesn’t break. +So, if you’re concerned about the Valkey API continuing to be compatible with your bespoke software, it’s probably not necessary to try out every release candidate and you can just adopt at the generally available stage. +Also, keep in mind that a release candidate is never intended for a production system: it could have bugs or exploits that aren’t clearly disclosed later. -However, beyond testing, release candidates gives you a little bit of lead time for building against the stabilized API. Say, for example, you want to adopt a new command. You can wait until the version of Valkey goes GA then start development *or* you can throw the release candidate on a development machine and start writing code for it. Keep in mind that your client library may not have this new command yet if you’re very early (or the client library itself may also have an RC process). +However, beyond testing, release candidates gives you a little bit of lead time for building against the stabilized API. +Say, for example, you want to adopt a new command. +You can wait until the version of Valkey goes GA then start development *or* you can throw the release candidate on a development machine and start writing code for it. +Keep in mind that your client library may not have this new command yet if you’re very early (or the client library itself may also have an RC process). ## Getting a release candidate -Release candidates aren’t made available with a lot of hoopla: no big press releases, no social media notices, (typically) no blog post, and (usually) not on package managers or standalone packages. Valkey releases candidates are [published on GitHub](https://github.com/valkey-io/valkey/releases) (also as a [feed](https://github.com/valkey-io/valkey/releases.atom)) with a link to the source code, from here you can download and build the software yourself. Personally, I don’t download the software but rather do everything via git. In this example, the tag for the first release candidate of Valkey 9.1.0-rc1 is `9.1.0-rc1` and I have a remote called ‘upstream’ pointed at [`github.com/valkey-io/valkey`](https://github.com/valkey-io/valkey). +Release candidates aren’t made available with a lot of hoopla: no big press releases, no social media notices, (typically) no blog post, and (usually) not on package managers or standalone packages. +Valkey releases candidates are [published on GitHub](https://github.com/valkey-io/valkey/releases) (also as a [feed](https://github.com/valkey-io/valkey/releases.atom)) with a link to the source code, from here you can download and build the software yourself. +Personally, I don’t download the software but rather do everything via git. +In this example, the tag for the first release candidate of Valkey 9.1.0-rc1 is `9.1.0-rc1` and I have a remote called ‘upstream’ pointed at [`github.com/valkey-io/valkey`](https://github.com/valkey-io/valkey). ```shell @@ -41,7 +65,8 @@ $ make all Alternately, Valkey publishes release candidates on Docker Hub as a [tag on the container](https://hub.docker.com/r/valkey/valkey/#user-content-release-candidates), avoiding the need to build the software. -Once you have a built version of the RC, you’ll be able to start `valkey-server` and other tools as normal. If you run the `INFO` command against a RC version, you’ll notice a specific value for the `valkey_release_stage` property indicating which RC version is running. +Once you have a built version of the RC, you’ll be able to start `valkey-server` and other tools as normal. +If you run the `INFO` command against a RC version, you’ll notice a specific value for the `valkey_release_stage` property indicating which RC version is running. ```shell 127.0.0.1:6379> info @@ -54,8 +79,14 @@ valkey_release_stage:rc1 ## Feedback and next steps -When you test a release candidate, it’s important to report bugs promptly. While each individual feature is tested, your unique environment and use-case may reveal corner cases that are yet unknown. The best way to report feedback is via an issue on GitHub. Make sure when you report issues you clearly indicate that you’re using a release candidate. +When you test a release candidate, it’s important to report bugs promptly. +While each individual feature is tested, your unique environment and use-case may reveal corner cases that are yet unknown. +The best way to report feedback is via an issue on GitHub. +Make sure when you report issues you clearly indicate that you’re using a release candidate. -Primarily, release candidates help validate stability, compatibility, and performance. While the project values feedback of all forms, if you find out during a release candidate that you don’t like or agree with a new API, return values, or if you think something is missing or doesn’t belong, it's best to suggest the changes as soon as possible. It would be unlikely for a release candidate to trigger a large change in new features, but they may refine features or implement additional flags or configurations. +Primarily, release candidates help validate stability, compatibility, and performance. +While the project values feedback of all forms, if you find out during a release candidate that you don’t like or agree with a new API, return values, or if you think something is missing or doesn’t belong, it's best to suggest the changes as soon as possible. +It would be unlikely for a release candidate to trigger a large change in new features, but they may refine features or implement additional flags or configurations. -Evaluating and providing feedback on release candidates is a great way to contribute to the project. So, no matter if it is this release candidate or one in the future: blaze the trail and do your part to get that feedback in and make the Valkey GA release rock solid. \ No newline at end of file +Evaluating and providing feedback on release candidates is a great way to contribute to the project. +So, no matter if it is this release candidate or one in the future: blaze the trail and do your part to get that feedback in and make the Valkey GA release rock solid. \ No newline at end of file diff --git a/content/blog/2026-05-05-ai-agent-memory-with-valkey-and-mem0/index.md b/content/blog/2026-05-05-ai-agent-memory-with-valkey-and-mem0/index.md index 25341183..b435636d 100644 --- a/content/blog/2026-05-05-ai-agent-memory-with-valkey-and-mem0/index.md +++ b/content/blog/2026-05-05-ai-agent-memory-with-valkey-and-mem0/index.md @@ -10,36 +10,69 @@ featured = true featured_image = "/assets/media/featured/random-08.webp" +++ -AI agent memory turns a stateless large language model (LLM) into an assistant that knows its users and delivers personalized, relevant responses. Implementing an agent memory layer can cut token cost by up to 90% and keep responses under 2 seconds ([Mem0 benchmarks](https://mem0.ai/research-3)). Without memory, responses lose relevance, users repeat themselves, and token costs climb as raw history accumulates. +AI agent memory turns a stateless large language model (LLM) into an assistant that knows its users and delivers personalized, relevant responses. +Implementing an agent memory layer can cut token cost by up to 90% and keep responses under 2 seconds ([Mem0 benchmarks](https://mem0.ai/research-3)). +Without memory, responses lose relevance, users repeat themselves, and token costs climb as raw history accumulates. This post walks through how agent memory works and provides practical guidance, including an implementation using Valkey and Mem0 (an open-source memory framework), when to use file-based context versus a store-backed memory layer, infrastructure requirements for the storage layer, and best practices. ## Breaking Down AI Agent Interactions -A single turn in agentic applications consists of a message from the user and the agent response. Fulfilling that turn may require multiple steps: calling tools, querying databases, or reasoning through sub-tasks. **State memory** keeps track of task execution so the agent can continue from one step to the next. It records things like information collected, steps completed, and pending tasks. The state is often temporary, but in production systems it is commonly saved so work can resume after an interruption. For example, it ensures workflow continuity for tasks such as submitting an insurance claim or completing a multi-step checkout, so retries or users leaving mid-execution do not repeat the same work. It also supports multi-agent collaboration, where state acts as shared memory so one agent can work with another on the same workflow without each one having to reconstruct progress. State also supports human-in-the-loop flows, where the agent pauses for a human to provide input before continuing to the next step. You can use Valkey with frameworks such as [LangGraph checkpoints](https://pypi.org/project/langgraph-checkpoint-aws/) for workflow-state persistence and resume primitives for this scope. - -Beyond a single turn, a session is the full sequence of messages in one conversation. **Session memory** captures what the agent needs from the current conversation to interpret the next turn correctly. It is typically managed through message history, trimming, or compaction. This supports use cases such as resolving implicit references, where the user says "I liked the second one better" and the agent retains enough of the prior conversation to map those references to the right items. It also supports session continuity across devices and conversation-scoped constraints, such as "Keep this under $200". You can use Valkey with frameworks such as the [Strands Valkey Session Manager](https://strandsagents.com/docs/community/session-managers/strands-valkey-session-manager/) to persist conversation history and agent state across distributed environments. Under the hood, this is the same session-store pattern that applications have used Valkey for across web and mobile workloads, applied to conversation messages and agent state. - -When the user returns hours, days or weeks later and starts a new conversation, the agent needs context that outlasts any single conversation. **Long-term memory** includes persistent memory that the agent can reuse long after the current conversation ends. In practice, long-term memory often includes three forms: semantic memory for facts and preferences, episodic memory for past interactions and outcomes, and procedural memory for instructions or learned rules about how the agent should behave. Long-term memory helps the agent carry context across sessions, such as preferred languages, shopping choices, or shipping details so the user does not have to repeat them. You can use Valkey with frameworks such as [Mem0](https://mem0.ai) for memory operations including extraction, deduplication, consolidation, and scoped retrieval by user, agent, or session. [Benchmarks from Mem0](https://mem0.ai/research-3) show that memory can cut 90% of token costs and deliver sub-2s responses by retrieving only the memories that matter. For a full setup and step-by-step implementation walkthrough, follow the [Mem0 blog](https://mem0.ai/blog/build-persistent-memory-for-agentic-ai-applications-with-mem0-open-source-amazon-elasticache-for-valkey-and-amazon-neptune-analytics). +A single turn in agentic applications consists of a message from the user and the agent response. +Fulfilling that turn may require multiple steps: calling tools, querying databases, or reasoning through sub-tasks. +**State memory** keeps track of task execution so the agent can continue from one step to the next. +It records things like information collected, steps completed, and pending tasks. +The state is often temporary, but in production systems it is commonly saved so work can resume after an interruption. +For example, it ensures workflow continuity for tasks such as submitting an insurance claim or completing a multi-step checkout, so retries or users leaving mid-execution do not repeat the same work. +It also supports multi-agent collaboration, where state acts as shared memory so one agent can work with another on the same workflow without each one having to reconstruct progress. +State also supports human-in-the-loop flows, where the agent pauses for a human to provide input before continuing to the next step. +You can use Valkey with frameworks such as [LangGraph checkpoints](https://pypi.org/project/langgraph-checkpoint-aws/) for workflow-state persistence and resume primitives for this scope. + +Beyond a single turn, a session is the full sequence of messages in one conversation. +**Session memory** captures what the agent needs from the current conversation to interpret the next turn correctly. +It is typically managed through message history, trimming, or compaction. +This supports use cases such as resolving implicit references, where the user says "I liked the second one better" and the agent retains enough of the prior conversation to map those references to the right items. +It also supports session continuity across devices and conversation-scoped constraints, such as "Keep this under $200". +You can use Valkey with frameworks such as the [Strands Valkey Session Manager](https://strandsagents.com/docs/community/session-managers/strands-valkey-session-manager/) to persist conversation history and agent state across distributed environments. +Under the hood, this is the same session-store pattern that applications have used Valkey for across web and mobile workloads, applied to conversation messages and agent state. + +When the user returns hours, days or weeks later and starts a new conversation, the agent needs context that outlasts any single conversation. +**Long-term memory** includes persistent memory that the agent can reuse long after the current conversation ends. +In practice, long-term memory often includes three forms: semantic memory for facts and preferences, episodic memory for past interactions and outcomes, and procedural memory for instructions or learned rules about how the agent should behave. +Long-term memory helps the agent carry context across sessions, such as preferred languages, shopping choices, or shipping details so the user does not have to repeat them. +You can use Valkey with frameworks such as [Mem0](https://mem0.ai) for memory operations including extraction, deduplication, consolidation, and scoped retrieval by user, agent, or session. +[Benchmarks from Mem0](https://mem0.ai/research-3) show that memory can cut 90% of token costs and deliver sub-2s responses by retrieving only the memories that matter. +For a full setup and step-by-step implementation walkthrough, follow the [Mem0 blog](https://mem0.ai/blog/build-persistent-memory-for-agentic-ai-applications-with-mem0-open-source-amazon-elasticache-for-valkey-and-amazon-neptune-analytics). ## How to Add Memory to Agents -There are two broad ways to add memory to agents, and the main distinctions are: who needs access to the memory, where it must be available, how long it should persist, and whether it must be queried dynamically. Broadly, memory is either file-based context loaded into the prompt at session start, or a store-backed memory layer that the agent reads from and writes to at runtime. +There are two broad ways to add memory to agents, and the main distinctions are: who needs access to the memory, where it must be available, how long it should persist, and whether it must be queried dynamically. +Broadly, memory is either file-based context loaded into the prompt at session start, or a store-backed memory layer that the agent reads from and writes to at runtime. -Stable, shared guidance that is known before a session begins belongs in file-based context and is typically used for coding conventions, build commands, architecture notes, review checklists, and other persistent project instructions. [CLAUDE.md](https://code.claude.com/docs/en/memory), [Cursor Rules](https://cursor.com/docs/context/rules), and [OpenAI AGENTS.md](https://developers.openai.com/codex/guides/agents-md) are examples of this pattern. Claude Code uses CLAUDE.md for persistent instructions read at session start, Cursor Rules provides persistent project, team, and user rules, and OpenAI Codex reads AGENTS.md before doing any work. +Stable, shared guidance that is known before a session begins belongs in file-based context and is typically used for coding conventions, build commands, architecture notes, review checklists, and other persistent project instructions. +[CLAUDE.md](https://code.claude.com/docs/en/memory), [Cursor Rules](https://cursor.com/docs/context/rules), and [OpenAI AGENTS.md](https://developers.openai.com/codex/guides/agents-md) are examples of this pattern. +Claude Code uses CLAUDE.md for persistent instructions read at session start, Cursor Rules provides persistent project, team, and user rules, and OpenAI Codex reads AGENTS.md before doing any work. -A store-backed memory layer is the better fit for dynamic, mutable memory learned during execution. For example, runtime-learned information like user preferences and task progress is tied to a specific scope and needs to remain available across the boundaries the agent operates in. A store-backed memory layer makes that practical by persisting runtime state, scoping it with identifiers and supporting centralized access control, auditing, and managed deletion. +A store-backed memory layer is the better fit for dynamic, mutable memory learned during execution. +For example, runtime-learned information like user preferences and task progress is tied to a specific scope and needs to remain available across the boundaries the agent operates in. +A store-backed memory layer makes that practical by persisting runtime state, scoping it with identifiers and supporting centralized access control, auditing, and managed deletion. -Long-running agents make persistent memory outside the prompt a hard requirement. Anthropic describes the problem directly: agents "work in discrete sessions, and each new session begins with no memory of what came before," and their workaround is an explicit progress file and git history that act as a durable memory store the next session can read ([Anthropic, Effective harnesses for long-running agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents)). These systems operate across many context windows, and often multiple sessions or collaborating agents, so the active prompt alone cannot serve as the system's memory. This is where a store-backed memory layer like Valkey becomes useful, persisting runtime state outside the prompt and making it retrievable on demand across long-running workflows. +Long-running agents make persistent memory outside the prompt a hard requirement. +Anthropic describes the problem directly: agents "work in discrete sessions, and each new session begins with no memory of what came before," and their workaround is an explicit progress file and git history that act as a durable memory store the next session can read ([Anthropic, Effective harnesses for long-running agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents)). +These systems operate across many context windows, and often multiple sessions or collaborating agents, so the active prompt alone cannot serve as the system's memory. +This is where a store-backed memory layer like Valkey becomes useful, persisting runtime state outside the prompt and making it retrievable on demand across long-running workflows. ## Memory Layers: Under the Hood -This section uses Mem0 as an example to show what happens under the hood when the application writes and retrieves memory with Valkey. Mem0 represents each extracted fact as a discrete unit it calls a "memory", and stores it in Valkey with attributes for the memory content, scope, timestamps, metadata, and embedding. The sections below walk through how the application creates an index, stores memories, and retrieves memories against this index. +This section uses Mem0 as an example to show what happens under the hood when the application writes and retrieves memory with Valkey. +Mem0 represents each extracted fact as a discrete unit it calls a "memory", and stores it in Valkey with attributes for the memory content, scope, timestamps, metadata, and embedding. +The sections below walk through how the application creates an index, stores memories, and retrieves memories against this index. ### Index Creation -Mem0 creates a Valkey Search index over those documents so the application can combine scope and attribute filtering with vector similarity search. The schema looks like this: +Mem0 creates a Valkey Search index over those documents so the application can combine scope and attribute filtering with vector similarity search. +The schema looks like this: ```text FT.CREATE {collection_name} ON HASH PREFIX 1 {prefix} SCHEMA @@ -49,7 +82,9 @@ FT.CREATE {collection_name} ON HASH PREFIX 1 {prefix} SCHEMA created_at NUMERIC updated_at NUMERIC ``` -The `memory` attribute stores the extracted fact in natural language, and the `embedding` attribute stores its vector representation. Scope attributes `user_id`, `agent_id`, and `run_id` let the system narrow retrieval to the right user, agent, or session before running vector search. `created_at` and `updated_at` timestamps support filtering, updates, and lifecycle management. +The `memory` attribute stores the extracted fact in natural language, and the `embedding` attribute stores its vector representation. +Scope attributes `user_id`, `agent_id`, and `run_id` let the system narrow retrieval to the right user, agent, or session before running vector search. +`created_at` and `updated_at` timestamps support filtering, updates, and lifecycle management. ### Memory Storage Writing memories is a single call with conversation messages and identity attributes, and Mem0 handles extraction, deduplication, embedding, and storage. @@ -60,7 +95,10 @@ messages = [ {"role": "user", "content": "I prefer to work with Python"}, memory.add(messages, user_id="user_123", agent_id="assistant", run_id="session_456") ``` -Under the hood, the write path has three stages. First, the application sends the latest user message and assistant response to Mem0's memory-ingestion pipeline, which makes an LLM call to identify facts, preferences, or decisions worth storing. A single turn can yield multiple candidates, each handled independently in the next two stages. Second, for each candidate, Mem0 issues an [FT.SEARCH](https://valkey.io/commands/ft.search/) against Valkey for similar existing memories and decides whether to add, update, delete, or ignore it. +Under the hood, the write path has three stages. +First, the application sends the latest user message and assistant response to Mem0's memory-ingestion pipeline, which makes an LLM call to identify facts, preferences, or decisions worth storing. +A single turn can yield multiple candidates, each handled independently in the next two stages. +Second, for each candidate, Mem0 issues an [FT.SEARCH](https://valkey.io/commands/ft.search/) against Valkey for similar existing memories and decides whether to add, update, delete, or ignore it. ```text FT.SEARCH {collection_name} "@user_id:{user_123} @agent_id:{assistant} @run_id:{session_456} =>[KNN 5 @embedding $vec AS vector_score]" @@ -85,41 +123,70 @@ results = memory.search( user_id="user_123", run_id="123", agent_id="shopping_assistant", limit=5) ``` -Under the hood, the read path has three stages. First, Mem0 converts the query into a vector. Second, Mem0 executes a hybrid search on Valkey by combining scope filters such as `user_id`, `agent_id`, or `run_id` as tag filters along with the query embedding to return the most semantically similar memories within that scope. +Under the hood, the read path has three stages. +First, Mem0 converts the query into a vector. +Second, Mem0 executes a hybrid search on Valkey by combining scope filters such as `user_id`, `agent_id`, or `run_id` as tag filters along with the query embedding to return the most semantically similar memories within that scope. ```text FT.SEARCH {collection_name} "@user_id:{user_123} @agent_id:{shopping_assistant} @run_id:{123} =>[KNN 5 @embedding $vec AS vector_score]" PARAMS 2 vec DIALECT 2 ``` -Finally, the top memories are returned with scores and metadata so the application can inject them into the next prompt. This lets the system retrieve only the small working set relevant to the current step instead of replaying the full conversation history on every turn. +Finally, the top memories are returned with scores and metadata so the application can inject them into the next prompt. +This lets the system retrieve only the small working set relevant to the current step instead of replaying the full conversation history on every turn. ## Storage Layer Considerations -This section focuses on long-term memory, which puts the sharpest pressure on the storage layer. Unlike retrieval-augmented generation (RAG), which reads from a mostly static corpus, long-term memory is a live, mutation-heavy workload. A single interaction can produce several candidates, each triggering its own scoped lookup and an add, update, delete, or no-op decision. In practice, that means multiple small reads, searches, and writes per turn. The storage layer has to support the four requirements below so the agent can continuously learn, update, and reuse context. +This section focuses on long-term memory, which puts the sharpest pressure on the storage layer. +Unlike retrieval-augmented generation (RAG), which reads from a mostly static corpus, long-term memory is a live, mutation-heavy workload. +A single interaction can produce several candidates, each triggering its own scoped lookup and an add, update, delete, or no-op decision. +In practice, that means multiple small reads, searches, and writes per turn. +The storage layer has to support the four requirements below so the agent can continuously learn, update, and reuse context. ### 1. Scoped ownership and isolation -Agent memory must preserve who a memory belongs to and where it applies. In practice, that means scoping by identifiers such as `user_id`, `agent_id`, and `run_id`. These attributes are declared as TAG type in the Mem0 index schema, so the system can combine ownership filtering with semantic search in a single query. Alternatively, scoping can be represented using key and hash operations through namespaces such as `("memories", "{user_id}")` or `("users", "{user_id}", "profile")`, which provide fast retrieval and strict isolation, as seen in [LangGraph's store](https://docs.langchain.com/oss/python/langchain/long-term-memory). The choice is a tradeoff: TAG attributes keep ownership mutable and combine cleanly with vector search, while namespaced keys give stricter isolation and faster bulk scans but make re-scoping and cross-scope semantic search harder. +Agent memory must preserve who a memory belongs to and where it applies. +In practice, that means scoping by identifiers such as `user_id`, `agent_id`, and `run_id`. +These attributes are declared as TAG type in the Mem0 index schema, so the system can combine ownership filtering with semantic search in a single query. +Alternatively, scoping can be represented using key and hash operations through namespaces such as `("memories", "{user_id}")` or `("users", "{user_id}", "profile")`, which provide fast retrieval and strict isolation, as seen in [LangGraph's store](https://docs.langchain.com/oss/python/langchain/long-term-memory). +The choice is a tradeoff: TAG attributes keep ownership mutable and combine cleanly with vector search, while namespaced keys give stricter isolation and faster bulk scans but make re-scoping and cross-scope semantic search harder. ### 2. Frequent & fast mutation with read-after-write visibility -A single interaction can trigger multiple small memory operations, including similarity checks, updates, deletions, and inserts. The storage layer therefore needs to handle frequent small mutations at low latency, both during live memory formation and as stored memories are continuously revised over time. Slow writes force a bad tradeoff. Either the application waits for each write to commit before the next turn, which adds latency to every interaction, or it lets the next turn proceed against stale memory, which causes missed conflict resolution and duplicate memories. The risk is amplified in systems where multiple turns race to read and update the same state, such as collaborating agents or operational memory like checkpoints and cross-session work logs that require exact state. +A single interaction can trigger multiple small memory operations, including similarity checks, updates, deletions, and inserts. +The storage layer therefore needs to handle frequent small mutations at low latency, both during live memory formation and as stored memories are continuously revised over time. +Slow writes force a bad tradeoff. +Either the application waits for each write to commit before the next turn, which adds latency to every interaction, or it lets the next turn proceed against stale memory, which causes missed conflict resolution and duplicate memories. +The risk is amplified in systems where multiple turns race to read and update the same state, such as collaborating agents or operational memory like checkpoints and cross-session work logs that require exact state. -Valkey's short update latency removes the tradeoff by making memory updates become searchable in real time on the write path. In Valkey Search, the client that issued the mutation is blocked until the index updates complete, providing read-after-write visibility once the write returns. Multithreading strengthens this model under load: background worker threads process index updates, multiple parallel connections can saturate the indexing pipeline, and scaling to more vCPUs increases both ingest and query throughput. +Valkey's short update latency removes the tradeoff by making memory updates become searchable in real time on the write path. +In Valkey Search, the client that issued the mutation is blocked until the index updates complete, providing read-after-write visibility once the write returns. +Multithreading strengthens this model under load: background worker threads process index updates, multiple parallel connections can saturate the indexing pipeline, and scaling to more vCPUs increases both ingest and query throughput. ### 3. Fast selective retrieval under concurrent reads and writes -The purpose of agent memory is to avoid loading the full conversation history or user profile into the prompt on every turn. Instead, the application stores facts externally and retrieves only the subset that is relevant to the current task. That means the storage layer needs to support selective retrieval under tight latency budgets, often combining scope filters such as user, agent, or session with search and ranking over the memory corpus. Further, the storage layer must sustain high concurrent read and write traffic without letting foreground retrieval slow down, because memory reads still sit on the live execution path for many agent turns. To add some numbers, Mem0's [long-term memory architecture write-up](https://mem0.ai/blog/long-term-memory-ai-agents) suggests the operating point modern memory systems should target: support for up to 10K memories per user and sub-50 ms retrieval to retrieve 20 memories at the scale of multi-million 1536-dimensional embeddings. +The purpose of agent memory is to avoid loading the full conversation history or user profile into the prompt on every turn. +Instead, the application stores facts externally and retrieves only the subset that is relevant to the current task. +That means the storage layer needs to support selective retrieval under tight latency budgets, often combining scope filters such as user, agent, or session with search and ranking over the memory corpus. +Further, the storage layer must sustain high concurrent read and write traffic without letting foreground retrieval slow down, because memory reads still sit on the live execution path for many agent turns. +To add some numbers, Mem0's [long-term memory architecture write-up](https://mem0.ai/blog/long-term-memory-ai-agents) suggests the operating point modern memory systems should target: support for up to 10K memories per user and sub-50 ms retrieval to retrieve 20 memories at the scale of multi-million 1536-dimensional embeddings. -Valkey Search combines scope filters and vector retrieval in a single query and chooses the least expensive hybrid execution strategy based on filter selectivity. It runs on a multi-threaded, in-memory index that scales query and ingest throughput linearly with more vCPUs, so memory maintenance and live retrieval run concurrently without pushing reads off the inference path. [Valkey Search reports](https://valkey.io/topics/search/) single-digit millisecond latency and over 99% recall at billions of vectors. +Valkey Search combines scope filters and vector retrieval in a single query and chooses the least expensive hybrid execution strategy based on filter selectivity. +It runs on a multi-threaded, in-memory index that scales query and ingest throughput linearly with more vCPUs, so memory maintenance and live retrieval run concurrently without pushing reads off the inference path. +[Valkey Search reports](https://valkey.io/topics/search/) single-digit millisecond latency and over 99% recall at billions of vectors. ### 4. Mature caching and data life controls -Memory systems should provide Time-to-Live (TTL) controls to automatically expire memories to ensure freshness, and precise deletion controls for conflict resolution, privacy, and compliance. Valkey provides mature data life controls such as per-document expiration with [EXPIRE](https://valkey.io/commands/expire/) and [TTL](https://valkey.io/commands/ttl/), removal of expiration with [PERSIST](https://valkey.io/commands/persist/), and support for non-blocking deletion with [UNLINK](https://valkey.io/commands/unlink/). Valkey also supports hash-field expiration and introspection with commands such as [HEXPIRE](https://valkey.io/commands/hexpire/) and [HTTL](https://valkey.io/commands/httl/), making it easier to apply different retention windows within a single memory document. Together, these primitives let teams mix short-lived session memory, persistent long-term memory, and precise cleanup without building a separate lifecycle subsystem in the application. +Memory systems should provide Time-to-Live (TTL) controls to automatically expire memories to ensure freshness, and precise deletion controls for conflict resolution, privacy, and compliance. +Valkey provides mature data life controls such as per-document expiration with [EXPIRE](https://valkey.io/commands/expire/) and [TTL](https://valkey.io/commands/ttl/), removal of expiration with [PERSIST](https://valkey.io/commands/persist/), and support for non-blocking deletion with [UNLINK](https://valkey.io/commands/unlink/). +Valkey also supports hash-field expiration and introspection with commands such as [HEXPIRE](https://valkey.io/commands/hexpire/) and [HTTL](https://valkey.io/commands/httl/), making it easier to apply different retention windows within a single memory document. +Together, these primitives let teams mix short-lived session memory, persistent long-term memory, and precise cleanup without building a separate lifecycle subsystem in the application. ### Open Source Storage Options: A Side-by-Side -The table below uses the following scale to compare three popular vector search solutions. Best fit means a native, first-class primitive where the requirement is the default behavior. Strong fit means production-ready but may require configuration or carry known tradeoffs. Supported means achievable but with workarounds, application-level implementation, or tradeoffs that developers must actively manage. +The table below uses the following scale to compare three popular vector search solutions. +Best fit means a native, first-class primitive where the requirement is the default behavior. +Strong fit means production-ready but may require configuration or carry known tradeoffs. +Supported means achievable but with workarounds, application-level implementation, or tradeoffs that developers must actively manage. | Requirement | Valkey Search | Postgres + pgvector | OpenSearch | @@ -131,7 +198,9 @@ The table below uses the following scale to compare three popular vector search ## Production Patterns -**Anonymous-to-Authenticated Migration:** Many applications start with an anonymous session. When the user logs in, the agent needs to migrate session memories from the anonymous identifier to the authenticated user ID. In Valkey, this is a straightforward per-memory update, and because indexed attributes are refreshed on each write, the migrated memories become searchable under the new user ID immediately after the update completes: +**Anonymous-to-Authenticated Migration:** Many applications start with an anonymous session. +When the user logs in, the agent needs to migrate session memories from the anonymous identifier to the authenticated user ID. +In Valkey, this is a straightforward per-memory update, and because indexed attributes are refreshed on each write, the migrated memories become searchable under the new user ID immediately after the update completes: ```python # After user authenticates, migrate anonymous memories @@ -141,15 +210,27 @@ for mem in anonymous_memories: ``` This pattern depends on two Valkey properties established earlier: low-latency writes, so the migration completes in the time of a single user action, and read-after-write visibility on the Search index, so the next retrieval sees the memories under the new `user_id`. -**Concurrency and Consistency:** In distributed agent systems, memory bugs often come from overlapping writes or stale reads. Two agent turns may try to update the same memory at nearly the same time, causing lost updates, or one agent may read older state while another has already written a correction. Common mitigations are to serialize memory mutations per user or scope with a short-lived lock and, for high-impact attributes, version writes so downstream agents can require a minimum memory version before acting. Valkey provides the primitives for both patterns through [`SET`](https://valkey.io/commands/set/) `NX PX` for lightweight locks and [`INCR`](https://valkey.io/commands/incr/) for atomic version counters, while the coordination policy lives in the application. +**Concurrency and Consistency:** In distributed agent systems, memory bugs often come from overlapping writes or stale reads. +Two agent turns may try to update the same memory at nearly the same time, causing lost updates, or one agent may read older state while another has already written a correction. +Common mitigations are to serialize memory mutations per user or scope with a short-lived lock and, for high-impact attributes, version writes so downstream agents can require a minimum memory version before acting. +Valkey provides the primitives for both patterns through [`SET`](https://valkey.io/commands/set/) `NX PX` for lightweight locks and [`INCR`](https://valkey.io/commands/incr/) for atomic version counters, while the coordination policy lives in the application. -**Observability & Auditing:** Mem0 memory events and history help explain memory-driven LLM behavior, including why a fact was added, updated, deleted, or later retrieved, while Valkey provides storage- and index-level signals. If you need a Valkey-side audit stream for memory mutations, enable notify-keyspace-events and subscribe to keyspace or keyevent Pub/Sub channels; use MONITOR only for short-lived debugging. Latency regressions break turn responsiveness, so watch `memory_search_latency_p99` and `memory_write_latency_p99`. Memory drift breaks personalization, so watch memory counts per user or scope, mutation rates by outcome (add, update, delete, noop), and retrieval score distributions. Storage-layer issues break everything, so watch Valkey's `FT.INFO` for index state and `INFO` for server state. +**Observability & Auditing:** Mem0 memory events and history help explain memory-driven LLM behavior, including why a fact was added, updated, deleted, or later retrieved, while Valkey provides storage- and index-level signals. +If you need a Valkey-side audit stream for memory mutations, enable notify-keyspace-events and subscribe to keyspace or keyevent Pub/Sub channels; use MONITOR only for short-lived debugging. +Latency regressions break turn responsiveness, so watch `memory_search_latency_p99` and `memory_write_latency_p99`. +Memory drift breaks personalization, so watch memory counts per user or scope, mutation rates by outcome (add, update, delete, noop), and retrieval score distributions. +Storage-layer issues break everything, so watch Valkey's `FT.INFO` for index state and `INFO` for server state. -**Memory Index Health:** For indexes using the hierarchical navigable small world (HNSW), frequent deletes or overwrites can leave the index less efficient over time, increasing memory usage and degrading recall. In practice, monitor index health with FT.INFO and plan periodic rebuilds during low-traffic windows. +**Memory Index Health:** For indexes using the hierarchical navigable small world (HNSW), frequent deletes or overwrites can leave the index less efficient over time, increasing memory usage and degrading recall. +In practice, monitor index health with FT.INFO and plan periodic rebuilds during low-traffic windows. ## Conclusion -Agent memory turns stateless LLM calls into persistent, context-aware interactions. The core mechanics are consistent across frameworks: extract facts from conversations, embed for semantic retrieval, and scope access by user, agent, and session. The storage layer underneath determines how these operations perform at scale, particularly under the fan-out, write visibility, and lifecycle management patterns that distinguish agent memory from single-query RAG. This post walked through how memory works with Mem0 and Valkey, covering the schema design, write and read pipelines, scoped retrieval patterns, and lifecycle controls. The same architectural patterns apply regardless of which memory framework or storage backend you choose. +Agent memory turns stateless LLM calls into persistent, context-aware interactions. +The core mechanics are consistent across frameworks: extract facts from conversations, embed for semantic retrieval, and scope access by user, agent, and session. +The storage layer underneath determines how these operations perform at scale, particularly under the fan-out, write visibility, and lifecycle management patterns that distinguish agent memory from single-query RAG. +This post walked through how memory works with Mem0 and Valkey, covering the schema design, write and read pipelines, scoped retrieval patterns, and lifecycle controls. +The same architectural patterns apply regardless of which memory framework or storage backend you choose. Start with the configuration above by following this [blog](https://mem0.ai/blog/build-persistent-memory-for-agentic-ai-applications-with-mem0-open-source-amazon-elasticache-for-valkey-and-amazon-neptune-analytics), point it at your Valkey cluster, and iterate on your scoping and retention policies as your agent's memory needs evolve. diff --git a/content/blog/2026-05-12-introducing-valkey-admin-1-0-visual-cluster-management-for-valkey/index.md b/content/blog/2026-05-12-introducing-valkey-admin-1-0-visual-cluster-management-for-valkey/index.md index 6cc47d4b..4d923246 100644 --- a/content/blog/2026-05-12-introducing-valkey-admin-1-0-visual-cluster-management-for-valkey/index.md +++ b/content/blog/2026-05-12-introducing-valkey-admin-1-0-visual-cluster-management-for-valkey/index.md @@ -10,9 +10,14 @@ blog_type = ["Announcements"] featured = true +++ -[Valkey Admin](https://github.com/valkey-io/valkey-admin) is a new open source observability and management tool from the Valkey project that brings cluster visibility, data inspection, and troubleshooting into a single view. It ships as a native desktop application for macOS and Linux, and as a containerized web deployment on Docker and Kubernetes. Valkey Admin provides real-time cluster dashboards, topology visualization with per-node detail, a key browser, hot key identification, and aggregated command logs across the cluster. +[Valkey Admin](https://github.com/valkey-io/valkey-admin) is a new open source observability and management tool from the Valkey project that brings cluster visibility, data inspection, and troubleshooting into a single view. +It ships as a native desktop application for macOS and Linux, and as a containerized web deployment on Docker and Kubernetes. +Valkey Admin provides real-time cluster dashboards, topology visualization with per-node detail, a key browser, hot key identification, and aggregated command logs across the cluster. -Valkey users today have a mix of trusted tools: `valkey-cli` for direct inspection, Prometheus and Grafana for metrics, and community GUIs for key browsing and visualization. Each is mature and well-suited to its scope, and combining them is common practice. Putting together a cluster-wide picture still often takes work across shards, dashboards, and terminals. Valkey Admin adds a cluster-wide layer that pulls these signals into one place, designed to complement the tools users already use rather than replace them. +Valkey users today have a mix of trusted tools: `valkey-cli` for direct inspection, Prometheus and Grafana for metrics, and community GUIs for key browsing and visualization. +Each is mature and well-suited to its scope, and combining them is common practice. +Putting together a cluster-wide picture still often takes work across shards, dashboards, and terminals. +Valkey Admin adds a cluster-wide layer that pulls these signals into one place, designed to complement the tools users already use rather than replace them. In this post, we'll walk through what Valkey Admin does, how it detects hot keys, where you can run it, and how to get started. @@ -20,49 +25,75 @@ In this post, we'll walk through what Valkey Admin does, how it detects hot keys Valkey Admin organizes its capabilities around three user workflows: observability, inspection, and troubleshooting. -**Observability.** The dashboard shows real-time metrics including memory usage, CPU utilization, hit ratio, and command throughput, streamed over WebSocket, so the view reflects real-time changes without manual refresh. The cluster topology view renders a visual map of shards, primaries, and replicas, showing each node's role, host, and connection status. A disconnected replica or a node that cannot be reached will surface immediately on the map. +**Observability.** +The dashboard shows real-time metrics including memory usage, CPU utilization, hit ratio, and command throughput, streamed over WebSocket, so the view reflects real-time changes without manual refresh. +The cluster topology view renders a visual map of shards, primaries, and replicas, showing each node's role, host, and connection status. +A disconnected replica or a node that cannot be reached will surface immediately on the map. ![Cluster topology view rendering shards, primaries, and replicas as a connected graph, with each node showing its role, host, and connection status](valkey-admin_01-cluster-topology.png) ![Dashboard view showing real-time cluster metrics including memory usage, CPU utilization, hit ratio, and command throughput streamed over WebSocket](valkey-admin_02-dashboard-view.png) -**Inspection and interaction.** The key browser lets you browse, search, inspect, and edit keys across seven data types: String, Hash, List, Set, Sorted Set, Stream, and JSON. The browser lets you search by pattern or exact key name, with results capped for responsiveness on large keyspaces. This covers the common tasks of verifying key contents during incident response, checking TTLs, and confirming that application writes landed correctly. The send command panel lets you run any Valkey command with formatted response output and a searchable command history for the current session, for quick command execution and debugging. +**Inspection and interaction.** +The key browser lets you browse, search, inspect, and edit keys across seven data types: String, Hash, List, Set, Sorted Set, Stream, and JSON. +The browser lets you search by pattern or exact key name, with results capped for responsiveness on large keyspaces. +This covers the common tasks of verifying key contents during incident response, checking TTLs, and confirming that application writes landed correctly. +The send command panel lets you run any Valkey command with formatted response output and a searchable command history for the current session, for quick command execution and debugging. ![Key Browser view showing the distribution of keys across data types in the cluster, with counts for String, Hash, List, Set, Sorted Set, Stream, and JSON](valkey-admin_03-key-type-distribution.png) ![Key Browser inspection panel displaying a selected key's value, TTL, and metadata, with controls to edit the value and refresh the entry](valkey-admin_04-key-inspection.png) -**Troubleshooting.** Hot key detection identifies frequently accessed keys across the cluster (more on this in the next section). Command logs surface slow commands, large requests, and large replies aggregated across the cluster with node attribution, so you can trace latency spikes back to specific shards. Under the hood, Command logs analyze `COMMANDLOG` output, a Valkey 8.1 feature that tracks slow commands, large requests, and large replies in a single log. A typical triage path: dashboard for anomalies, command logs for the problematic commands, hot key detection to confirm the issue. +**Troubleshooting.** +Hot key detection identifies frequently accessed keys across the cluster (more on this in the next section). +Command logs surface slow commands, large requests, and large replies aggregated across the cluster with node attribution, so you can trace latency spikes back to specific shards. +Under the hood, Command logs analyze `COMMANDLOG` output, a Valkey 8.1 feature that tracks slow commands, large requests, and large replies in a single log. +A typical triage path: dashboard for anomalies, command logs for the problematic commands, hot key detection to confirm the issue. ![Activity view combining hot key detection results with command log entries for slow commands, large requests, and large replies, attributed to the originating cluster nodes](valkey-admin_05-activity-view.png) -These six features (dashboard, cluster topology, key browser, send command, hot key detection, command logs) ship in Valkey Admin 1.0. We welcome feedback on what to build next. +These six features (dashboard, cluster topology, key browser, send command, hot key detection, command logs) ship in Valkey Admin 1.0. +We welcome feedback on what to build next. ## Finding hot keys without slowing down your cluster -Hot key detection in Valkey often involves manual steps: knowing which commands to run (`CLUSTER SLOT-STATS`, `MONITOR`, `OBJECT FREQ`), connecting to the right nodes, parsing the output, and correlating results across shards. Valkey Admin picks the lowest-overhead detection method your cluster supports, so you get hot key visibility with minimal load on your cluster. It selects automatically based on server configuration to keep diagnostic load bounded. +Hot key detection in Valkey often involves manual steps: knowing which commands to run (`CLUSTER SLOT-STATS`, `MONITOR`, `OBJECT FREQ`), connecting to the right nodes, parsing the output, and correlating results across shards. +Valkey Admin picks the lowest-overhead detection method your cluster supports, so you get hot key visibility with minimal load on your cluster. +It selects automatically based on server configuration to keep diagnostic load bounded. -The default approach avoids `MONITOR`, which intercepts commands processed by the server and streams them back to the client. On a cluster already under pressure, that overhead can make the situation worse. +The default approach avoids `MONITOR`, which intercepts commands processed by the server and streams them back to the client. +On a cluster already under pressure, that overhead can make the situation worse. -**Hot slots (default when available).** When `CLUSTER SLOT-STATS` is available (Valkey 8.0+ with LFU eviction and cluster mode), Valkey Admin uses it as the low-overhead default. This method identifies hot slots by CPU usage. Because `CLUSTER SLOT-STATS` reads server-side counters, it has minimal performance impact on your cluster. Valkey Admin then resolves keys within the hot slots and retrieves their access frequency via `OBJECT FREQ `, which reports the LFU logarithmic access frequency counter. +**Hot slots (default when available).** +When `CLUSTER SLOT-STATS` is available (Valkey 8.0+ with LFU eviction and cluster mode), Valkey Admin uses it as the low-overhead default. +This method identifies hot slots by CPU usage. +Because `CLUSTER SLOT-STATS` reads server-side counters, it has minimal performance impact on your cluster. +Valkey Admin then resolves keys within the hot slots and retrieves their access frequency via `OBJECT FREQ `, which reports the LFU logarithmic access frequency counter. -To use hot slots, your cluster needs: Valkey 8.0 or later, cluster mode, `cluster-slot-stats-enabled=yes` in your server configuration, and an LFU eviction policy (`allkeys-lfu` or `volatile-lfu`). Under the hood, the query Valkey Admin runs looks like this: +To use hot slots, your cluster needs: Valkey 8.0 or later, cluster mode, `cluster-slot-stats-enabled=yes` in your server configuration, and an LFU eviction policy (`allkeys-lfu` or `volatile-lfu`). +Under the hood, the query Valkey Admin runs looks like this: ``` CLUSTER SLOT-STATS ORDERBY CPU-USEC LIMIT 50 ``` -This returns the fifty slots consuming the most CPU time, in descending order. Valkey Admin visualizes these results, resolves the keys in each slot, and ranks them by access frequency, turning a multi-step CLI workflow into a single view. +This returns the fifty slots consuming the most CPU time, in descending order. +Valkey Admin visualizes these results, resolves the keys in each slot, and ranks them by access frequency, turning a multi-step CLI workflow into a single view. ![Node heatmap visualizing CPU usage across cluster nodes, with hotter shards highlighted to identify slots with the most concentrated load](valkey-admin_06-node-heatmap.png) -**Monitor-based detection.** For any deployment where hot slots are not available, Valkey Admin uses the `MONITOR` command. It samples commands in real time across all monitored nodes, with configurable sampling duration and interval, then aggregates the results to surface the most frequently accessed keys. +**Monitor-based detection.** +For any deployment where hot slots are not available, Valkey Admin uses the `MONITOR` command. +It samples commands in real time across all monitored nodes, with configurable sampling duration and interval, then aggregates the results to surface the most frequently accessed keys. -Monitor-based detection works with any Valkey or Redis OSS version, in both standalone and cluster modes. The tradeoff is that `MONITOR` does add overhead while sampling is active, so Valkey Admin uses short, configurable sampling windows rather than continuous capture. Before switching to the higher-overhead `MONITOR`, the settings UI shows the performance warning, so the tradeoff is explicit. +Monitor-based detection works with any Valkey or Redis OSS version, in both standalone and cluster modes. +The tradeoff is that `MONITOR` does add overhead while sampling is active, so Valkey Admin uses short, configurable sampling windows rather than continuous capture. +Before switching to the higher-overhead `MONITOR`, the settings UI shows the performance warning, so the tradeoff is explicit. ## Run it where you run Valkey -Valkey Admin ships as a desktop application and as a containerized web deployment. Downloads for both live on the GitHub releases page: macOS users can choose the `.dmg` installer; Linux users can choose between AppImage and `.deb`. +Valkey Admin ships as a desktop application and as a containerized web deployment. +Downloads for both live on the GitHub releases page: macOS users can choose the `.dmg` installer; Linux users can choose between AppImage and `.deb`. Docker images are published to three registries: @@ -70,11 +101,18 @@ Docker images are published to three registries: - **Docker Hub:** `valkey/valkey-admin` - **Amazon ECR Public Gallery:** `public.ecr.aws/valkey/valkey-admin` -Valkey Admin connects to standalone instances and cluster mode deployments. TLS is supported via the `VALKEY_TLS` environment variable, password authentication is supported, and IAM authentication is available for managed services that use AWS IAM, via `VALKEY_AUTH_TYPE=iam`. For managed services that restrict certain administrative commands, Valkey Admin uses unrestricted alternatives where possible, so users get the same diagnostic signal without requiring elevated permissions. +Valkey Admin connects to standalone instances and cluster mode deployments. +TLS is supported via the `VALKEY_TLS` environment variable, password authentication is supported, and IAM authentication is available for managed services that use AWS IAM, via `VALKEY_AUTH_TYPE=iam`. +For managed services that restrict certain administrative commands, Valkey Admin uses unrestricted alternatives where possible, so users get the same diagnostic signal without requiring elevated permissions. -The tool works with Valkey 7.2+ and 8.x. The hot slots feature requires Valkey 8.0 or later for `CLUSTER SLOT-STATS` support; Command Logs requires 8.1+, all other features work across both major versions. +The tool works with Valkey 7.2+ and 8.x. +The hot slots feature requires Valkey 8.0 or later for `CLUSTER SLOT-STATS` support; Command Logs requires 8.1+, all other features work across both major versions. -For Kubernetes deployments, metrics servers run as sidecars on each Valkey primary pod. This architecture keeps the main Valkey Admin deployment small (approximately 1 GB RAM) while distributing metrics collection across the cluster. Pre-release validation ran Valkey Admin against clusters with up to 276 nodes. Resource sizing is modest overall: a cluster with 1 to 5 primaries runs comfortably on 2 vCPU and 2 GB RAM. The sizing formula scales linearly: RAM is `(primary nodes x 150 MB) + 1 GB`, and disk is `(primary nodes x 50 MB) + 1 GB`. +For Kubernetes deployments, metrics servers run as sidecars on each Valkey primary pod. +This architecture keeps the main Valkey Admin deployment small (approximately 1 GB RAM) while distributing metrics collection across the cluster. +Pre-release validation ran Valkey Admin against clusters with up to 276 nodes. +Resource sizing is modest overall: a cluster with 1 to 5 primaries runs comfortably on 2 vCPU and 2 GB RAM. +The sizing formula scales linearly: RAM is `(primary nodes x 150 MB) + 1 GB`, and disk is `(primary nodes x 50 MB) + 1 GB`. ### Docker deployment @@ -92,7 +130,11 @@ To pre-configure metrics collection at startup, set these environment variables: - `VALKEY_TLS`: set to `true` for TLS connections (defaults to `false`) - `VALKEY_AUTH_TYPE`: `password` or `iam` (defaults to `password`) -The `examples/` directory in the repo contains deployment guides for Docker, Kubernetes, and IAM authentication. Valkey Admin does not include built-in authentication for its web interface. In Docker and Kubernetes deployments, run it behind a reverse proxy or an auth layer such as an OAuth proxy, Cognito, or your identity provider. Metrics are captured per primary node. Replica observability is not independent; you see replica status through the cluster topology view, but metrics collection targets primaries. +The `examples/` directory in the repo contains deployment guides for Docker, Kubernetes, and IAM authentication. +Valkey Admin does not include built-in authentication for its web interface. +In Docker and Kubernetes deployments, run it behind a reverse proxy or an auth layer such as an OAuth proxy, Cognito, or your identity provider. +Metrics are captured per primary node. +Replica observability is not independent; you see replica status through the cluster topology view, but metrics collection targets primaries. ## Demo @@ -100,10 +142,16 @@ The `examples/` directory in the repo contains deployment guides for Docker, Kub ## Join the community -Valkey Admin gives Valkey users a unified tool for monitoring, inspecting, and troubleshooting Valkey clusters, whether you're running a three-node development cluster or a production deployment at scale. We invite you to try it out. +Valkey Admin gives Valkey users a unified tool for monitoring, inspecting, and troubleshooting Valkey clusters, whether you're running a three-node development cluster or a production deployment at scale. +We invite you to try it out. -The project lives at [github.com/valkey-io/valkey-admin](https://github.com/valkey-io/valkey-admin) under the Apache 2.0 license. To propose new features or significant changes, open a GitHub Issue with the `[RFC]` prefix; the maintainers review RFCs and guide them through design and implementation. Bug reports, documentation improvements, and pull requests of all sizes are welcome. +The project lives at [github.com/valkey-io/valkey-admin](https://github.com/valkey-io/valkey-admin) under the Apache 2.0 license. +To propose new features or significant changes, open a GitHub Issue with the `[RFC]` prefix; the maintainers review RFCs and guide them through design and implementation. +Bug reports, documentation improvements, and pull requests of all sizes are welcome. -We want to acknowledge the maintainers who have built Valkey Admin to 1.0: [@arseny-kostenko](https://github.com/arseny-kostenko), [@ravjotbrar](https://github.com/ravjotbrar), [@ArgusLi](https://github.com/ArgusLi), and [@nassery318](https://github.com/nassery318). The community made them stronger at every step. [@NormB](https://github.com/NormB) identified and fixed three password-handling bugs in the desktop connection flow, making authentication more reliable. [@nfunke](https://github.com/nfunke), [@maravisk](https://github.com/maravisk), [@rlunar](https://github.com/rlunar), [@Shirkulk007](https://github.com/Shirkulk007) tested pre-release builds and surfaced issues before GA. Valkey Admin would not have reached 1.0 without everyone who filed issues, tested builds, and submitted patches. +We want to acknowledge the maintainers who have built Valkey Admin to 1.0: [@arseny-kostenko](https://github.com/arseny-kostenko), [@ravjotbrar](https://github.com/ravjotbrar), [@ArgusLi](https://github.com/ArgusLi), and [@nassery318](https://github.com/nassery318). +The community made them stronger at every step. [@NormB](https://github.com/NormB) identified and fixed three password-handling bugs in the desktop connection flow, making authentication more reliable. [@nfunke](https://github.com/nfunke), [@maravisk](https://github.com/maravisk), [@rlunar](https://github.com/rlunar), [@Shirkulk007](https://github.com/Shirkulk007) tested pre-release builds and surfaced issues before GA. +Valkey Admin would not have reached 1.0 without everyone who filed issues, tested builds, and submitted patches. -The roadmap beyond 1.0 is open and community-driven. Big key detection, slot heat maps that visualize hot-slot distribution across the cluster, and Prometheus integration for the broader observability stack are options we are exploring, and we look forward to building them together. +The roadmap beyond 1.0 is open and community-driven. +Big key detection, slot heat maps that visualize hot-slot distribution across the cluster, and Prometheus integration for the broader observability stack are options we are exploring, and we look forward to building them together. diff --git a/content/blog/2026-05-19-valkey-9-1-delivers-improvements-in-security-performance-and-more/index.md b/content/blog/2026-05-19-valkey-9-1-delivers-improvements-in-security-performance-and-more/index.md index 20648c06..0bf61e2e 100644 --- a/content/blog/2026-05-19-valkey-9-1-delivers-improvements-in-security-performance-and-more/index.md +++ b/content/blog/2026-05-19-valkey-9-1-delivers-improvements-in-security-performance-and-more/index.md @@ -11,14 +11,17 @@ featured = true featured_image = "/assets/media/featured/Valkey-Release.svg" +++ -The Valkey community is excited to announce version 9.1.0 This latest release includes new functionality and improvements for security, observability, performance, efficiency, and tooling from over eighty contributors. Let's take a look at a few of the highlights in this release. +The Valkey community is excited to announce version 9.1.0 This latest release includes new functionality and improvements for security, observability, performance, efficiency, and tooling from over eighty contributors. +Let's take a look at a few of the highlights in this release. ## Security Release 9.1 strengthens Valkey's security capabilities with several important enhancements: -**Numbered Database-level Access Control:** Valkey enables stronger multi-tenant solution isolation and more granular security policies by allowing administrators to restrict which commands a user may execute with per-database granularity. Previously, ACL rules could control which commands a user could execute and which keys they could access, but that access applied to any database. With database-level ACLs, administrators and operators can now scope user permissions to specific databases. +**Numbered Database-level Access Control:** Valkey enables stronger multi-tenant solution isolation and more granular security policies by allowing administrators to restrict which commands a user may execute with per-database granularity. +Previously, ACL rules could control which commands a user could execute and which keys they could access, but that access applied to any database. +With database-level ACLs, administrators and operators can now scope user permissions to specific databases. As an example, we can create a user and limit their access to databases 0 and 1: ```bash @@ -39,9 +42,12 @@ But not database 2: (error) NOPERM No permissions to access database ``` -**Lua Moved to a Module:** Valkey 9.1 moves the Lua scripting engine into its own module, decoupling it from the core server. By extracting Lua into a module, Valkey reduces its security surface area and gives operators the option to disable Lua entirely if it is not required. To make it easier to understand which scripting engines are loaded, the [`INFO`](https://valkey.io/commands/info/) command has a new reply section named `Scripting Engines`. +**Lua Moved to a Module:** Valkey 9.1 moves the Lua scripting engine into its own module, decoupling it from the core server. +By extracting Lua into a module, Valkey reduces its security surface area and gives operators the option to disable Lua entirely if it is not required. +To make it easier to understand which scripting engines are loaded, the [`INFO`](https://valkey.io/commands/info/) command has a new reply section named `Scripting Engines`. -**TLS Improvements:** Valkey now displays TLS certificate expiration dates via the [`INFO`](https://valkey.io/commands/info/) command, making it easier to detect and avoid outages caused by expired TLS certificates. 9.1 also includes automatic background reloading of TLS certificates to enable rotation without downtime and support for TLS authentication using certificate Subject Alternate Name (SAN) URIs for easier mTLS integration. +**TLS Improvements:** Valkey now displays TLS certificate expiration dates via the [`INFO`](https://valkey.io/commands/info/) command, making it easier to detect and avoid outages caused by expired TLS certificates. +9.1 also includes automatic background reloading of TLS certificates to enable rotation without downtime and support for TLS authentication using certificate Subject Alternate Name (SAN) URIs for easier mTLS integration. ## Observability @@ -50,9 +56,11 @@ But not database 2: New observability features in Valkey 9.1.0 make it easier to understand how your server is performing: -**Main and I/O Thread Usage Metrics:** CPU usage metrics alone don’t provide enough insight into how loaded a Valkey server is, as the main thread and I/O threads will wait for work in a busy loop that can appear as near 100% CPU utilization, even if the threads are relatively idle. New cumulative metrics for main and I/O thread usage make it easier to monitor your server’s true load and tune accordingly. +**Main and I/O Thread Usage Metrics:** CPU usage metrics alone don’t provide enough insight into how loaded a Valkey server is, as the main thread and I/O threads will wait for work in a busy loop that can appear as near 100% CPU utilization, even if the threads are relatively idle. +New cumulative metrics for main and I/O thread usage make it easier to monitor your server’s true load and tune accordingly. -**JSON Logging:** Valkey can now emit server logs in JSON format with the `log-format json` configuration directive, making logs natively parseable by observability tools without custom parsing patterns. To emit logs in JSON format, add the following configuration to `valkey.conf`: +**JSON Logging:** Valkey can now emit server logs in JSON format with the `log-format json` configuration directive, making logs natively parseable by observability tools without custom parsing patterns. +To emit logs in JSON format, add the following configuration to `valkey.conf`: ```bash log-format json @@ -93,7 +101,8 @@ Each log line is a single JSON object: ![Performance: 2.1M requests per second on a single server](valkey-9-1_performance.png) -Valkey 9.1.0 pushes single server throughput to 2.1 million requests per second using 512-byte payloads, 9 IO threads, and a pipeline depth of 10 commands. You can explore the full results and compare across versions on the [Valkey Performance Dashboards](https://valkey.io/performance/). +Valkey 9.1.0 pushes single server throughput to 2.1 million requests per second using 512-byte payloads, 9 IO threads, and a pipeline depth of 10 commands. +You can explore the full results and compare across versions on the [Valkey Performance Dashboards](https://valkey.io/performance/). Notable performance enhancements in 9.1.0 include: @@ -105,7 +114,8 @@ Notable performance enhancements in 9.1.0 include: **Faster Sorted Set Queries**: Improvements to skiplist query processing makes sorted set operations like [`ZRANGEBYSCORE`](https://valkey.io/commands/zrangebyscore/) and [`ZRANGEBYLEX`](https://valkey.io/commands/zrangebylex/) faster. -**Cached COMMAND responses**: [`COMMAND`](https://valkey.io/commands/command/) responses are now cached. This may reduce connection establishment time for some clients which use this command as part of client initialization. +**Cached COMMAND responses**: [`COMMAND`](https://valkey.io/commands/command/) responses are now cached. +This may reduce connection establishment time for some clients which use this command as part of client initialization. **Enable Hardware Clock by default**: Valkey now enables hardware clock use by default, reducing the overhead of time-related system calls and improving GET and SET performance by up to 3% overall. @@ -131,7 +141,8 @@ Notable performance enhancements in 9.1.0 include: ### HGETDEL -The new [`HGETDEL`](https://valkey.io/commands/hgetdel/) command atomically retrieves and deletes one or more fields from a hash. This is useful for queue-like patterns where you need to consume and remove data in a single operation, eliminating the need to use a transaction with [`HGET`](https://valkey.io/commands/hget/) followed by an [`HDEL`](https://valkey.io/commands/hdel/). +The new [`HGETDEL`](https://valkey.io/commands/hgetdel/) command atomically retrieves and deletes one or more fields from a hash. +This is useful for queue-like patterns where you need to consume and remove data in a single operation, eliminating the need to use a transaction with [`HGET`](https://valkey.io/commands/hget/) followed by an [`HDEL`](https://valkey.io/commands/hdel/). Let's see a practical example showing a job hash where `status` and `payload` fields are atomically retrieved and removed in one call, leaving only the `retries` field behind. @@ -148,7 +159,9 @@ Let's see a practical example showing a job hash where `status` and `payload` fi ### MSETEX -The new [`MSETEX`](https://valkey.io/commands/msetex/) command allows you to set multiple keys with a shared expiration time in a single command. Previously, setting multiple keys with the same TTL required either multiple [`SETEX`](https://valkey.io/commands/setex/) calls or a pipeline of [`SET`](https://valkey.io/commands/set/) and [`EXPIRE`](https://valkey.io/commands/expire/) commands. [`MSETEX`](https://valkey.io/commands/msetex/) simplifies this common pattern and reduces round trips. +The new [`MSETEX`](https://valkey.io/commands/msetex/) command allows you to set multiple keys with a shared expiration time in a single command. +Previously, setting multiple keys with the same TTL required either multiple [`SETEX`](https://valkey.io/commands/setex/) calls or a pipeline of [`SET`](https://valkey.io/commands/set/) and [`EXPIRE`](https://valkey.io/commands/expire/) commands. +[`MSETEX`](https://valkey.io/commands/msetex/) simplifies this common pattern and reduces round trips. Let's see two examples: @@ -174,7 +187,9 @@ OK ### CLUSTERSCAN -The new [`CLUSTERSCAN`](https://valkey.io/commands/clusterscan/) command enables cluster-wide key scanning across nodes. Previously, scanning all keys in a cluster required clients to independently [`SCAN`](https://valkey.io/commands/scan/) each node and merge results. [`CLUSTERSCAN`](https://valkey.io/commands/clusterscan/) provides a unified interface for iterating over keys across the entire cluster, simplifying client implementations and operational tooling. +The new [`CLUSTERSCAN`](https://valkey.io/commands/clusterscan/) command enables cluster-wide key scanning across nodes. +Previously, scanning all keys in a cluster required clients to independently [`SCAN`](https://valkey.io/commands/scan/) each node and merge results. +[`CLUSTERSCAN`](https://valkey.io/commands/clusterscan/) provides a unified interface for iterating over keys across the entire cluster, simplifying client implementations and operational tooling. Let's explore some examples: @@ -230,6 +245,9 @@ Tooling improvements in 9.1.0 include: ## Thank You to Our Contributors -Over eighty individual contributors made Valkey 9.1.0 possible. For the full list of changes, see the release notes on GitHub [9.1.0-rc1](https://github.com/valkey-io/valkey/releases/tag/9.1.0-rc1) and [9.1.0-rc2](https://github.com/valkey-io/valkey/releases/tag/9.1.0-rc2). Thank you to everyone who contributed code, reported issues, reviewed pull requests, and helped make this release possible. Valkey continues to get better because you helped make it that way. +Over eighty individual contributors made Valkey 9.1.0 possible. +For the full list of changes, see the release notes on GitHub [9.1.0-rc1](https://github.com/valkey-io/valkey/releases/tag/9.1.0-rc1) and [9.1.0-rc2](https://github.com/valkey-io/valkey/releases/tag/9.1.0-rc2). +Thank you to everyone who contributed code, reported issues, reviewed pull requests, and helped make this release possible. +Valkey continues to get better because you helped make it that way. We encourage you to try Valkey 9.1.0 and share your feedback on [GitHub](https://github.com/valkey-io/valkey) and in the [Valkey community](https://valkey.io/community/). diff --git a/content/blog/2026-05-26-momento/index.md b/content/blog/2026-05-26-momento/index.md index 0a902537..7a5c40aa 100644 --- a/content/blog/2026-05-26-momento/index.md +++ b/content/blog/2026-05-26-momento/index.md @@ -10,42 +10,66 @@ blog_type = ["Community Highlight"] This segment features [Daniela Miao](https://www.linkedin.com/in/danielamiao/), Co-founder and CTO of [Momento](https://www.gomomento.com/), discussing her journey into open source, the technical advantages of building on Valkey, and how high-scale infrastructure supports some of the world's largest live events. ## Tell us a little bit about yourself, what Momento does, and your journey through open source and infrastructure. -I’m the Co-founder and CTO of Momento, where I oversee a low-latency distributed caching service built on Valkey. My background is in distributed systems, which started during my time at AWS on the DynamoDB team. That experience sparked my passion for developer products and mission-critical infrastructure. +I’m the Co-founder and CTO of Momento, where I oversee a low-latency distributed caching service built on Valkey. +My background is in distributed systems, which started during my time at AWS on the DynamoDB team. +That experience sparked my passion for developer products and mission-critical infrastructure. -After AWS, I joined LightStep, a startup that co-created OpenTelemetry. Seeing OpenTelemetry grow into a successful, vendor-neutral community inspired me to stay deeply involved in open source. Today at Momento, my co-founder Khawaja and I are applying the lessons we learned from managing massive distributed systems to the world of serverless caching. +After AWS, I joined LightStep, a startup that co-created OpenTelemetry. +Seeing OpenTelemetry grow into a successful, vendor-neutral community inspired me to stay deeply involved in open source. +Today at Momento, my co-founder Khawaja and I are applying the lessons we learned from managing massive distributed systems to the world of serverless caching. ## What Valkey offerings does Momento provide, and when do you recommend using Valkey specifically? We provide two primary tiers for users: -* **Serverless Caching (SaaS)**: Our flagship service is completely hands-off. Developers don’t need to choose instance types or manage provisioning. It’s built on Valkey, but we handle all the internals. -* **Managed Valkey (VPC)**: For enterprises that need stricter governance, we offer a version that deploys directly into the customer’s VPC. This gives teams full control over instance types, memory, and specific Valkey configurations. +* **Serverless Caching (SaaS)**: Our flagship service is completely hands-off. + Developers don’t need to choose instance types or manage provisioning. + It’s built on Valkey, but we handle all the internals. +* **Managed Valkey (VPC)**: For enterprises that need stricter governance, we offer a version that deploys directly into the customer’s VPC. + This gives teams full control over instance types, memory, and specific Valkey configurations. -I recommend Valkey for any project that needs an ultra-fast, high-scale cache. It’s incredibly memory efficient, our internal data shows that upgrading to newer Valkey versions can significantly reduce memory usage for the same data, which means more throughput on the same hardware. +I recommend Valkey for any project that needs an ultra-fast, high-scale cache. +It’s incredibly memory efficient, our internal data shows that upgrading to newer Valkey versions can significantly reduce memory usage for the same data, which means more throughput on the same hardware. ## What challenges does Valkey solve for your customers, and are there specific use cases where it excels? -Valkey really shines in “bursty” traffic scenarios, situations with huge spikes compared to average load. One example is our work with Fox during the 2025 Super Bowl, where there were 16 million concurrent viewers and the audience doubled in just five minutes during halftime. Valkey delivered the predictability we needed at that scale. If a system behaves predictably at a large scale, you can trust it to handle millions of users. +Valkey really shines in “bursty” traffic scenarios, situations with huge spikes compared to average load. +One example is our work with Fox during the 2025 Super Bowl, where there were 16 million concurrent viewers and the audience doubled in just five minutes during halftime. +Valkey delivered the predictability we needed at that scale. +If a system behaves predictably at a large scale, you can trust it to handle millions of users. -We see similar patterns in FinTech. When markets open, users expect immediate access to trade history and balances. Valkey’s ultra-low-latency path is designed exactly for these high-pressure, real-time environments. +We see similar patterns in FinTech. +When markets open, users expect immediate access to trade history and balances. +Valkey’s ultra-low-latency path is designed exactly for these high-pressure, real-time environments. ## What features or enhancements would you like to see in the future of Valkey? -I’m especially excited about native AI support. One area I’m focused on is using Valkey for KV cache, where session history is stored on the GPU during inference. +I’m especially excited about native AI support. +One area I’m focused on is using Valkey for KV cache, where session history is stored on the GPU during inference. -For LLMs to respond quickly, chat history needs to be cached efficiently, otherwise users hit the dreaded “spinner of death.” AI workloads also tend to involve much larger objects, sometimes gigabytes in size, so I’d love to see Valkey evolve to handle larger data structures while maintaining its performance. +For LLMs to respond quickly, chat history needs to be cached efficiently, otherwise users hit the dreaded “spinner of death.” +AI workloads also tend to involve much larger objects, sometimes gigabytes in size, so I’d love to see Valkey evolve to handle larger data structures while maintaining its performance. ## How can new users get started with the Valkey community or get in touch with Momento to help with performance features? -The Valkey community is incredibly welcoming and active, especially in Slack. There are dedicated channels for feature requests, benchmarking, and Kubernetes integration through the Valkey Operator. +The Valkey community is incredibly welcoming and active, especially in Slack. +There are dedicated channels for feature requests, benchmarking, and Kubernetes integration through the Valkey Operator. -I encourage both contributors and users interested in design discussions to get involved. We’re committed to keeping Valkey vendor-neutral; it’s not just one company’s project, but something shaped by a diverse group of contributors. My advice is simple: if you want to participate, just submit a PR. +I encourage both contributors and users interested in design discussions to get involved. +We’re committed to keeping Valkey vendor-neutral; it’s not just one company’s project, but something shaped by a diverse group of contributors. +My advice is simple: if you want to participate, just submit a PR. ## Do you have any “spicy” hot takes regarding the industry? -One of my hot takes is that the AI stack isn’t fundamentally different from the traditional database stack. A lot of developers feel like LLMs are a completely new paradigm, but the architecture is actually very similar to distributed systems. A request comes in, it gets routed to the right “storage” (the model), and data needs to be retrieved as fast as possible. I think we’ll see infrastructure and AI engineering converge more and more over time. +One of my hot takes is that the AI stack isn’t fundamentally different from the traditional database stack. +A lot of developers feel like LLMs are a completely new paradigm, but the architecture is actually very similar to distributed systems. +A request comes in, it gets routed to the right “storage” (the model), and data needs to be retrieved as fast as possible. +I think we’ll see infrastructure and AI engineering converge more and more over time. ## Any final thoughts for the community? -I really enjoy engaging with the community, whether it’s long-time contributors or people just getting started. At Momento, we aim to support everyone, from developers who want to scale from zero to a million users without worrying about infrastructure, to platform teams that need deep control. +I really enjoy engaging with the community, whether it’s long-time contributors or people just getting started. +At Momento, we aim to support everyone, from developers who want to scale from zero to a million users without worrying about infrastructure, to platform teams that need deep control. -At the end of the day, Valkey shows that diverse collaboration across companies and individuals leads to a stronger ecosystem. I’m excited to keep building that future together. +At the end of the day, Valkey shows that diverse collaboration across companies and individuals leads to a stronger ecosystem. +I’m excited to keep building that future together. ## Get involved -If you have questions, feedback, or just want to learn more, join our Slack community. It’s full of knowledgeable and helpful contributors who are happy to support questions, ideas, and discussions. +If you have questions, feedback, or just want to learn more, join our Slack community. +It’s full of knowledgeable and helpful contributors who are happy to support questions, ideas, and discussions. Other ways to connect: * Connect with us on [LinkedIn](https://www.linkedin.com/company/valkey/), [X](https://x.com/valkey_io), [BlueSky](https://bsky.app/profile/valkeyio.bsky.social) diff --git a/content/blog/2026-06-10-managing-connection-storms-in-valkey-at-scale/index.md b/content/blog/2026-06-10-managing-connection-storms-in-valkey-at-scale/index.md index 1d3f477b..6344d843 100644 --- a/content/blog/2026-06-10-managing-connection-storms-in-valkey-at-scale/index.md +++ b/content/blog/2026-06-10-managing-connection-storms-in-valkey-at-scale/index.md @@ -10,43 +10,80 @@ featured = true featured_image = "/assets/media/featured/random-07.webp" +++ -The alerts are firing. Users cannot complete requests. The cache dashboard shows CPU normal, memory normal, hit rate normal, p99 within SLA. The Valkey node metrics are all green. The cluster topology has not changed. Yet the application is still failing. - -This is one of the more disorienting situations in distributed systems. The component everyone assumes is the culprit is behaving perfectly, and the system is broken anyway. The failure is not in the cache itself. It is in how the cache interacts with everything around it: the clients, the connection pools, the proxies, and the retry logic baked into client libraries that were never designed to account for a fleet of thousands of service instances all responding to the same transient error at the same millisecond. - -At extreme scale, the hardest failures rarely come from a single component breaking. They come from *thousands of systems reacting to the same failure at the same moment*. - -At [Unlocked San Jose](https://unlockedconf.io) earlier this year, [Yang Yang](https://www.linkedin.com/in/yang-yang-b32703162/) and [Shawn Wang](https://www.linkedin.com/in/chipkernel/) from Uber and [Ovais Khan](https://www.linkedin.com/in/ovaiskhan/) from Snap each walked through what operating cache infrastructure at extreme scale teaches you. Uber runs roughly 1 billion RPS across 2,000 clusters. Snap recently completed a migration of 350 cache clusters off a long-lived Redis fork to Valkey. Neither talk was primarily about throughput. Both were about the failure modes that benchmarks never surface, and the safety mechanisms they use to prevent outages. +The alerts are firing. +Users cannot complete requests. +The cache dashboard shows CPU normal, memory normal, hit rate normal, p99 within SLA. +The Valkey node metrics are all green. +The cluster topology has not changed. +Yet the application is still failing. + +This is one of the more disorienting situations in distributed systems. +The component everyone assumes is the culprit is behaving perfectly, and the system is broken anyway. +The failure is not in the cache itself. +It is in how the cache interacts with everything around it: the clients, the connection pools, the proxies, and the retry logic baked into client libraries that were never designed to account for a fleet of thousands of service instances all responding to the same transient error at the same millisecond. + +At extreme scale, the hardest failures rarely come from a single component breaking. +They come from *thousands of systems reacting to the same failure at the same moment*. + +At [Unlocked San Jose](https://unlockedconf.io) earlier this year, [Yang Yang](https://www.linkedin.com/in/yang-yang-b32703162/) and [Shawn Wang](https://www.linkedin.com/in/chipkernel/) from Uber and [Ovais Khan](https://www.linkedin.com/in/ovaiskhan/) from Snap each walked through what operating cache infrastructure at extreme scale teaches you. +Uber runs roughly 1 billion RPS across 2,000 clusters. +Snap recently completed a migration of 350 cache clusters off a long-lived Redis fork to Valkey. +Neither talk was primarily about throughput. +Both were about the failure modes that benchmarks never surface, and the safety mechanisms they use to prevent outages. ## Benchmarks do not model your retry behavior -There is a specific failure mode called a [connection storm](https://www.gomomento.com/blog/understanding-the-nxm-problem-in-distributed-caches/). It's a classic example of a system doing exactly what it was designed to do and making everything worse. +There is a specific failure mode called a [connection storm](https://www.gomomento.com/blog/understanding-the-nxm-problem-in-distributed-caches/). +It's a classic example of a system doing exactly what it was designed to do and making everything worse. -Uber's microservices run many instances, each using a client with a connection pool per Valkey node. Under normal conditions this is efficient and fast. Then a node becomes briefly unavailable due to a network hiccup, a host reboot, or a momentary resource spike. The client detects the I/O error, closes the connection, and creates a new one. That is correct behavior for a single client. +Uber's microservices run many instances, each using a client with a connection pool per Valkey node. +Under normal conditions this is efficient and fast. +Then a node becomes briefly unavailable due to a network hiccup, a host reboot, or a momentary resource spike. +The client detects the I/O error, closes the connection, and creates a new one. +That is correct behavior for a single client. -The problem is that this happens across hundreds or thousands of instances simultaneously. Every instance that touched that node in the last few hundred milliseconds sees the same error. Every one of them closes its connection and immediately sends new connection requests to the already-stressed node. TCP handshakes, TLS negotiation, and authentication all land at once. The node, which might have recovered in seconds, instead hits 100% CPU and stops responding. +The problem is that this happens across hundreds or thousands of instances simultaneously. +Every instance that touched that node in the last few hundred milliseconds sees the same error. +Every one of them closes its connection and immediately sends new connection requests to the already-stressed node. +TCP handshakes, TLS negotiation, and authentication all land at once. +The node, which might have recovered in seconds, instead hits 100% CPU and stops responding. ![Connection storm diagram: many client instances simultaneously error, close, and reconnect to one Valkey node, driving it to 100% CPU and feeding a retry loop.](managing_connection_storms_1.webp) -The retry behavior that protects a single client destroys the cluster at fleet scale. Benchmarks never capture this because they do not model thousands of clients responding to shared state simultaneously. +The retry behavior that protects a single client destroys the cluster at fleet scale. +Benchmarks never capture this because they do not model thousands of clients responding to shared state simultaneously. -Uber's immediate fix was to use [`iptables` rules](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-iptables-on-ubuntu-14-04) to cut traffic to the impacted node before the feedback loop completed. Stopping the amplification gives the node space to recover without a continuing flood of new connection attempts. +Uber's immediate fix was to use [`iptables` rules](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-iptables-on-ubuntu-14-04) to cut traffic to the impacted node before the feedback loop completed. +Stopping the amplification gives the node space to recover without a continuing flood of new connection attempts. -The longer-term fix was structural. Upgrading their client from Go Redis v8 to v9 removed the aggressive connection reaping behavior that made the storm so severe. Adding per-node client-side rate limiters and circuit breakers meant that even if a node degraded, the client fleet could no longer amplify that degradation into an outage. +The longer-term fix was structural. +Upgrading their client from Go Redis v8 to v9 removed the aggressive connection reaping behavior that made the storm so severe. +Adding per-node client-side rate limiters and circuit breakers meant that even if a node degraded, the client fleet could no longer amplify that degradation into an outage. ## How Valkey responds to connection storms -This is where Valkey's architecture becomes directly relevant to the connection storm failure mode. The problem during a storm is that TLS handshakes and socket polling are expensive operations that compete with command execution on the main thread. +This is where Valkey's architecture becomes directly relevant to the connection storm failure mode. +The problem during a storm is that TLS handshakes and socket polling are expensive operations that compete with command execution on the main thread. -Valkey 8.0 significantly [overhauled I/O threading](https://valkey.io/blog/valkey-8-0-0-rc1/#performance), allowing the main thread and I/O threads to operate concurrently. I/O threads handle reading and parsing commands, writing responses, polling for I/O events via `epoll_wait`, and memory deallocation. Previously, `epoll_wait` alone consumed more than [20% of main thread time](https://valkey.io/blog/unlock-one-million-rps/#high-level-design). Offloading it frees the main thread to spend more cycles executing commands rather than managing I/O. +Valkey 8.0 significantly [overhauled I/O threading](https://valkey.io/blog/valkey-8-0-0-rc1/#performance), allowing the main thread and I/O threads to operate concurrently. +I/O threads handle reading and parsing commands, writing responses, polling for I/O events via `epoll_wait`, and memory deallocation. +Previously, `epoll_wait` alone consumed more than [20% of main thread time](https://valkey.io/blog/unlock-one-million-rps/#high-level-design). +Offloading it frees the main thread to spend more cycles executing commands rather than managing I/O. -The payoff showed up directly in the benchmarks. Against Valkey 7.2, throughput rose roughly 230% and average latency dropped 69.8%, measured with sequential [`SET`](https://valkey.io/commands/set/) commands on a single large instance. +The payoff showed up directly in the benchmarks. +Against Valkey 7.2, throughput rose roughly 230% and average latency dropped 69.8%, measured with sequential [`SET`](https://valkey.io/commands/set/) commands on a single large instance. ![Bar chart comparing Valkey 7.2 and 8.0. Throughput rises from 360K to 1.19M SET requests per second, a 230% increase; average latency falls from 1.792ms to 0.542ms, a 69.8% decrease.](managing_connection_storms_2.webp) -The main thread is the bottleneck during a storm, which is exactly what this threading work frees up. Valkey 8.1 went further, [offloading TLS negotiation to I/O threads](https://valkey.io/blog/valkey-8-1-0-ga/#i-o-threads-improvements). That change alone improved the rate of accepting new connections by around 300%, directly addressing the scenario where a burst of new connections during a storm previously blocked the main thread from serving existing ones. The same release also offloaded `SSL_pending()` and `ERR_clear_error()` calls to I/O threads, producing a measured 10% improvement in `SET` throughput and 22% in [`GET`](https://valkey.io/commands/get/) throughput for TLS workloads. +The main thread is the bottleneck during a storm, which is exactly what this threading work frees up. +Valkey 8.1 went further, [offloading TLS negotiation to I/O threads](https://valkey.io/blog/valkey-8-1-0-ga/#i-o-threads-improvements). +That change alone improved the rate of accepting new connections by around 300%, directly addressing the scenario where a burst of new connections during a storm previously blocked the main thread from serving existing ones. +The same release also offloaded `SSL_pending()` and `ERR_clear_error()` calls to I/O threads, producing a measured 10% improvement in `SET` throughput and 22% in [`GET`](https://valkey.io/commands/get/) throughput for TLS workloads. -To configure I/O threading, the key parameter is `io-threads`. One important detail: the count includes the main thread. Setting `io-threads 6` launches 5 dedicated I/O threads plus the main thread. The Valkey 9.0 [large cluster benchmark](https://valkey.io/blog/1-billion-rps/#benchmarking) used the following configuration on 8-core r7g.2xlarge nodes, pinning 2 cores to interrupt affinity and assigning the remaining 6 to Valkey: +To configure I/O threading, the key parameter is `io-threads`. +One important detail: the count includes the main thread. +Setting `io-threads 6` launches 5 dedicated I/O threads plus the main thread. +The Valkey 9.0 [large cluster benchmark](https://valkey.io/blog/1-billion-rps/#benchmarking) used the following configuration on 8-core r7g.2xlarge nodes, pinning 2 cores to interrupt affinity and assigning the remaining 6 to Valkey: ```bash # valkey.conf @@ -59,57 +96,100 @@ maxmemory 50gb save "" ``` -That setup achieved over 1 billion `SET` requests per second across a 2,000-node cluster, with throughput scaling nearly linearly with primary count. For production sizing, the practical starting point is `io-threads` equal to the available core count minus 1 to 2, with the remainder reserved for OS and interrupt handling. +That setup achieved over 1 billion `SET` requests per second across a 2,000-node cluster, with throughput scaling nearly linearly with primary count. +For production sizing, the practical starting point is `io-threads` equal to the available core count minus 1 to 2, with the remainder reserved for OS and interrupt handling. ### A proxy is not automatically a safety net -Uber's architecture includes a custom L4 proxy between application instances and the cache clusters. During the migration, their team found a second form of connection storm originating at the proxy layer. +Uber's architecture includes a custom L4 proxy between application instances and the cache clusters. +During the migration, their team found a second form of connection storm originating at the proxy layer. -During bursts of new connections, the proxy becomes a bottleneck. TLS setup, memory allocation for new connection state, and file descriptor management all compete for resources. Existing connections slow down. Slower connections trigger application timeouts. Timeouts trigger more retries. More retries create more new connections. The same feedback loop, one layer upstream. +During bursts of new connections, the proxy becomes a bottleneck. +TLS setup, memory allocation for new connection state, and file descriptor management all compete for resources. +Existing connections slow down. +Slower connections trigger application timeouts. +Timeouts trigger more retries. +More retries create more new connections. +The same feedback loop, one layer upstream. -This is where proxy design makes all the difference. A thin proxy that only forwards requests moves the failure mode behind a smaller number of ingress points. But a [well-designed routing layer](https://www.gomomento.com/blog/why-large-cache-systems-need-routing-layers/) does the opposite. By multiplexing many client connections into a small, stable set of backend connections, it shifts connection count from multiplicative to roughly linear and decouples backend connection pressure from client-side deployment churn. When application pods restart, they reconnect to long-lived routing nodes and the backend never sees the storm. The same component that amplifies a storm when built carelessly is one of the most effective tools for absorbing it when built well. +This is where proxy design makes all the difference. +A thin proxy that only forwards requests moves the failure mode behind a smaller number of ingress points. +But a [well-designed routing layer](https://www.gomomento.com/blog/why-large-cache-systems-need-routing-layers/) does the opposite. +By multiplexing many client connections into a small, stable set of backend connections, it shifts connection count from multiplicative to roughly linear and decouples backend connection pressure from client-side deployment churn. +When application pods restart, they reconnect to long-lived routing nodes and the backend never sees the storm. +The same component that amplifies a storm when built carelessly is one of the most effective tools for absorbing it when built well. -Uber addressed their proxy bottleneck by adding fairness algorithms to explicitly prioritize traffic from established connections over new ones. Under pressure, the proxy serves the work it has already committed to before taking on new work. +Uber addressed their proxy bottleneck by adding fairness algorithms to explicitly prioritize traffic from established connections over new ones. +Under pressure, the proxy serves the work it has already committed to before taking on new work. -A proxy that explicitly delays new connections while existing ones flow smoothly may look worse in a benchmark, but it behaves far better during an incident. Accepting less work is often more reliable than accepting all work slowly. +A proxy that explicitly delays new connections while existing ones flow smoothly may look worse in a benchmark, but it behaves far better during an incident. +Accepting less work is often more reliable than accepting all work slowly. ### Where the storms really come from Both of these storms are downstream of a structural issue: *too many connections.* -At Uber, each stateless service instance maintains a pool of `p` connections per Valkey node. If `n` instances are running, each node sees `n x p` connections. For a large service with thousands of instances and a pool size of even 5 to 10, a single node can see tens of thousands of connections under normal operation. During a retry storm, that number spikes sharply. +At Uber, each stateless service instance maintains a pool of `p` connections per Valkey node. +If `n` instances are running, each node sees `n x p` connections. +For a large service with thousands of instances and a pool size of even 5 to 10, a single node can see tens of thousands of connections under normal operation. +During a retry storm, that number spikes sharply. -This is not a misuse of the system. It is what direct-connect architectures look like at scale. The surface area for connection-related failure grows with every new service instance and every node added to the cluster. +This is not a misuse of the system. +It is what direct-connect architectures look like at scale. +The surface area for connection-related failure grows with every new service instance and every node added to the cluster. -Uber's mitigations focused on reducing the effective connection rate through client-side caching for hot keys to reduce round trips, request deduplication, and batching operations like hash-field deletions into multi-key commands. They also looked at I/O multiplexing through Java's Lettuce client (also available in [Valkey GLIDE](https://glide.valkey.io/concepts/architecture/async-execution/#rust-core-multiplexing)), which lets a single connection carry many concurrent requests and directly reduces the `p` in the `n x p` equation. Fewer connections per node means fewer to reestablish when retries amplify, which shrinks the blast radius of a connection storm. +Uber's mitigations focused on reducing the effective connection rate through client-side caching for hot keys to reduce round trips, request deduplication, and batching operations like hash-field deletions into multi-key commands. +They also looked at I/O multiplexing through Java's Lettuce client (also available in [Valkey GLIDE](https://glide.valkey.io/concepts/architecture/async-execution/#rust-core-multiplexing)), which lets a single connection carry many concurrent requests and directly reduces the `p` in the `n x p` equation. +Fewer connections per node means fewer to reestablish when retries amplify, which shrinks the blast radius of a connection storm. -But there's a tradeoff. Multiplexing many requests onto a single connection introduces head-of-line blocking. So a single slow command can stall the requests queued behind it on the same connection. It's most pronounced when a single multiplexed connection fans out across multiple clusters, where one slow node can hold up traffic bound for healthy ones. +But there's a tradeoff. +Multiplexing many requests onto a single connection introduces head-of-line blocking. +So a single slow command can stall the requests queued behind it on the same connection. +It's most pronounced when a single multiplexed connection fans out across multiple clusters, where one slow node can hold up traffic bound for healthy ones. -For Uber's workload the connection-fanout reduction outweighed that risk, and the Lettuce results were enough to push them toward evaluating the same multiplexing capability for their Go clients. New client libraries with multiplexing are now part of their Cache Platform 2.0 roadmap. +For Uber's workload the connection-fanout reduction outweighed that risk, and the Lettuce results were enough to push them toward evaluating the same multiplexing capability for their Go clients. +New client libraries with multiplexing are now part of their Cache Platform 2.0 roadmap. ## Build the safeguards before you need them -Snap moved 350 cache clusters off KeyDB, a multithreaded Redis 6.2 fork, to Valkey without application teams noticing the change. A proxy abstraction in front of their clusters made that possible. Application code kept using the same APIs while the backend swapped underneath. +Snap moved 350 cache clusters off KeyDB, a multithreaded Redis 6.2 fork, to Valkey without application teams noticing the change. +A proxy abstraction in front of their clusters made that possible. +Application code kept using the same APIs while the backend swapped underneath. But the interesting part of the story is what they built to make the migration safe. ### Load shedding at 95% CPU -When a cluster's CPU utilization crosses 95%, Snap throttles write requests. This sounds counterintuitive at first, but it is a textbook case of load shedding: deliberately dropping or degrading some work to keep the system as a whole alive. +When a cluster's CPU utilization crosses 95%, Snap throttles write requests. +This sounds counterintuitive at first, but it is a textbook case of load shedding: deliberately dropping or degrading some work to keep the system as a whole alive. -The power grid that supplies electricity to your house does the same thing. When demand threatens to exceed supply, utilities trigger controlled brownouts, intentionally reducing service to some customers because a partial, managed reduction is vastly preferable to an uncontrolled cascade that takes the entire grid down. +The power grid that supplies electricity to your house does the same thing. +When demand threatens to exceed supply, utilities trigger controlled brownouts, intentionally reducing service to some customers because a partial, managed reduction is vastly preferable to an uncontrolled cascade that takes the entire grid down. -The cache cluster faces the same choice. At 100% CPU, administrative commands no longer reach the cluster. Administrators cannot reconfigure it, diagnose it, or intervene. Throttling writes at 95% is the brownout: it deliberately degrades write throughput while the system is still controllable, preserving the headroom that operators and automation need to respond before the cluster becomes unreachable. +The cache cluster faces the same choice. +At 100% CPU, administrative commands no longer reach the cluster. +Administrators cannot reconfigure it, diagnose it, or intervene. +Throttling writes at 95% is the brownout: it deliberately degrades write throughput while the system is still controllable, preserving the headroom that operators and automation need to respond before the cluster becomes unreachable. -Snap is working to [contribute this behavior](https://github.com/valkey-io/valkey/issues/1688) to the Valkey project. The maintainers are working with the team on polishing the idea and requirements around it. +Snap is working to [contribute this behavior](https://github.com/valkey-io/valkey/issues/1688) to the Valkey project. +The maintainers are working with the team on polishing the idea and requirements around it. ### Replication buffer management and dual-channel replication -For high-memory workloads, Snap measured how quickly replication buffers filled during full syncs. In the traditional single-channel replication model, the primary buffers all new write commands in its Client Output Buffer (COB) while the RDB snapshot is being transferred. If the COB fills before the transfer completes, the replica is disconnected and the process starts over, resulting in a full-sync loop that never completes. From the outside it looks like slow replication, but in reality, it is an infinite retry cycle. +For high-memory workloads, Snap measured how quickly replication buffers filled during full syncs. +In the traditional single-channel replication model, the primary buffers all new write commands in its Client Output Buffer (COB) while the RDB snapshot is being transferred. +If the COB fills before the transfer completes, the replica is disconnected and the process starts over, resulting in a full-sync loop that never completes. +From the outside it looks like slow replication, but in reality, it is an infinite retry cycle. -Valkey 8.0 introduced [dual-channel replication](https://valkey.io/blog/valkey-8-0-0-rc1/#replication) to address this directly. Rather than a single connection handling both the RDB transfer and the incremental command stream, dual-channel replication opens a dedicated RDB channel for bulk data while maintaining a separate main channel for streaming updates. The replica buffers incremental updates locally while loading the snapshot and applies them once loading completes. COB pressure on the primary drops substantially because the primary no longer needs to buffer the entire write stream for the duration of a large sync. In scenarios with heavy read commands, sync time can be cut by up to 50%. +Valkey 8.0 introduced [dual-channel replication](https://valkey.io/blog/valkey-8-0-0-rc1/#replication) to address this directly. +Rather than a single connection handling both the RDB transfer and the incremental command stream, dual-channel replication opens a dedicated RDB channel for bulk data while maintaining a separate main channel for streaming updates. +The replica buffers incremental updates locally while loading the snapshot and applies them once loading completes. +COB pressure on the primary drops substantially because the primary no longer needs to buffer the entire write stream for the duration of a large sync. +In scenarios with heavy read commands, sync time can be cut by up to 50%. -Dual-channel replication has been available since Valkey 8.0, with one important detail: it engages only when diskless sync is enabled on the primary. With diskless sync off, replication falls back to the ordinary disk-based path and COB pressure stays on the primary. Both flags can be toggled at runtime without a restart, which makes it straightforward to validate against a live workload before committing: +Dual-channel replication has been available since Valkey 8.0, with one important detail: it engages only when diskless sync is enabled on the primary. +With diskless sync off, replication falls back to the ordinary disk-based path and COB pressure stays on the primary. +Both flags can be toggled at runtime without a restart, which makes it straightforward to validate against a live workload before committing: ```bash # valkey.conf @@ -117,26 +197,53 @@ repl-diskless-sync yes dual-channel-replication-enabled yes ``` -Replication progress during dual-channel sync is observable via `INFO replication`. The fields `replicas_repl_buffer_size` and `replicas_repl_buffer_peak` show accumulated replication stream data in bytes on the replica side, since with dual-channel replication that buffer now lives on the replica rather than the primary. +Replication progress during dual-channel sync is observable via `INFO replication`. +The fields `replicas_repl_buffer_size` and `replicas_repl_buffer_peak` show accumulated replication stream data in bytes on the replica side, since with dual-channel replication that buffer now lives on the replica rather than the primary. -Snap's operational approach layered on top of this: they measured buffer fill rates under realistic write load, selected a 15-minute threshold as safe for migration, and applied write throttling before buffers reached capacity. Now the intervention happens before the failure, instead of in response to it. +Snap's operational approach layered on top of this: they measured buffer fill rates under realistic write load, selected a 15-minute threshold as safe for migration, and applied write throttling before buffers reached capacity. +Now the intervention happens before the failure, instead of in response to it. ## The principle underneath it all These failure modes and their mitigations are variations on the idea that systems that hold up under pressure are the ones that make deliberate choices about what to do before they are overwhelmed. -Uber's `iptables` approach does not help a node that is already at 100% CPU. It prevents the feedback loop from reaching 100% by stopping retry amplification early. Snap's write throttling does not kick in when the cluster is already unmanageable. It preserves management access by acting at 95%. The replication buffer threshold is configured before the first migration starts, not after a sync loop incident. This functionality is also [being considered by the Valkey team](https://github.com/valkey-io/valkey/issues/1649). +Uber's `iptables` approach does not help a node that is already at 100% CPU. +It prevents the feedback loop from reaching 100% by stopping retry amplification early. +Snap's write throttling does not kick in when the cluster is already unmanageable. +It preserves management access by acting at 95%. +The replication buffer threshold is configured before the first migration starts, not after a sync loop incident. +This functionality is also [being considered by the Valkey team](https://github.com/valkey-io/valkey/issues/1649). -Valkey's architectural trajectory follows the same principle. I/O threading in 8.0 freed the main thread from socket polling. TLS offload in 8.1 removed a critical bottleneck in new connection acceptance. Dual-channel replication in 8.0 moved COB pressure off the primary. The cluster bus reconnection throttle in 9.0 prevented surviving nodes from overwhelming themselves during mass failure events. All of these are deliberate choices to keep the system manageable under load, not just fast in a benchmark. +Valkey's architectural trajectory follows the same principle. +I/O threading in 8.0 freed the main thread from socket polling. +TLS offload in 8.1 removed a critical bottleneck in new connection acceptance. +Dual-channel replication in 8.0 moved COB pressure off the primary. +The cluster bus reconnection throttle in 9.0 prevented surviving nodes from overwhelming themselves during mass failure events. +All of these are deliberate choices to keep the system manageable under load, not just fast in a benchmark. ## What to carry out of this -Werner Vogels famously said "*Everything fails, all the time.*" A benchmark measures the happy path, the ceiling you reach when nothing is going wrong. But how does your system behave when something goes wrong? When one node slows down and thousands of clients react in the same millisecond. - -Every technique helps you decide what to do before you are overwhelmed. Cut traffic to a degrading node before retries amplify into a storm. Prioritize established connections so the work already in flight survives the burst. Shed write load at 95% to keep the cluster reachable for the operators who have to save it. Enable dual-channel replication before a sync loop turns a large workload into an outage. These don't make your system faster, but they do make it survivable. - -That is the difference between a catastrophic outage and graceful degradation, and it is usually the difference between a team that planned for the failure and one that did not. Uber and Snap learned these lessons the hard way, in production, often in the hours after an outage. The point is not to copy their exact mitigations into your own system. The `iptables` rule, the 95% threshold, the 15-minute buffer window are all specific to their workloads. The point is to help you remember that failure is constant. So find where your system amplifies it, and decide your response before the incident, not during it. - -The benchmark tells you the ceiling. The safety net determines how far you fall when you exceed it, and whether recovery is possible. - -*To go deeper, watch the [Unlocked session replays](https://unlockedconf.io/san-jose-replays) and read the Valkey 8.0, 8.1, and 9.0 release posts linked throughout this article. Be sure to review your own client, proxy, and replication failure modes before they become production incidents.* +Werner Vogels famously said "*Everything fails, all the time.*" +A benchmark measures the happy path, the ceiling you reach when nothing is going wrong. +But how does your system behave when something goes wrong? +When one node slows down and thousands of clients react in the same millisecond. + +Every technique helps you decide what to do before you are overwhelmed. +Cut traffic to a degrading node before retries amplify into a storm. +Prioritize established connections so the work already in flight survives the burst. +Shed write load at 95% to keep the cluster reachable for the operators who have to save it. +Enable dual-channel replication before a sync loop turns a large workload into an outage. +These don't make your system faster, but they do make it survivable. + +That is the difference between a catastrophic outage and graceful degradation, and it is usually the difference between a team that planned for the failure and one that did not. +Uber and Snap learned these lessons the hard way, in production, often in the hours after an outage. +The point is not to copy their exact mitigations into your own system. +The `iptables` rule, the 95% threshold, the 15-minute buffer window are all specific to their workloads. +The point is to help you remember that failure is constant. +So find where your system amplifies it, and decide your response before the incident, not during it. + +The benchmark tells you the ceiling. +The safety net determines how far you fall when you exceed it, and whether recovery is possible. + +*To go deeper, watch the [Unlocked session replays](https://unlockedconf.io/san-jose-replays) and read the Valkey 8.0, 8.1, and 9.0 release posts linked throughout this article. +Be sure to review your own client, proxy, and replication failure modes before they become production incidents.* diff --git a/content/blog/2026-06-11-unlockedconference-recap/index.md b/content/blog/2026-06-11-unlockedconference-recap/index.md index 8767c4eb..f366ede4 100644 --- a/content/blog/2026-06-11-unlockedconference-recap/index.md +++ b/content/blog/2026-06-11-unlockedconference-recap/index.md @@ -10,23 +10,30 @@ blog_type = ["Community Highlight"] ![Unlocked Header](image1.png) -The best systems are often the boring ones. Boring because they continue working predictably when traffic spikes, dependencies drift, workloads evolve, or failures start cascading across systems at 3AM. +The best systems are often the boring ones. +Boring because they continue working predictably when traffic spikes, dependencies drift, workloads evolve, or failures start cascading across systems at 3AM. That idea was constant at [Unlocked Conference](https://www.unlockedconf.io/) in Seattle. -More than **140 engineers** representing over **50 companies** gathered at T-Mobile Park for a full day of **20 technical** talks and production-earned lessons building systems that hold up under pressure. Across sessions from Netflix, Snap, Reddit, Google, AWS, Apple and more, the focus stayed consistent: reliability over hype, predictability over peak benchmarks, and operational lessons learned the hard way. +More than **140 engineers** representing over **50 companies** gathered at T-Mobile Park for a full day of **20 technical** talks and production-earned lessons building systems that hold up under pressure. +Across sessions from Netflix, Snap, Reddit, Google, AWS, Apple and more, the focus stayed consistent: reliability over hype, predictability over peak benchmarks, and operational lessons learned the hard way. ## The Power of Community -The conference opened with [Sailesh Krishnamurthy](https://www.linkedin.com/in/saileshkrishnamurthy/) from Google highlighting *The Power of Community*. He focused on the momentum behind Valkey and the importance of open collaboration across companies working to solve shared infrastructure challenges together. That spirit carried throughout the day. Engineers openly shared tradeoffs and lessons learned from running some of the largest distributed systems in the world. +The conference opened with [Sailesh Krishnamurthy](https://www.linkedin.com/in/saileshkrishnamurthy/) from Google highlighting *The Power of Community*. +He focused on the momentum behind Valkey and the importance of open collaboration across companies working to solve shared infrastructure challenges together. +That spirit carried throughout the day. +Engineers openly shared tradeoffs and lessons learned from running some of the largest distributed systems in the world. ![Sailesh](image5.png) -[Jacob Murphy’s](https://www.linkedin.com/in/jacob-murphy-801078127/) keynote, *The 3AM Test: Why Boring Systems Let You Sleep At Night*, was the defining theme of the conference. He focused on the simple yet powerful idea that engineers desire systems that behave predictably focusing on reliable performance over hype. +[Jacob Murphy’s](https://www.linkedin.com/in/jacob-murphy-801078127/) keynote, *The 3AM Test: Why Boring Systems Let You Sleep At Night*, was the defining theme of the conference. +He focused on the simple yet powerful idea that engineers desire systems that behave predictably focusing on reliable performance over hype. -Discussions around Atomic Slot Migration, Forkless Sync, operational predictability, and reliability resurfaced throughout the day as engineers compared approaches to scaling infrastructure while approaching what Jacob describes as the “boring asymptote” of system design. The pursuit of a 100% reliable system. +Discussions around Atomic Slot Migration, Forkless Sync, operational predictability, and reliability resurfaced throughout the day as engineers compared approaches to scaling infrastructure while approaching what Jacob describes as the “boring asymptote” of system design. +The pursuit of a 100% reliable system. ![Jacob](image3.png) @@ -43,15 +50,18 @@ Across the sessions, several patterns emerged: Apple engineers delivered several standout sessions throughout the day focused on geo-replication, secure-by-default infrastructure, and the realities of maintaining predictable performance across globally distributed systems. -Netflix showed the breadth and depth of their caching solutions in *Thinking Beyond Demand-Filled Caching*, where [Sunjeet Singh](https://www.linkedin.com/in/sunjeet-singh/) and [William Schor](https://www.linkedin.com/in/william-schor/) shared how Netflix approaches versioned caches at scale. They challenged traditional assumptions around cache invalidation and consistency while showing how architectural decisions can eliminate operational problems before they happen. +Netflix showed the breadth and depth of their caching solutions in *Thinking Beyond Demand-Filled Caching*, where [Sunjeet Singh](https://www.linkedin.com/in/sunjeet-singh/) and [William Schor](https://www.linkedin.com/in/william-schor/) shared how Netflix approaches versioned caches at scale. +They challenged traditional assumptions around cache invalidation and consistency while showing how architectural decisions can eliminate operational problems before they happen. ![Sunjeet&William](image6.png) -Another strong theme throughout the day was how infrastructure engineering is evolving alongside AI workloads. In [Daniela Miao](https://www.linkedin.com/in/danielamiao/) and [Samuel Shen’s](https://www.linkedin.com/in/samuel-shen-b51585172/) session, *Towards Faster Inference: With KV Cache and Beyond*, they explored how modern LLM inference systems are increasingly becoming distributed systems problems themselves, especially around KV cache coordination and data movement. +Another strong theme throughout the day was how infrastructure engineering is evolving alongside AI workloads. +In [Daniela Miao](https://www.linkedin.com/in/danielamiao/) and [Samuel Shen’s](https://www.linkedin.com/in/samuel-shen-b51585172/) session, *Towards Faster Inference: With KV Cache and Beyond*, they explored how modern LLM inference systems are increasingly becoming distributed systems problems themselves, especially around KV cache coordination and data movement. ![Daniela&Samuel](image4.png) -The talk connected familiar distributed systems methods with a new generation of workloads. Discussions around cache reuse, inference bottlenecks, and orchestration continued long after the session ended. +The talk connected familiar distributed systems methods with a new generation of workloads. +Discussions around cache reuse, inference bottlenecks, and orchestration continued long after the session ended. The talks were deeply technical, but they also reflected a shift towards optimizing for systems that remain understandable and predictable under production level stress. @@ -61,12 +71,15 @@ Unlocked Seattle closed with a fireside chat about 3AM Pages featuring [Madelyn The chat focused on the realities of operating distributed systems at scale, like making sure your KPIs reflect the customer requirements, request cascades, infrastructure blind spots, and the operational decisions that separate manageable incidents from catastrophic outages. -More importantly, it reinforced the central idea behind Unlocked itself, that great infrastructure engineering is not about avoiding failure entirely. It’s about designing systems that fail predictably and recover gracefully. +More importantly, it reinforced the central idea behind Unlocked itself, that great infrastructure engineering is not about avoiding failure entirely. +It’s about designing systems that fail predictably and recover gracefully. ![Khawaja&Madelyn](image2.png) ## The Future of Reliable Systems -This Unlocked event showed the enormous momentum behind the community building the future of reliable distributed systems. The openness of the engineers willing to share their hard-earned lessons, deployment patterns, and product requests was truly a one-of-a-kind experience. +This Unlocked event showed the enormous momentum behind the community building the future of reliable distributed systems. +The openness of the engineers willing to share their hard-earned lessons, deployment patterns, and product requests was truly a one-of-a-kind experience. -Thank you to all of the speakers, attendees, sponsors, volunteers, and organizers who helped make Unlocked Seattle possible. And thank you to the engineers building the systems that let the rest of us sleep at night. +Thank you to all of the speakers, attendees, sponsors, volunteers, and organizers who helped make Unlocked Seattle possible. +And thank you to the engineers building the systems that let the rest of us sleep at night. diff --git a/content/blog/2026-06-24-secret-life-of-data/index.md b/content/blog/2026-06-24-secret-life-of-data/index.md index 893d3fb6..d205cc62 100644 --- a/content/blog/2026-06-24-secret-life-of-data/index.md +++ b/content/blog/2026-06-24-secret-life-of-data/index.md @@ -11,13 +11,22 @@ featured_image = "/assets/media/featured/random-05.webp" +++ -If you’ve used Valkey for very long you’re probably aware of the different primary data types in the core: strings, hashes, lists, sets, sorted sets, and streams. Each data type has an accompanying set of commands that manipulate that data type. For example, you use [`HSET`](/commands/hset/) to set a field and value pair to a hash, but you don’t use, for example, HSET to add an element to a list. What if I told you that there is an entire hidden layer that you never see unless you use a specific `OBJECT` command and can’t control unless you start tinkering with the configuration? And that this could have a profound effect on your total usable storage: enough that careful configuring could mean significant savings in your infrastructure. Read on to find out how you can understand and tweak the _real_ underlying structures. +If you’ve used Valkey for very long you’re probably aware of the different primary data types in the core: strings, hashes, lists, sets, sorted sets, and streams. +Each data type has an accompanying set of commands that manipulate that data type. +For example, you use [`HSET`](/commands/hset/) to set a field and value pair to a hash, but you don’t use, for example, HSET to add an element to a list. +What if I told you that there is an entire hidden layer that you never see unless you use a specific `OBJECT` command and can’t control unless you start tinkering with the configuration? +And that this could have a profound effect on your total usable storage: enough that careful configuring could mean significant savings in your infrastructure. +Read on to find out how you can understand and tweak the _real_ underlying structures. ## Engineering tradeoffs -Compact memory representation is highly important in Valkey: most users aren’t limited by performance but they are limited by the amount of memory available. When you’re representing data in RAM there often isn’t a clear winner for a technique that maximizes both performance and compactness at all data sizes. Like every engineering project, Valkey attempts to balance tradeoffs of performance and compactness. +Compact memory representation is highly important in Valkey: most users aren’t limited by performance but they are limited by the amount of memory available. +When you’re representing data in RAM there often isn’t a clear winner for a technique that maximizes both performance and compactness at all data sizes. +Like every engineering project, Valkey attempts to balance tradeoffs of performance and compactness. -In this case, the balance is achieved by an _encoding_. All data in Valkey has an encoding, and this abstracts the actual in-memory representation from how it’s accessed (i.e. the commands used). Take the example of these three HSETs (assume an empty database): +In this case, the balance is achieved by an _encoding_. +All data in Valkey has an encoding, and this abstracts the actual in-memory representation from how it’s accessed (i.e. the commands used). +Take the example of these three HSETs (assume an empty database): ```bash > HSET hash0 field "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" @@ -25,7 +34,9 @@ In this case, the balance is achieved by an _encoding_. All data in Valkey has a > HSET hash2 field "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ``` -At first glance you might observe that each value is one character longer than the previous. However, what you probably don’t see is that despite the single character difference, the memory used changes dramatically. You can see it by running [`MEMORY USAGE`](/commands/memory-usage/) over each key: +At first glance you might observe that each value is one character longer than the previous. +However, what you probably don’t see is that despite the single character difference, the memory used changes dramatically. +You can see it by running [`MEMORY USAGE`](/commands/memory-usage/) over each key: | Key | Length of value | `MEMORY USAGE` | Change from previous | | ----- | --------------- | -------------- | ----------------------------- | @@ -50,7 +61,9 @@ Take a look at the results of the [`OBJECT ENCODING`](/commands/object-encoding/ ``` The 'hashtable' result might be expected, after all you’re using a hash command, but what’s a 'listpack'? -A listpack is a memory-efficient data structure that stores elements sequentially in a single contiguous chunk of memory. When the data stored is not very large, it saves memory by minimizing the overhead of pointers. Don't worry about the intricacies of 'listpack' encoding though, the point is understanding how you interact with data is abstracted from the actual way it’s stored: an encoding (see [the code](https://github.com/valkey-io/valkey/blob/unstable/src/listpack.c) for a deep dive on listpacks, if you're really interested). +A listpack is a memory-efficient data structure that stores elements sequentially in a single contiguous chunk of memory. +When the data stored is not very large, it saves memory by minimizing the overhead of pointers. +Don't worry about the intricacies of 'listpack' encoding though, the point is understanding how you interact with data is abstracted from the actual way it’s stored: an encoding (see [the code](https://github.com/valkey-io/valkey/blob/unstable/src/listpack.c) for a deep dive on listpacks, if you're really interested). Let’s explore something else: @@ -66,22 +79,29 @@ Let’s explore something else: ``` -So, we have a list key using the same encoding as a hash and a set encoded as a hashtable. [Dogs and cats living together](https://www.youtube.com/watch?v=-9NMt42il4Q): what is going on? Conventional wisdom is that Valkey stores data using the classical data structures like hash tables, linked lists, and sets based on the commands you use. +So, we have a list key using the same encoding as a hash and a set encoded as a hashtable. +[Dogs and cats living together](https://www.youtube.com/watch?v=-9NMt42il4Q): what is going on? +Conventional wisdom is that Valkey stores data using the classical data structures like hash tables, linked lists, and sets based on the commands you use. Turns out: no. -While Valkey presents a _data model_ based on classical data structures, it makes optimization decisions under the hood. This allows you to use the appropriate commands for your data type without needing to worry about how that data is stored in memory. Valkey automatically manages the mapping between the data model and the encoding. +While Valkey presents a _data model_ based on classical data structures, it makes optimization decisions under the hood. +This allows you to use the appropriate commands for your data type without needing to worry about how that data is stored in memory. +Valkey automatically manages the mapping between the data model and the encoding. ## Taking back control -Except for strings, which use hard-coded logic, encodings for other data types are dictated by one or more configuration thresholds: values at or below a threshold use one encoding, while values exceeding it use another. For example, consider the default configuration for the hash data type in [Valkey 9.1](https://github.com/valkey-io/valkey/releases/tag/9.1.0): +Except for strings, which use hard-coded logic, encodings for other data types are dictated by one or more configuration thresholds: values at or below a threshold use one encoding, while values exceeding it use another. +For example, consider the default configuration for the hash data type in [Valkey 9.1](https://github.com/valkey-io/valkey/releases/tag/9.1.0): ```bash hash-max-listpack-entries 512 hash-max-listpack-value 64 ``` -This means that a hash is encoded as a `listpack` if all its values are at most 64 bytes long (`hash-max-listpack-value`) and it contains fewer than 512 field-value pairs (`hash-max-listpack-entries`). If either threshold is exceeded, Valkey uses a `hashtable` encoding. In the original example, the value in `hash2` was 65 bytes long, triggering a transition to the `hashtable` encoding, which is significantly less compact and accounts for the 76.67% increase in memory usage. +This means that a hash is encoded as a `listpack` if all its values are at most 64 bytes long (`hash-max-listpack-value`) and it contains fewer than 512 field-value pairs (`hash-max-listpack-entries`). +If either threshold is exceeded, Valkey uses a `hashtable` encoding. +In the original example, the value in `hash2` was 65 bytes long, triggering a transition to the `hashtable` encoding, which is significantly less compact and accounts for the 76.67% increase in memory usage. There are encoding configurations for: @@ -90,13 +110,18 @@ There are encoding configurations for: - Sets (`set-max-intset-entries`, `set-max-listpack-entries`, `set-max-listpack-value`) - Sorted Sets (`zset-max-listpack-entries`, `zset-max-listpack-value`) -Streams also use encodings, but they do not have configuration thresholds because they use a single encoding. Module types also use encodings, but their behavior depends on the specific module's logic and configuration. +Streams also use encodings, but they do not have configuration thresholds because they use a single encoding. +Module types also use encodings, but their behavior depends on the specific module's logic and configuration. ### Should you change these settings? -Maybe. It depends on what you’re optimizing for and what your data looks like. Valkey's default encoding configurations are suitable for many use cases, but if your strategy is to cost-optimize or maximize infrastructure efficiency, it's worth evaluating these settings against your specific data patterns and usage. +Maybe. +It depends on what you’re optimizing for and what your data looks like. +Valkey's default encoding configurations are suitable for many use cases, but if your strategy is to cost-optimize or maximize infrastructure efficiency, it's worth evaluating these settings against your specific data patterns and usage. -For the most basic evaluation, you can sample keys using `OBJECT ENCODING` to identify spots where the data is using the more voluminous encoding, then understand what is triggering it and make a call on the configuration. Of course, there are no-brainer situations: let’s say you store data in hashes and they tend to have values in length of 65 bytes, right above the threshold, and you have lower throughput needs. Upping the configuration value for `hash-max-listpack-value` to match a realistic length for your data could deliver huge savings either by lowering the infrastructure requirements or [letting you cache more with the same cluster](https://www.youtube.com/watch?v=cd4-UnU8lWY). +For the most basic evaluation, you can sample keys using `OBJECT ENCODING` to identify spots where the data is using the more voluminous encoding, then understand what is triggering it and make a call on the configuration. +Of course, there are no-brainer situations: let’s say you store data in hashes and they tend to have values in length of 65 bytes, right above the threshold, and you have lower throughput needs. +Upping the configuration value for `hash-max-listpack-value` to match a realistic length for your data could deliver huge savings either by lowering the infrastructure requirements or [letting you cache more with the same cluster](https://www.youtube.com/watch?v=cd4-UnU8lWY). Contextualizing an extreme example: having a 100gb cluster (5 nodes, 20gb each) packed with 95% of the keys reaching 1 over the `hash-max-listpack-value`. @@ -105,23 +130,32 @@ Contextualizing an extreme example: having a 100gb cluster (5 nodes, 20gb each) | Original | 100 GB | 95 GB | 212 B | 20 GB | 5 | | New | 58.8 GB | 0 | 120 B
(56.6% of original) | 20 GB | 3 | -So, you can take away two full primaries and whatever associated replicas. As previously mentioned, this is an extreme example, it's unlikely that you have 95% of your data falling outside this threshold. Let's say that you have 60% of your keys that reach above configuration threshold _and_ you can scale back your infrastructure to a smaller-sized machine or instance that has only 16gb of RAM. +So, you can take away two full primaries and whatever associated replicas. +As previously mentioned, this is an extreme example, it's unlikely that you have 95% of your data falling outside this threshold. +Let's say that you have 60% of your keys that reach above configuration threshold _and_ you can scale back your infrastructure to a smaller-sized machine or instance that has only 16gb of RAM. | | Cluster Size | GB Above Threshold | Memory Usage per Key | Primary Node Size | # of Primaries | | -------- | ------------ | ------------------ | ------------------------------- | ----------------- | -------------- | | Original | 100 GB | 60 GB | 212 B | 20 GB | 5 | | New | 74 GB | 0 | 120 B
(56.6% of original) | 14.8 GB | 5 |``` -The actual savings depend on the price difference between the new and old infrastructure. In both cloud and on-premises environments, pricing often has distinct breakpoints based on hardware specifications. This optimization can help you drop below a higher pricing tier if you were previously just cresting over it. Alternatively, you can use the reclaimed space to cache previously uncached data, reduce evictions, or allow longer TTLs. +The actual savings depend on the price difference between the new and old infrastructure. +In both cloud and on-premises environments, pricing often has distinct breakpoints based on hardware specifications. +This optimization can help you drop below a higher pricing tier if you were previously just cresting over it. +Alternatively, you can use the reclaimed space to cache previously uncached data, reduce evictions, or allow longer TTLs. -> **Wait! How do both a 65 and 64 length value result in a key size of 120?**
+> **Wait! +> How do both a 65 and 64 length value result in a key size of 120?**
> The eagle-eyed amongst you might have noticed that the original example of `hash1` having a size of 64 bytes and a memory footprint of 120 then in this example we're showing keys that have a value length of 65 that also have 120 bytes memory footprint. > How is that possible? -> The overhead for hashes with listpack encoding and various sized values isn't entirely linear, it's a stair step. Using the same key pattern and field name, a value length of 49 to 63 was 104 bytes and lengths 64 to 79 was 120 bytes. +> The overhead for hashes with listpack encoding and various sized values isn't entirely linear, it's a stair step. +> Using the same key pattern and field name, a value length of 49 to 63 was 104 bytes and lengths 64 to 79 was 120 bytes. > This explains why, in the original example, a length of 64 increased 15.38% over a length of 63 and yet the encoding was still the same. -All this comes back to understanding that these configurations aren't a silver bullet and throwing wildly higher or lower values at the encoding configuration could result in suboptimal performance or efficiency. YMMV: knowing your data types, sizes, and usage patterns, and (now) how encoding works in Valkey you have the tools to hone your configuration appropriately. +All this comes back to understanding that these configurations aren't a silver bullet and throwing wildly higher or lower values at the encoding configuration could result in suboptimal performance or efficiency. +YMMV: knowing your data types, sizes, and usage patterns, and (now) how encoding works in Valkey you have the tools to hone your configuration appropriately. ## Tell your story -Did you save RAM or maximize your throughput by tweaking a configuration in Valkey? [Share the knowledge by opening an issue to propose a blog post](https://github.com/valkey-io/valkey-io.github.io/issues/new?template=blog_post_template.md) or submitting a presentation abstract for the upcoming [ValkeyConf](https://events.linuxfoundation.org/valkeyconf/). +Did you save RAM or maximize your throughput by tweaking a configuration in Valkey? +[Share the knowledge by opening an issue to propose a blog post](https://github.com/valkey-io/valkey-io.github.io/issues/new?template=blog_post_template.md) or submitting a presentation abstract for the upcoming [ValkeyConf](https://events.linuxfoundation.org/valkeyconf/). diff --git a/content/blog/2026-06-30-valkeyconf-26/index.md b/content/blog/2026-06-30-valkeyconf-26/index.md index e05631e7..22ab1c24 100644 --- a/content/blog/2026-06-30-valkeyconf-26/index.md +++ b/content/blog/2026-06-30-valkeyconf-26/index.md @@ -10,21 +10,29 @@ blog_type = ["Events"] ![ValkeyConf Banner](bruce.png) -Introducing [ValkeyConf](https://events.linuxfoundation.org/valkeyconf/). On October 5, 2026, the Valkey community will gather in Prague, Czechia, for its inaugural flagship event, held alongside Open Source Summit Europe and organized by the Linux Foundation. +Introducing [ValkeyConf](https://events.linuxfoundation.org/valkeyconf/). +On October 5, 2026, the Valkey community will gather in Prague, Czechia, for its inaugural flagship event, held alongside Open Source Summit Europe and organized by the Linux Foundation. -From Keyspace in Amsterdam and Beijing to Valkey Unlocked, this community has shown up every time we've put something together. ValkeyConf is the next chapter. Since the project launched in early 2024, we've shipped major releases, grown to nearly 400 engine contributors, and built out an ecosystem that keeps gaining momentum. The energy and demand are there. ValkeyConf is where it all comes together under one roof. +From Keyspace in Amsterdam and Beijing to Valkey Unlocked, this community has shown up every time we've put something together. +ValkeyConf is the next chapter. +Since the project launched in early 2024, we've shipped major releases, grown to nearly 400 engine contributors, and built out an ecosystem that keeps gaining momentum. +The energy and demand are there. +ValkeyConf is where it all comes together under one roof. ## What ValkeyConf Is About -ValkeyConf is a single day single track conference dedicated to the people shaping Valkey's trajectory. The format puts practitioners and maintainers in direct conversation with each other, with a program designed around the problems, patterns, and possibilities that matter most to folks running real workloads. +ValkeyConf is a single day single track conference dedicated to the people shaping Valkey's trajectory. +The format puts practitioners and maintainers in direct conversation with each other, with a program designed around the problems, patterns, and possibilities that matter most to folks running real workloads. -We're building a program that reflects where the project actually is: moving fast, expanding its capabilities, and powered by a community that shows up. You'll walk away with a better understanding of where Valkey is headed and the people driving it forward. +We're building a program that reflects where the project actually is: moving fast, expanding its capabilities, and powered by a community that shows up. +You'll walk away with a better understanding of where Valkey is headed and the people driving it forward. More details on the program, speakers, and schedule are coming soon. ### Call for Speakers -Want to share your Valkey story with the community? [The ValkeyConf Call for Proposals (CFP) is now open.](https://events.linuxfoundation.org/valkeyconf/program/cfp/) We're looking for talks from maintainers, developers, architects, operators, and users who are building with Valkey, running it at scale, contributing to the project, or exploring new ways to use Valkey in modern infrastructure. +Want to share your Valkey story with the community? +[The ValkeyConf Call for Proposals (CFP) is now open.](https://events.linuxfoundation.org/valkeyconf/program/cfp/) We're looking for talks from maintainers, developers, architects, operators, and users who are building with Valkey, running it at scale, contributing to the project, or exploring new ways to use Valkey in modern infrastructure. Topics may include: architecture, ecosystem and integrations, features (Valkey 10.0), performance, and use cases and adoption @@ -32,15 +40,18 @@ Topics may include: architecture, ecosystem and integrations, features (Valkey 1 ## Sponsorship -ValkeyConf is backed by the organizations that believe in Valkey's future. If your company uses Valkey, builds on it, or wants to connect with the engineers and operators who do, sponsoring ValkeyConf puts you in front of that audience. +ValkeyConf is backed by the organizations that believe in Valkey's future. +If your company uses Valkey, builds on it, or wants to connect with the engineers and operators who do, sponsoring ValkeyConf puts you in front of that audience. -A sponsorship prospectus is available with tiers, benefits, and details on how to get involved. If you're interested, please check out the prospectus [here](https://events.linuxfoundation.org/valkeyconf/sponsor/). +A sponsorship prospectus is available with tiers, benefits, and details on how to get involved. +If you're interested, please check out the prospectus [here](https://events.linuxfoundation.org/valkeyconf/sponsor/). ### Visa Information Attendees who require a visa to travel to Czechia can request a visa invitation letter through the Linux Foundation. -Visa requests should be submitted as early as possible to allow enough time for processing. More information about eligibility, requirements, and [how to request a visa letter is available here.](https://events.linuxfoundation.org/valkeyconf/attend/visa-request/) +Visa requests should be submitted as early as possible to allow enough time for processing. +More information about eligibility, requirements, and [how to request a visa letter is available here.](https://events.linuxfoundation.org/valkeyconf/attend/visa-request/) ## Save the Date @@ -48,4 +59,6 @@ Mark your calendar for October in Prague and visit the [ValkeyConf](https://even Help us make the first ValkeyConf one to remember. -Note: We’ll also be hosting a [Valkey Contributor Summit](https://events.linuxfoundation.org/valkey-contributor-summit/) on October 6th alongside ValkeyConf. This invite-only gathering will bring together active contributors and maintainers to collaborate on the future of the project. If you’re interested in attending, please [submit registration for approval](https://events.linuxfoundation.org/valkey-contributor-summit/register/) or reach out in the **`#valkey-contributors`** channel on [Slack](https://valkey.io/slack). +Note: We’ll also be hosting a [Valkey Contributor Summit](https://events.linuxfoundation.org/valkey-contributor-summit/) on October 6th alongside ValkeyConf. +This invite-only gathering will bring together active contributors and maintainers to collaborate on the future of the project. +If you’re interested in attending, please [submit registration for approval](https://events.linuxfoundation.org/valkey-contributor-summit/register/) or reach out in the **`#valkey-contributors`** channel on [Slack](https://valkey.io/slack). diff --git a/content/blog/2026-07-09-percona-spotlight/index.md b/content/blog/2026-07-09-percona-spotlight/index.md index cbfdfd89..0cfa48eb 100644 --- a/content/blog/2026-07-09-percona-spotlight/index.md +++ b/content/blog/2026-07-09-percona-spotlight/index.md @@ -13,49 +13,66 @@ blog_type = ["Community Highlight"] {{< youtube id="cl3kwjG-Yzs" class="percona-spotlight-video" />}} -Standard industry software consistently grows heavier, consuming more RAM with every minor update. Valkey reverses this trend entirely: upcoming engineering milestones drop the software's structural footprint, meaning a simple binary upgrade immediately hands back physical memory to the underlying infrastructure. Percona’s [General Manager of the Redis and Valkey Ecosystem, Kyle Davis](https://www.percona.com/press/percona-appoints-kyle-davis-as-general-manager-of-redis-valkey-ecosystem/), sat down to detail how the open source community drives these computational efficiencies, eliminates translation bottlenecks, and enforces database-level multi-tenancy. +Standard industry software consistently grows heavier, consuming more RAM with every minor update. +Valkey reverses this trend entirely: upcoming engineering milestones drop the software's structural footprint, meaning a simple binary upgrade immediately hands back physical memory to the underlying infrastructure. +Percona’s [General Manager of the Redis and Valkey Ecosystem, Kyle Davis](https://www.percona.com/press/percona-appoints-kyle-davis-as-general-manager-of-redis-valkey-ecosystem/), sat down to detail how the open source community drives these computational efficiencies, eliminates translation bottlenecks, and enforces database-level multi-tenancy. ## Architectural Patterns: The Relational Companion Layer A common scaling bottleneck for databases (such as MySQL or PostgreSQL) is vertical resource exhaustion under heavy read/write query loads. ->"Valkey is a database that's used alongside other databases, almost exclusively. There are situations where applications just use Valkey, but that's unusual. What we really see is Valkey deployed alongside MySQL, Postgres, or MongoDB." +>"Valkey is a database that's used alongside other databases, almost exclusively. +>There are situations where applications just use Valkey, but that's unusual. +>What we really see is Valkey deployed alongside MySQL, Postgres, or MongoDB." -Placing Valkey as an in-memory caching layer directly alongside a relational database allows organizations to defer or eliminate expensive hardware vertical scaling. Shifting high-concurrency lookup patterns to an in-memory layer reduces latency and maximizes overall write throughput. +Placing Valkey as an in-memory caching layer directly alongside a relational database allows organizations to defer or eliminate expensive hardware vertical scaling. +Shifting high-concurrency lookup patterns to an in-memory layer reduces latency and maximizes overall write throughput. ## Eliminating Impedance Mismatch via Core Data Structures -A core driver of Valkey’s developer velocity is the native data model. Relational systems introduce object-relational impedance mismatch, requiring translation layers between persistent storage tables and application state. Valkey data types directly mirror memory structures used within application code. -For example, constructing and manipulating a local hash map within an application works efficiently at micro-scale. However, distributed architectures require this state to be shared across a decoupled cluster of stateless application nodes. +A core driver of Valkey’s developer velocity is the native data model. +Relational systems introduce object-relational impedance mismatch, requiring translation layers between persistent storage tables and application state. +Valkey data types directly mirror memory structures used within application code. +For example, constructing and manipulating a local hash map within an application works efficiently at micro-scale. +However, distributed architectures require this state to be shared across a decoupled cluster of stateless application nodes. -Valkey solves this dilemma by providing a highly available, network-accessible data structure store that scales out seamlessly. Because the API matches runtime data models, the learning curve remains minimal. Software developers can be useful with the entirety of the Valkey API within an eight-hour window, bypassing years of training required for relational databases. +Valkey solves this dilemma by providing a highly available, network-accessible data structure store that scales out seamlessly. +Because the API matches runtime data models, the learning curve remains minimal. +Software developers can be useful with the entirety of the Valkey API within an eight-hour window, bypassing years of training required for relational databases. ## High-Concurrency Production Use Cases Valkey's performance and low resource footprint fit low-latency operational workloads at massive scale: -- **Real-Time Fraud Detection**: High-throughput financial transaction processing requires synchronous evaluation of complex rule engines. Running Valkey at scale allows systems to capture, store, and mutate transaction states instantly, evaluating fraud indicators in single-digit milliseconds without introducing blocking latency into user checkout paths. -- **Smart Industrial Telemetry**: Internet of Things (IoT) hardware and modern smart manufacturing generate continuous metrics and telemetry streams. Large-scale factory deployments place a lightweight Valkey instance directly on the edge hardware alongside each industrial machine, buffering millions of raw events daily at the source before optimization and transmission to upstream long-term storage. +- **Real-Time Fraud Detection**: High-throughput financial transaction processing requires synchronous evaluation of complex rule engines. + Running Valkey at scale allows systems to capture, store, and mutate transaction states instantly, evaluating fraud indicators in single-digit milliseconds without introducing blocking latency into user checkout paths. +- **Smart Industrial Telemetry**: Internet of Things (IoT) hardware and modern smart manufacturing generate continuous metrics and telemetry streams. + Large-scale factory deployments place a lightweight Valkey instance directly on the edge hardware alongside each industrial machine, buffering millions of raw events daily at the source before optimization and transmission to upstream long-term storage. ## Memory Footprint Optimization and Access Control in Valkey 9.1 Because Valkey processes operations fully in-memory, production workloads face constraints from available memory capacity rather than CPU cycles. Compounding Memory Efficiencies -The release of [Valkey 9.1](https://valkey.io/blog/valkey-9-1-delivers-improvements-in-security-performance-and-more/) emphasizes optimizations across internal structures. Continuous optimization down to the byte level and memory layout yields a shrinking memory footprint across releases. Upgrading to 9.1 provides a purely software-driven efficiency gain, unlocking capacity on existing infrastructure without requiring code rewrites. +The release of [Valkey 9.1](https://valkey.io/blog/valkey-9-1-delivers-improvements-in-security-performance-and-more/) emphasizes optimizations across internal structures. +Continuous optimization down to the byte level and memory layout yields a shrinking memory footprint across releases. +Upgrading to 9.1 provides a purely software-driven efficiency gain, unlocking capacity on existing infrastructure without requiring code rewrites. ## Granular Security via Database-Level ACLs -[Valkey 9.0](https://valkey.io/blog/introducing-valkey-9/) introduced the ability to create numbered name-spaces on a cluster (logical databases), allowing safe key isolation. For example, a key named foo inside Logical Database 0 points to an integer, while a key named foo inside Logical Database 10 holds an entirely different dataset (like a binary blob) on the same cluster instance. +[Valkey 9.0](https://valkey.io/blog/introducing-valkey-9/) introduced the ability to create numbered name-spaces on a cluster (logical databases), allowing safe key isolation. +For example, a key named foo inside Logical Database 0 points to an integer, while a key named foo inside Logical Database 10 holds an entirely different dataset (like a binary blob) on the same cluster instance. -Valkey 9.1 advances consolidation by introducing **database-level Access Control Lists (ACLs)**. Configuration of explicit role-based permissions at the namespace layer follows a clean separation: +Valkey 9.1 advances consolidation by introducing **database-level Access Control Lists (ACLs)**. +Configuration of explicit role-based permissions at the namespace layer follows a clean separation: - **User A** operates with restrictions limiting query capabilities exclusively to Logical Database 0. - **User B** authenticates exclusively for access to Logical Database 10. This eliminates the broad, all-or-nothing access model inherent to older versions, allowing safe multi-use consolidation onto a single, tightly controlled Valkey cluster. ## Get involved -If you have questions, feedback, or just want to learn more, join our Slack community. It’s full of knowledgeable and helpful contributors who are happy to support questions, ideas, and discussions. +If you have questions, feedback, or just want to learn more, join our Slack community. +It’s full of knowledgeable and helpful contributors who are happy to support questions, ideas, and discussions. Other ways to connect: - Connect with us on [LinkedIn](https://www.linkedin.com/company/valkey/), [X](https://x.com/valkey_io), [BlueSky](https://bsky.app/profile/valkeyio.bsky.social) diff --git a/content/blog/2026-07-16-unlocked-healthy-opps/index.md b/content/blog/2026-07-16-unlocked-healthy-opps/index.md index 022c3fb0..1a563825 100644 --- a/content/blog/2026-07-16-unlocked-healthy-opps/index.md +++ b/content/blog/2026-07-16-unlocked-healthy-opps/index.md @@ -8,7 +8,8 @@ blog_type = ["Community Highlight"] [extra] +++ -The community gathered at the Valkey Unlocked Conference to celebrate two years of innovation and ecosystem growth. In a keynote titled, "The Power of Community," Sailesh Krishnamurthy (VP of Engineering at Google) shared core insights on what it takes to build a thriving, resilient open source project and where the technology goes from here. +The community gathered at the Valkey Unlocked Conference to celebrate two years of innovation and ecosystem growth. +In a keynote titled, "The Power of Community," Sailesh Krishnamurthy (VP of Engineering at Google) shared core insights on what it takes to build a thriving, resilient open source project and where the technology goes from here.