<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Maude Clonet on Medium]]></title>
        <description><![CDATA[Stories by Maude Clonet on Medium]]></description>
        <link>https://medium.com/@maude.clonet?source=rss-572095fc029f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KflBpnG71NsGmM9CAKbhqw.png</url>
            <title>Stories by Maude Clonet on Medium</title>
            <link>https://medium.com/@maude.clonet?source=rss-572095fc029f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 23:30:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@maude.clonet/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Spring Modulith: a 360 discovery]]></title>
            <link>https://medium.com/@maude.clonet/spring-modulith-a-360-discovery-36a95651a3d5?source=rss-572095fc029f------2</link>
            <guid isPermaLink="false">https://medium.com/p/36a95651a3d5</guid>
            <category><![CDATA[spring-modulith]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[domain-driven-design]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Maude Clonet]]></dc:creator>
            <pubDate>Tue, 07 Apr 2026 16:01:03 GMT</pubDate>
            <atom:updated>2026-04-07T16:01:03.202Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B4mYENZQuGpKV32e3s9SZg.png" /><figcaption>Nano Banana Pro generated - Prompted by myself with love</figcaption></figure><h3>Table of Contents</h3><ul><li>The Return of the Modular Monolith</li><li>Conceptualizing the Modular Architecture</li><li>Project Setup &amp; Core Fundamentals</li><li>Architectural Verification: Guarding Your Architecture</li><li>Inter-Module Communication: The State of the Art</li><li>Bulletproof Event Handling: The Transactional Outbox Pattern</li><li>External Integration: Bridging the Gap</li><li>Advanced Testing Strategies</li><li>Observability and Tracing in a Modular World</li><li>Refactoring Strategies: Migrating to Spring Modulith</li><li>Conclusion: Is Spring Modulith Right for Your Next Project?</li></ul><h3>The Return of the Modular Monolith</h3><p>For the past decade, the software industry has been heavily leaning towards distributed microservices. While microservices solve genuine organizational scaling issues (allowing hundreds of developers to work simultaneously), they also introduce immense technical complexity: distributed transactions, network partitions, complex deployments, data duplication, and difficult observability. As a result, many teams experienced “microservices fatigue,” discovering that the cost of network hops and latency far outweighed the benefits for their specific scale.</p><p>Enter the <strong>Modular Monolith</strong>. The idea is highly pragmatic: structure your application into independent, highly cohesive modules, but deploy them together as a single runnable unit (one JVM process). This keeps the deployment and operational model simple, avoids the network tax, and yet enforces logical boundaries that prevent the codebase from deteriorating into a chaotic “big ball of mud.”</p><p>Spring Modulith is the ultimate toolkit provided by the Spring ecosystem to help developers build, verify, and enforce these modular structures natively in Java.</p><h3>Conceptualizing the Modular Architecture</h3><p>Before writing any code, it’s crucial to understand how to correctly decouple your application. Simply putting files into different folders isn’t enough; you need strict, semantic boundaries.</p><h4>Domain-Driven Design Foundations</h4><p>In a modular monolith, modules should ideally align with <strong>Bounded Contexts</strong> from Domain-Driven Design (DDD). A bounded context represents a specific area of the business with its own ubiquitous language and models.</p><p>By mapping each bounded context to a specific Spring Modulith module, you ensure that changes in one business domain do not accidentally ripple into others.</p><ul><li>Aggregates belong to a single module and manage their own state.</li><li>Modules have their own dedicated database tables (even if they share the same physical database instance).</li><li>Modules do not share database foreign keys; they communicate via identifiers (e.g., passing a productId string instead of a Product entity relationship).</li></ul><h4>Saga Pattern Example: Order, Inventory, and Billing</h4><p>Let’s take a classic distributed problem: the <strong>Saga Pattern</strong>. In an e-commerce platform, when a customer places an order, the system must sequentially do several things:</p><ol><li>Save the order status (order module).</li><li>Decrease the stock in the warehouse (inventory module).</li><li>Generate a bill and charge the customer (billing module).</li></ol><p>In a distributed microservice architecture, this requires brittle HTTP/gRPC network calls or a complex Kafka topology, complete with retries and compensation logic if a step fails.</p><p>In a Spring Modulith application, we can recreate this exact logical separation using three loosely coupled local modules. Instead of HTTP calls, the order module simply publishes an in-memory application event. The inventory and billing modules listen to this event. We achieve the exact same level of logical decoupling as microservices, minus the network failure headaches.</p><p>In a standard microservice setup, you must implement the <strong>Transactional Outbox Pattern</strong> to ensure that an event is actually sent after a database commit. Spring Modulith provides this out of the box. Using the spring-modulith-events starter, events are automatically persisted in an internal event publication log within the same database transaction as the business logic.</p><p>Tracing a Saga across three microservices requires distributed tracing (Zipkin/Jaeger) and correlation IDs. In Spring Modulith, the entire flow is visible in a single stack trace or log stream, significantly reducing the mean time to repair (MTTR) when a business logic error occurs.</p><h3>Project Setup &amp; Core Fundamentals</h3><h4>Bootstrapping a Spring Modulith Project</h4><p>To get started, include the Spring Modulith BOM (Bill of Materials) and the core dependencies in your Spring Boot application.</p><pre>&lt;dependencyManagement&gt;<br>    &lt;dependencies&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;org.springframework.modulith&lt;/groupId&gt;<br>            &lt;artifactId&gt;spring-modulith-bom&lt;/artifactId&gt;<br>            &lt;version&gt;2.0.5&lt;/version&gt;<br>            &lt;type&gt;pom&lt;/type&gt;<br>            &lt;scope&gt;import&lt;/scope&gt;<br>        &lt;/dependency&gt;<br>    &lt;/dependencies&gt;<br>&lt;/dependencyManagement&gt;</pre><pre>&lt;dependencies&gt;<br>    &lt;dependency&gt;<br>        &lt;groupId&gt;org.springframework.modulith&lt;/groupId&gt;<br>        &lt;artifactId&gt;spring-modulith-starter-core&lt;/artifactId&gt;<br>    &lt;/dependency&gt;<br>&lt;/dependencies&gt;</pre><p>By default, Spring Modulith conventionally considers every direct sub-package of your main application class as a distinct module:</p><pre>com.example.ecommerce<br>├── EcommerceApplication.java<br>├── order      (Module 1)<br>├── inventory  (Module 2)<br>└── billing    (Module 3)</pre><h4>Ways to Isolate Code Between Modules</h4><p>Isolating code inside a module is the cornerstone of this architecture. You want to expose a clean public API and fiercely hide internal implementations. Spring Modulith provides two main ways to enforce this:</p><p><strong>1. Java Visibility Modifiers (Package-Private)</strong>: this is the simplest, most native way. Classes intended to be used only inside the module are marked as default (package-private).</p><pre>package com.example.ecommerce.order;<br><br>// Public API: visible to other modules because it&#39;s &#39;public&#39;<br>public interface OrderService {<br>    void placeOrder(Order order);<br>}<br>// Internal implementation: hidden from other modules!<br>@Service<br>class DefaultOrderService implements OrderService {<br>    // ...<br>}</pre><p><strong>2. Using </strong><strong>package-info.java &amp; Named Interfaces</strong>: if your module is large and has deep sub-packages, package-private visibility might be too restrictive internally. You can use a package-info.java file combined with Spring Modulith&#39;s @ApplicationModule to explicitly define which sub-packages or classes form the module&#39;s public API.</p><p>You can use @NamedInterface to group specific packages and selectively expose them to specific other modules:</p><pre>// File: src/main/java/com/example/ecommerce/order/package-info.java<br>@org.springframework.modulith.NamedInterface(<br>    name = &quot;events&quot;,<br>    content = &quot;com.example.ecommerce.order.events&quot;<br>)<br>package com.example.ecommerce.order;</pre><p>Then allow it on the inventory module:</p><pre>// File: src/main/java/com/example/ecommerce/inventory/package-info.java<br>@org.springframework.modulith.ApplicationModule(<br>    allowedDependencies = {&quot;order::events&quot;} // Explicitly restricting what this module can depend on<br>)<br>package com.example.ecommerce.inventory;</pre><p>The @ApplicationModule annotation doesn&#39;t necessarily allow a @NamedInterface. If the inventory module should only be allowed to depend on the order module (and nothing else), you configure it like this:</p><pre>// File: src/main/java/com/example/ecommerce/inventory/package-info.java<br>@org.springframework.modulith.ApplicationModule(<br>    allowedDependencies = &quot;order&quot; // Since no `@NamedInterface` is specified (no ::), the inventory module can only access the public classes in the root package of the order module<br>)<br>package com.example.ecommerce.inventory;</pre><h3>Architectural Verification: Guarding Your Architecture</h3><p>The biggest threat to a modular monolith is human entropy: a developer under a tight deadline accidentally importing an internal class from another module, or linking two JPA entities across modules, slowly turning the codebase back into a tightly coupled monolith.</p><h4>Validating Constraints and Preventing Cyclic Dependencies</h4><p>Spring Modulith elegantly stops this via strict unit tests. By adding spring-modulith-starter-test, you can verify your architecture continuously in your CI pipeline.</p><pre>import org.junit.jupiter.api.Test;<br>import org.springframework.modulith.core.ApplicationModules;<br><br>class ArchitectureTests {<br>    ApplicationModules modules = ApplicationModules.of(EcommerceApplication.class);<br>    @Test<br>    void verifyArchitecture() {<br>        // Fails the build if a cyclical dependency exists<br>        // Fails if a module bypasses the public API and accesses another module&#39;s internal classes<br>        modules.verify();<br>    }<br>}</pre><h4>Generating Living Documentation (C4 Models, UML)</h4><p>Instead of maintaining diagrams that are outdated the day after they are drawn, you can use the same API to generate up-to-date documentation.</p><pre>import org.junit.jupiter.api.Test;<br>import org.springframework.modulith.docs.Documenter;<br>import org.springframework.modulith.core.ApplicationModules;<br><br>class DocumentationTests {<br>    ApplicationModules modules = ApplicationModules.of(EcommerceApplication.class);<br>    @Test<br>    void writeDocumentation() {<br>        // Generates PlantUML and Structurizr formats in the target/spring-modulith-docs directory<br>        new Documenter(modules)<br>            .writeModulesAsPlantUml()<br>            .writeIndividualModulesAsPlantUml();<br>    }<br>}</pre><h3>Inter-Module Communication: The State of the Art</h3><h4>Synchronous Calls vs. Asynchronous Communication</h4><p>When should a module call another module directly (synchronous), and when should it use events (asynchronous)?</p><ul><li><strong>Synchronous:</strong> Use when the calling module intrinsically needs data from the target module to function immediately. For example, the OrderService fetching product details from a Catalog module to validate prices before saving the order.</li><li><strong>Asynchronous:</strong> Use for state changes and side-effects. The OrderService shouldn&#39;t be blocked waiting for the BillingService to generate an invoice.</li></ul><h4>Leveraging ApplicationEventPublisher</h4><p>For asynchronous flows, we use native Spring Events. Let’s see how the order module communicates securely with the inventory module.</p><p><strong>The Order Module (Publisher):</strong></p><pre>package com.example.ecommerce.order;<br><br>import org.springframework.context.ApplicationEventPublisher;<br>import org.springframework.stereotype.Service;<br>import org.springframework.transaction.annotation.Transactional;<br>@Service<br>public class OrderService {<br>    private final ApplicationEventPublisher events;<br>    private final OrderRepository repository;<br>    public OrderService(ApplicationEventPublisher events, OrderRepository repository) {<br>        this.events = events;<br>        this.repository = repository;<br>    }<br>    @Transactional<br>    public void placeOrder(Order order) {<br>        // 1. Save the state in the current module&#39;s tables<br>        repository.save(order);<br>        // 2. Publish a domain event (usually a Java Record)<br>        events.publishEvent(new OrderPlacedEvent(order.getId(), order.getProductId(), order.getQuantity()));<br>    }<br>}</pre><p><strong>The Inventory Module (Subscriber):</strong> The inventory module listens to the event using @ApplicationModuleListener. This functions as a convenient meta-annotation for @Async and @TransactionalEventListener. Crucially, it ensures the listener only executes <em>after</em> the OrderService&#39;s transaction has successfully committed.</p><pre>package com.example.ecommerce.inventory;<br><br>import com.example.ecommerce.order.OrderPlacedEvent; <br>import org.springframework.modulith.events.ApplicationModuleListener;<br>import org.springframework.stereotype.Service;<br>@Service<br>class InventoryUpdater {<br>    @ApplicationModuleListener<br>    void onOrderPlaced(OrderPlacedEvent event) {<br>        // Decrease stock asynchronously, in a completely separate database transaction<br>        System.out.println(&quot;Decreasing stock for product: &quot; + event.productId());<br>    }<br>}</pre><h3>Bulletproof Event Handling: The Transactional Outbox Pattern</h3><h4>The Risk of Data Loss in Standard Async Events</h4><p>Using standard @Async events creates a severe risk. What happens if the OrderService saves the order, the transaction commits, but immediately after, the JVM crashes or the server loses power before the InventoryUpdater thread can run? The order is saved, but the inventory is never updated. You&#39;ve created a silent data inconsistency.</p><h4>How the Event Publication Registry Solves the Problem</h4><p>Spring Modulith natively integrates the <strong>Transactional Outbox Pattern</strong> to solve this. It persists the event payload into an “outbox” database table <em>within the exact same transaction</em> as the business method (OrderService.placeOrder).</p><p>To enable it, simply add the event-starter for your persistence tech (e.g., JPA, JDBC, or MongoDB):</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.modulith&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-modulith-starter-jdbc&lt;/artifactId&gt; <br>&lt;/dependency&gt;</pre><p>Add this to your application.properties to automatically create the required EVENT_PUBLICATION table on startup:</p><pre>spring.modulith.events.jdbc.schema-initialization.enabled=true</pre><p>Spring Modulith will now securely store the event. It marks an event as completed only when all registered @ApplicationModuleListeners have successfully processed it. If a module fails or the server crashes, Spring Modulith will automatically retry any incomplete events upon restart, ensuring robust <strong>eventual consistency</strong>.</p><h4>Saga Compensations: Handling Failures Natively</h4><p>What if the order is saved, but the inventory module later discovers that the item is completely out of stock and the event cannot be processed? Instead of an orchestrator microservice, we simply rely on a compensatory event flow:</p><ol><li>InventoryUpdater fails to reserve stock.</li><li>InventoryUpdater publishes an InventoryDepletionFailedEvent(orderId).</li><li>An OrderCompensationService inside the order module listens to this failure event and updates the order status to CANCELLED_NO_STOCK, effectively completing the Saga natively.</li></ol><h3>External Integration: Bridging the Gap</h3><h4>Event Externalization: Broadcasting to the Outside World</h4><p>Sometimes, an internal modular monolith event needs to reach external microservices (e.g., a notification service written in Go). Spring Modulith provides “Event Externalization” to seamlessly bridge local events to a message broker like Kafka, RabbitMQ, or AWS SQS.</p><p>First, add the Kafka event starter:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.modulith&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-modulith-events-kafka&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><p>Then, simply annotate your event record:</p><pre>package com.example.ecommerce.order;<br><br>import org.springframework.modulith.events.Externalized;<br>// Automatically routes this local event to a Kafka topic named &quot;orders.placed&quot;<br>@Externalized(&quot;orders.placed&quot;)<br>public record OrderPlacedEvent(String orderId, String productId, int quantity) {<br>}</pre><p>With just the @Externalized annotation, Spring Modulith intercepts the internal application event and safely publishes it to the specified topic. Your business logic remains completely free of Kafka templates and serialization concerns!</p><h3>Advanced Testing Strategies</h3><h4>Isolating Contexts with @ApplicationModuleTest</h4><p>Testing a monolith shouldn’t mean spinning up the entire giant Spring Boot application context for every test file. Spring Modulith allows you to specifically bootstrap a single module and its direct dependencies.</p><p>The Scenario API provides a highly readable way to test asynchronous event flows.</p><pre>package com.example.ecommerce.inventory;<br><br>import com.example.ecommerce.order.OrderPlacedEvent;<br>import org.junit.jupiter.api.Test;<br>import org.springframework.modulith.test.ApplicationModuleTest;<br>import org.springframework.modulith.test.Scenario;<br>@ApplicationModuleTest // Bootstraps ONLY the Inventory module context<br>class InventoryModuleTest {<br>    @Test<br>    void decreasesStockOnOrderPlaced(Scenario scenario) {<br>        // Tests the module in complete isolation by simulating the incoming event<br>        scenario.publish(new OrderPlacedEvent(&quot;O-123&quot;, &quot;P-ABC&quot;, 2))<br>                .andWaitForStateChange(() -&gt; {<br>                    // Check database state or mock verifications here<br>                    // e.g. assertThat(inventoryRepository.getStock(&quot;P-ABC&quot;)).isEqualTo(8);<br>                });<br>    }<br>}</pre><h3>Observability and Tracing in a Modular World</h3><p>In a module-driven, heavily asynchronous application, observability becomes paramount. Figuring out which event triggered which listener can become daunting.</p><p>By adding the observability starter:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.modulith&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-modulith-observability&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><p>Spring Modulith automatically integrates with Micrometer and Zipkin/OpenTelemetry. When the OrderService publishes an event, Spring Modulith neatly propagates the Trace ID across the asynchronous thread loop down to the InventoryUpdater and BillingService. In your tracing dashboard (like Jaeger or Zipkin), you will see a unified, hierarchical trace showing exactly how long the order creation took, and the parallel execution times of the downstream modules.</p><h3>Refactoring Strategies: Migrating to Spring Modulith</h3><p>Migrating a legacy Spring Boot monolith to a Spring Modulith application is a rewarding, incremental process. It can be done step-by-step without a massive “stop the world” rewrite:</p><ol><li><strong>Bring in the test starter:</strong> Add spring-modulith-starter-test and run modules.verify(). It will fail with numerous warnings about tangled cyclic dependencies.</li><li><strong>Re-package by feature:</strong> Move classes out of technical packages (controllers, services, repositories) and into logical, business-focused top-level packages (order, inventory).</li><li><strong>Break the cycles:</strong> Systematically replace synchronous cyclic method calls with decoupled Spring Application Events.</li><li><strong>Enforce visibility:</strong> Strip away public access modifiers from internal services so they can never be improperly imported again.</li></ol><h3>Conclusion: Is Spring Modulith Right for Your Next Project?</h3><p>Spring Modulith strikes the perfect balance for most enterprise projects. It offers the strict architectural boundaries, automated validation, and logical decoupling of microservices, while maintaining the productivity and simplicity of a single deployment pipeline, a single transactional domain, and easy local debugging.</p><p>Whether you are starting a greenfield project and want to prevent it from degrading over time, or you are desperately trying to tame a chaotic legacy monolith, Spring Modulith provides one of the most robust, state-of-the-art architectural foundations available in the Java ecosystem today.</p><p>For a more technical deep dive into specific implementation details, the <a href="https://docs.spring.io/spring-modulith/reference/index.html">official Spring Modulith documentation</a> is exceptionally well-structured and well worth exploring for in-depth information</p><p>Let me know which part of the Spring Modulith ecosystem you’d like to explore next!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36a95651a3d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gherkin and TypeScript with CucumberJS]]></title>
            <link>https://medium.com/@maude.clonet/gherkin-and-typescript-with-cucumberjs-89817b92607a?source=rss-572095fc029f------2</link>
            <guid isPermaLink="false">https://medium.com/p/89817b92607a</guid>
            <category><![CDATA[gherkin]]></category>
            <category><![CDATA[bdd]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[cucumber]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Maude Clonet]]></dc:creator>
            <pubDate>Mon, 26 Jan 2026 17:01:04 GMT</pubDate>
            <atom:updated>2026-01-26T17:01:04.216Z</atom:updated>
            <content:encoded><![CDATA[<h4>A practical guide to implementing BDD with Gherkin and TypeScript</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cz_JsYYzGgeYwv0a3JTZcA.jpeg" /><figcaption>Nano Banana Pro generated — Prompted by myself with love</figcaption></figure><p>I was scrolling through Twitter (well, X) when I stumbled upon a <a href="https://x.com/romainlanz/status/2014336880838402463">post by Romain Lanz</a> discussing Gherkin and TypeScript.</p><p>As someone who practices BDD and TDD in Java + Spring (using a wrapper around Cucumber), I felt compelled to reply. I was intrigued to see him implementing a sort of fluent API rather than using .feature files directly. This sparked a curiosity in me: how exactly does standard Cucumber work in a modern TypeScript environment?</p><p>Searching for how to handle Cucumber in TypeScript, I quickly hit a dead end regarding reliable, well-referenced sources. I specifically struggled to find good information on strict typing and how to declare it properly via the @cucumber/cucumber package.</p><p>Determined to find an answer to my questions, I put my assistant Jules to work and asked him to code a TypeScript + Cucumber example that I am going to present to you today.</p><p><strong>Disclaimer:</strong> I am not a TypeScript or CucumberJS expert. However, since I had to search for quite a while to find satisfactory answers on how these two work together (specifically regarding types), I believe this article will be useful to at least a few people out there.</p><h3>What is BDD ?</h3><p>Before we dive into the code, let’s take a step back. Behavior Driven Development (BDD) is a software development process that encourages collaboration among developers, QA, and non-technical or business participants in a software project.</p><p>The main goal is to improve communication. Instead of writing tests that only developers understand, we write specifications in plain English (or French, or any language) that describe how the application behaves.</p><h4>Cucumber, Steps, and Feature Files</h4><p>Cucumber is the most popular tool for supporting BDD. It reads executable specifications written in plain text and validates that the software does what those specifications say.</p><p>These specifications live in .feature files. To make them executable, we write “Glue Code” (Step Definitions) that connects the plain text to the actual code logic.</p><h4>Given / When / Then</h4><p>The language used in these feature files is called Gherkin. It relies on a few specific keywords to structure scenarios:</p><ul><li><strong>Given:</strong> Describes the initial context (the state of the world before the action).</li><li><strong>When:</strong> Describes the event or action taken by the user.</li><li><strong>Then:</strong> Describes the expected outcome or observable result.</li></ul><h3>The Generated Code</h3><p>For this experiment, I generated code to manage a small Zoo. We can add species to the zoo at a specific date. The example is intentionally simplistic because the goal was primarily to see how to force types with Cucumber + TypeScript.</p><h4>package.json</h4><p>Nothing too wizard-like here. We have a test script to launch the features, TypeScript, and Cucumber.</p><p>Note the usage of NODE_OPTIONS in the test script. This allows us to use ts-node efficiently to execute TypeScript files directly without a pre-compilation step during the test run.</p><pre>{<br>  &quot;name&quot;: &quot;app&quot;,<br>  &quot;version&quot;: &quot;1.0.0&quot;,<br>  &quot;main&quot;: &quot;index.js&quot;,<br>  &quot;scripts&quot;: {<br>    &quot;test&quot;: &quot;NODE_OPTIONS=&#39;--loader ts-node/esm --no-warnings&#39; cucumber-js&quot;<br>  },<br>  &quot;devDependencies&quot;: {<br>    &quot;@cucumber/cucumber&quot;: &quot;^11.1.0&quot;,<br>    &quot;@types/node&quot;: &quot;^22.10.2&quot;,<br>    &quot;expect&quot;: &quot;^30.2.0&quot;,<br>    &quot;ts-node&quot;: &quot;^10.9.2&quot;,<br>    &quot;typescript&quot;: &quot;^5.7.2&quot;<br>  }<br>}</pre><h4>cucumber.js</h4><p>We need two small lines of configuration in a cucumber.js file at the root of the project.</p><p>In import, we define the pattern to recognize the step definitions (the TypeScript code). In paths, we define the pattern to find the .feature files (the Gherkin scenarios) to execute.</p><pre>export default {<br>  import: [&#39;features/step_definitions/**/*.ts&#39;],<br>  paths: [&#39;features/**/*.feature&#39;]<br>}</pre><h4>src/zoo.ts</h4><p>Since we are managing a zoo for this test, we need a bit of domain code to interact with.</p><pre>export interface Pet {<br>  species: string;<br>  entryDate: Date;<br>}<br><br>export class Zoo {<br>  private pets: Pet[] = [];<br>  addPets(species: string, count: number, entryDate: Date) {<br>    for (let i = 0; i &lt; count; i++) {<br>      this.pets.push({ species, entryDate });<br>    }<br>  }<br>  getPetsCountBySpecies(species: string): number {<br>    return this.pets.filter(p =&gt; p.species === species).length;<br>  }<br>  getPetsByEntryDate(date: Date): Pet[] {<br>    return this.pets.filter(p =&gt; p.entryDate.getTime() === date.getTime());<br>  }<br>}</pre><h4>features/step_definitions/steps.ts</h4><p>This is where things start to get interesting.</p><p>The steps file contains the definitions that link our natural language to code. This is what allows us to set up, mock, and test our application starting from the .feature file.</p><p>Here we have a few key elements:</p><ul><li>A <strong>Date model</strong> definition (defineParameterType). This allows us to use a custom type inside our step definitions (automating the parsing from String to Date).</li><li>Methods to interact with the Zoo: emptying it, adding animals, verifying what is inside, and checking when they arrived.</li></ul><pre>import { Given, When, Then, defineParameterType } from &#39;@cucumber/cucumber&#39;;<br>import { expect } from &#39;expect&#39;;<br>import { Zoo } from &#39;../../src/zoo.js&#39;;<br><br>// This is crucial for clean TypeScript integration<br>defineParameterType({<br>  name: &#39;date&#39;,<br>  regexp: /\d{4}-\d{2}-\d{2}/,<br>  transformer: s =&gt; new Date(s)<br>});<br>let zoo: Zoo;<br>Given(&#39;the zoo is empty&#39;, function () {<br>  zoo = new Zoo();<br>});<br>// Notice how {int}, {string}, and {date} automatically map to typed arguments<br>When(&#39;{int} {string} are added on {date}&#39;, function (count: number, species: string, date: Date) {<br>  zoo.addPets(species, count, date);<br>});<br>Then(&#39;there should be {int} {string} in the zoo&#39;, function (count: number, species: string) {<br>  expect(zoo.getPetsCountBySpecies(species)).toBe(count);<br>});<br>Then(&#39;there should be {int} pets added on {date}&#39;, function (count: number, date: Date) {<br>  expect(zoo.getPetsByEntryDate(date).length).toBe(count);<br>});</pre><h4>features/zoo.feature</h4><p>And now, the most important part: the feature, the concrete test.</p><pre>Feature: Zoo Management<br>  Scenario: Adding pets to the zoo<br>    Given the zoo is empty<br>    When 5 &quot;lions&quot; are added on 2023-05-10<br>    And 3 &quot;tigers&quot; are added on 2023-05-12<br>    Then there should be 5 &quot;lions&quot; in the zoo<br>    And there should be 3 &quot;tigers&quot; in the zoo<br>    And there should be 5 pets added on 2023-05-10</pre><p>We are verifying the behavior of our zoo:</p><ul><li>We create an empty zoo.</li><li>We add 5 lions.</li><li>Then 3 tigers.</li><li>We verify that specific species counts are correct.</li><li>We verify that they arrived at the correct time.</li></ul><p>And there you have it! The essentials of our Zoo’s functionality are tested with strong typing in the backend and readable English in the frontend. It bridges the gap I initially found confusing, proving that TypeScript and Cucumber can indeed play very nicely together.</p><p>If you want to check the generated code by yourself, you will find the <a href="https://github.com/MaudeClonet/test-cucumber-ts">repository here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89817b92607a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Redis: The Ultimate Migration Guide]]></title>
            <link>https://medium.com/@maude.clonet/redis-the-ultimate-migration-guide-29de5591758b?source=rss-572095fc029f------2</link>
            <guid isPermaLink="false">https://medium.com/p/29de5591758b</guid>
            <category><![CDATA[zero-downtime-migration]]></category>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[valkey]]></category>
            <category><![CDATA[redis]]></category>
            <dc:creator><![CDATA[Maude Clonet]]></dc:creator>
            <pubDate>Sat, 17 Jan 2026 11:46:59 GMT</pubDate>
            <atom:updated>2026-01-19T17:01:59.311Z</atom:updated>
            <content:encoded><![CDATA[<h4>A developer’s roadmap for transitioning to Valkey or Dragonfly with zero downtime</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cNCbMuj2odcGrVJL.jpg" /><figcaption>Nano Banana Pro generated — Prompted by myself with love</figcaption></figure><p>The database landscape underwent a seismic shift in early 2024. When Redis Inc. moved away from the open-source BSD license, it didn’t just change legal frameworks; it fractured the ecosystem into three distinct architectural paths: remaining with the proprietary evolution of Redis, shifting to the Linux Foundation-backed Valkey, or adopting the multi-threaded performance beast that is Dragonfly.</p><p>For senior architects and platform engineers, this isn’t merely a political choice (it is an infrastructure imperative). Whether you are driven by licensing compliance, raw throughput requirements, or cost optimization, moving data requires surgical precision.</p><p>This guide serves as your roadmap. We will bypass the surface-level marketing and dissect the wire-level protocols, migration patterns, and economic realities of the post-Redis world.</p><h3>Mastering Protocol Compatibility</h3><p>Migration begins with the assumption that your application speaks RESP (Redis Serialization Protocol). However, “compatibility” is a spectrum, not a binary state.</p><p>Valkey, being a direct fork of Redis 7.2.4, maintains near-perfect parity with the reference implementation. If your application relies on Lua scripting, Pub/Sub, or streams, Valkey is essentially a drop-in replacement. However, Dragonfly takes a different approach. It implements the Redis API on top of a shared-nothing, multi-threaded architecture. While it supports the vast majority of Redis commands, the underlying execution model differs.</p><h4>The RESP Audit</h4><p>Before scheduling a maintenance window, execute a comprehensive audit of your client-side implementation:</p><ul><li><strong>Lua Atomicity:</strong> In single-threaded Redis, a Lua script blocks the entire server. In multi-threaded Dragonfly, script execution logic may differ slightly regarding global locks. Verify that your scripts do not rely on side effects that assume a total system freeze.</li><li><strong>Blocking Commands:</strong> Commands like BLPOP or BRPOP are handled efficiently by all engines, but heavy usage of blocking operations can behave differently under extreme concurrency when switching from a single-threaded to a multi-threaded backend.</li><li><strong>Client Libraries:</strong> Legacy Redis clients (like older versions of Jedis or redis-py) generally work with Valkey. However, newer SDKs are beginning to diverge. To ensure long-term stability, transition your dependency tree to SDKs that explicitly support the Valkey ecosystem (like valkey-py or io.valkey) or generic clients that allow you to toggle RESP versions (RESP2 vs. RESP3).</li></ul><h3>Zero-Downtime Migration Patterns</h3><p>The “lift and shift” approach (shutting down the old instance and starting the new one) is unacceptable for mission-critical cache or session stores. We must employ patterns that maintain availability throughout the cutover.</p><p>Because Valkey shares the same replication protocol ancestry as Redis, it is often possible to configure a Valkey instance as a replica of an existing Redis master.</p><ol><li>Launch the Valkey node.</li><li>Issue the REPLICAOF &lt;redis-master-ip&gt; &lt;port&gt; command.</li><li>Wait for the sync to complete.</li><li>Promote Valkey to master and switch application traffic. <em>(Note: This capability may degrade as the codebases diverge further in 2025 and 2026. Test this in a staging environment first.)</em></li></ol><h4>2. The Dual-Write Strategy (Universal)</h4><p>For heterogeneous migrations (like Redis to Dragonfly), the dual-write pattern is the gold standard for safety.</p><ul><li><strong>Phase 1 (Read-Through):</strong> The application reads from Redis. If a miss occurs, it checks the new engine.</li><li><strong>Phase 2 (Double-Write):</strong> Modify the application DAO (Data Access Object) to write updates to <em>both</em> Redis and the new engine asynchronously.</li><li><strong>Phase 3 (Shadow Mode):</strong> Continue double-writing, but begin sending a percentage of read traffic to the new engine to verify data integrity and latency metrics.</li><li><strong>Phase 4 (Cutover):</strong> Flip the read switch to the new engine entirely. Decommission the old Redis instances.</li></ul><h4>3. Shadow Testing</h4><p>Before the actual data migration, use tools like <a href="https://github.com/tair-opensource/RedisShake">redis-shake</a> or varying proxy layers to replay production traffic against your target infrastructure. This reveals how the new engine handles your specific command distribution (read/write ratios and key sizes) without risking user data.</p><h3>Strategic TCO Analysis for 2026</h3><p>The decision to migrate is rarely purely technical; it is economic. By 2026, the cost of operating in-memory data stores will be scrutinized under the lens of “throughput-per-dollar.”</p><p><strong>The Legacy Redis Model</strong> Redis is single-threaded. To scale beyond a certain throughput, you must cluster (sharding data across multiple nodes). This increases operational complexity and infrastructure costs linearly. You are paying for CPU cores that the main Redis process cannot utilize fully.</p><p><strong>The Valkey Proposition</strong> Valkey offers a Total Cost of Ownership (TCO) similar to open-source Redis but without the looming threat of licensing fees. Major cloud providers (AWS, Google Cloud, Azure) are rallying behind Valkey. This means managed Valkey instances will likely be the default “commoditized” caching layer, keeping prices competitive through market saturation.</p><p><strong>The Dragonfly Advantage</strong> Dragonfly changes the math entirely via vertical scaling. Because it utilizes all available CPU cores on an instance, a single Dragonfly node can often replace a complex Redis Cluster comprising 10+ nodes.</p><ul><li><strong>Operational Overhead:</strong> Drastically reduced (managing 1 node vs. 15 nodes).</li><li><strong>Infrastructure Bill:</strong> While a larger single instance costs more than a small one, it costs significantly less than the aggregate of a cluster required to match its performance.</li><li><strong>Licensing:</strong> Dragonfly has a BSL (Business Source License) model for enterprise features, which must be weighed against the hardware savings.</li></ul><h3>The 2026 Architectural Selection Framework</h3><p>Which engine should you choose? Use this decision matrix to guide your architectural strategy.</p><p><strong>Scenario A: The “Safe Bet” / Managed Cloud Reliance</strong></p><ul><li><strong>Profile:</strong> You rely heavily on AWS ElastiCache or Google Cloud Memorystore. Your team prefers managed services over self-hosting. Your workload is standard caching or session management.</li><li><strong>Verdict:</strong> <strong>Valkey.</strong> The major clouds are pivoting their managed Redis offerings to Valkey. It ensures protocol compliance and allows you to avoid vendor lock-in with Redis Inc., while keeping the “push-button” operational ease.</li></ul><p><strong>Scenario B: Extreme Throughput / High Concurrency</strong></p><ul><li><strong>Profile:</strong> You are managing a real-time bidding platform, a gaming leaderboard, or a high-frequency trading buffer. You are hitting the limits of a single Redis core and dread the complexity of managing a large Cluster.</li><li><strong>Verdict:</strong> <strong>Dragonfly.</strong> The ability to push millions of operations per second on a single instance simplifies your topology. The operational simplicity of a “shared-nothing” architecture outweighs the need to manage a massive shard map.</li></ul><p><strong>Scenario C: The Legacy Conservator</strong></p><ul><li><strong>Profile:</strong> You have a massive, brittle legacy codebase with deep dependencies on specific Redis modules (like RedisJSON or RediSearch) in their proprietary forms.</li><li><strong>Verdict:</strong> <strong>Redis (Proprietary).</strong> If the cost of refactoring your application to remove module dependencies exceeds the cost of the enterprise license, staying put is the rational economic choice (for now).</li></ul><h3>Conclusion</h3><p>The fragmentation of the Redis ecosystem is not a disaster; it is an evolution. It forces us to stop treating our caching layer as a black box and start evaluating it based on actual merit-be that open governance (Valkey) or architectural innovation (Dragonfly).</p><p>By auditing your protocols today and selecting the engine that maps to your scaling requirements of tomorrow, you ensure that your infrastructure remains robust, cost-efficient, and ready for the demands of 2026.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29de5591758b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Empire Strikes Back: Redis 8]]></title>
            <link>https://medium.com/@maude.clonet/the-empire-strikes-back-redis-8-82d89371408f?source=rss-572095fc029f------2</link>
            <guid isPermaLink="false">https://medium.com/p/82d89371408f</guid>
            <category><![CDATA[vector-search]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[vector-database]]></category>
            <dc:creator><![CDATA[Maude Clonet]]></dc:creator>
            <pubDate>Mon, 12 Jan 2026 12:51:02 GMT</pubDate>
            <atom:updated>2026-01-17T11:57:00.596Z</atom:updated>
            <content:encoded><![CDATA[<h4>How architecture changes, multi-threading, and native AI tools define the future of in-memory data</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yyOaGqKl8qfU6qNi.jpg" /><figcaption>Nano Banana Pro generated — Prompted by myself with love</figcaption></figure><p>For over a decade, Redis has held the undisputed title of the world’s most popular in-memory data store. Known for its blisteringly fast performance and simplicity, it became the default choice for caching and real-time data processing. However, as modern application requirements evolved (demanding complex search capabilities, JSON handling, and time-series analysis) the ecosystem became fragmented. Developers often had to juggle multiple disparate modules to get the functionality they needed.</p><p>Redis 8 represents a definitive answer to this complexity. It is not merely an incremental update; it is a strategic restructuring of the database itself. By unifying core modules, introducing a groundbreaking threading model, and pivoting hard toward Generative AI workloads, Redis 8 positions itself not just as a cache, but as the central nervous system for modern, intelligent applications.</p><h3>Consolidating the Core: The “One Redis” Architecture</h3><p>The most immediate change in Redis 8 is the philosophical and architectural shift known as “One Redis.” Historically, capabilities like full-text search, JSON document manipulation, and time-series data handling lived as separate modules. While powerful, this modular approach introduced operational friction (requiring developers to manage version compatibility, loading mechanisms, and separate upgrade paths for each component).</p><p>Redis 8 dismantles these silos by natively integrating RediSearch, RedisJSON, and RedisTimeSeries directly into the core engine. This unified binary approach effectively democratizes advanced data manipulation. Now, a standard Redis deployment possesses multi-model capabilities by default. This consolidation eliminates the “dependency hell” often associated with maintaining plugin architectures. For DevOps teams and architects, this means a significantly simplified stack (where a single binary delivers the power that previously required a complex orchestration of extensions).</p><h3>Breaking the I/O Bottleneck: Asynchronous Multi-threading</h3><p>Redis has famously relied on a single-threaded architecture for command execution (a design choice that ensured atomic operations and code simplicity). However, as network speeds increased and data payloads grew, the input/output (I/O) processing often became a bottleneck, leaving the main CPU core waiting on network traffic rather than processing data.</p><p>Redis 8 introduces a sophisticated asynchronous I/O threading model designed to reclaim its performance crown. In this new architecture, the heavy lifting of reading from and writing to the network sockets is decoupled from the main execution thread. By offloading these tasks to background threads, the main thread is free to focus almost exclusively on manipulating data in memory.</p><p>The result is unprecedented throughput. This architectural optimization allows Redis 8 to achieve sub-millisecond latency even under extreme load (making it the fastest version of the data store ever released). It ensures that as applications scale to millions of operations per second, the database remains responsive and efficient.</p><h3>The AI-Native Memory Tier: Vector Search and LangCache</h3><p>The explosive growth of Generative AI has created a new set of data challenges (specifically regarding context retention and retrieval cost). Redis 8 addresses this by solidifying its position within the GenAI stack, transforming from a simple cache into a high-performance vector database and semantic feature store.</p><p>The release enhances built-in Vector Search capabilities, allowing for faster and more accurate similarity searches required for RAG (Retrieval-Augmented Generation) pipelines. However, the standout innovation is the introduction of “LangCache.”</p><p>LangCache represents a semantic caching layer specifically designed for Large Language Model (LLM) agents. In typical LLM interactions, asking the same question twice usually results in two expensive API calls to the model provider. LangCache uses semantic similarity to recognize when a user is asking a question similar to one that has already been answered. It serves the stored response instantly from memory (drastically reducing inference costs and latency). This makes Redis 8 an essential tool for organizations looking to move GenAI applications from prototype to production without breaking the bank.</p><p>The release of Redis 8 arrives amidst a broader conversation regarding open-source licensing models. With recent changes in the software landscape, organizations are increasingly scrutinizing the long-term viability and support of their critical infrastructure. Redis 8 provides a clear path forward for enterprise reliability.</p><p>By balancing versatile licensing options with the seamless operational benefits of Redis Cloud, the platform offers a stable trajectory for mission-critical systems. For enterprise users, the focus is on a “zero-ops” experience (where the complexities of scaling, clustering, and persistence are managed automatically).</p><p>Redis 8 signals a commitment to long-term stability. It assures stakeholders that despite the shifting sands of software licensing, the platform remains a robust, professionally supported, and commercially viable foundation for the next decade of enterprise technology.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82d89371408f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Redis and Valkey alternatives: the Performance Titans]]></title>
            <link>https://medium.com/@maude.clonet/redis-and-valkey-alternatives-the-performance-titans-f3ec457c34be?source=rss-572095fc029f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3ec457c34be</guid>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[caching]]></category>
            <category><![CDATA[dragonfly]]></category>
            <category><![CDATA[redis-alternatives]]></category>
            <category><![CDATA[garnet]]></category>
            <dc:creator><![CDATA[Maude Clonet]]></dc:creator>
            <pubDate>Mon, 12 Jan 2026 12:47:21 GMT</pubDate>
            <atom:updated>2026-01-17T11:57:13.256Z</atom:updated>
            <content:encoded><![CDATA[<h4>Exploring multi-threaded architectures that leave traditional caches in the dust</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oDlVAmDn6IE5-0Kq.jpg" /><figcaption>Nano Banana Pro generated — Prompted by myself with love</figcaption></figure><p>For over a decade, Redis has stood as the de facto standard for in-memory data stores, beloved for its simplicity and versatile data structures. However, the hardware landscape has shifted dramatically since the inception of Redis. While CPU clock speeds have plateaued, core counts have exploded. This hardware reality exposes the primary limitation of the traditional Redis architecture (a single-threaded event loop) which leaves the vast majority of modern server resources idle.</p><p>As applications demand lower latency and higher throughput at hyper-scale, a new generation of caching engines has emerged. These systems are not merely optimizing the existing codebase; they are reimagining the fundamental architecture of data storage to leverage multi-core processing and modern memory management. This article explores the architectural innovations of Dragonfly and Microsoft Garnet, reviews the lessons learned from KeyDB, and offers a decision framework for architects considering a migration.</p><h3>Dragonfly</h3><p>Dragonfly represents a paradigm shift from horizontal sharding to extreme vertical scaling. While traditional Redis deployments rely on clustering (spanning multiple nodes) to handle high loads, Dragonfly aims to saturate the resources of a single, powerful instance.</p><p>At the heart of Dragonfly is a “shared-nothing” architecture powered by a thread-per-core design. In this model, the key space is partitioned across available CPU cores. Each core is responsible strictly for its own slice of the data, which eliminates the need for expensive mutex locks or atomic operations that typically cause contention in multithreaded environments.</p><p>The results of this architectural choice are stark. Dragonfly has demonstrated throughput exceeding 4 million requests per second on single-node deployments. Crucially, it achieves this while maintaining Redis-compatible atomicity. By utilizing VLL (Very Large Lock) semantics and intelligent request pipelining, Dragonfly ensures that multi-key operations (those that might span different cores) are handled without global blocking. This allows engineering teams to consolidate their infrastructure, replacing dozens of Redis cluster nodes with a single Dragonfly instance, thereby simplifying operations and reducing latency jitter.</p><h3>Microsoft Garnet</h3><h4>High-Performance Caching via the .NET Ecosystem</h4><p>For years, the consensus in systems programming was that high-performance infrastructure must be written in C or C++. Microsoft Garnet challenges this supremacy by leveraging the modern .NET ecosystem to deliver a store that competes with, and often outperforms, native implementations.</p><p>Garnet is built upon Tsavorite (formerly FASTER), a high-performance storage engine designed for high concurrency. Unlike the traditional fork-based snapshotting mechanisms, Garnet utilizes a hybrid log architecture that allows for highly efficient persistence and updates.</p><p>The architectural breakthrough here lies in how Garnet utilizes memory. It employs zero-copy semantics and aggressive in-lining provided by modern .NET versions (specifically .NET 8 and beyond) to minimize the overhead typically associated with managed languages. By tuning the garbage collector and utilizing span-based memory access, Garnet achieves superior latency profiles across both Windows and Linux environments. This proves that with the right architectural patterns, managed languages can handle the rigorous demands of low-latency caching layers.</p><p>Surprisingly, Garnet uses the RESP protocol from Redis (<a href="https://medium.com/@maude.clonet/under-the-hood-why-is-redis-so-fast-cb3f76d12ede#0571">some details about RESP here</a>)</p><h3>KeyDB</h3><h4>A Retrospective on Multithreaded Redis Forks</h4><p>Before Dragonfly and Garnet rewrote the rules, KeyDB pioneered the concept of multithreaded Redis. As a direct fork of the Redis codebase, KeyDB attempted to introduce parallelism to an architecture designed for serial execution.</p><p>KeyDB provides critical technical context for the evolution of the event loop. By allowing multiple threads to access the global dictionary while protecting it with spinlocks, KeyDB proved that significant performance gains (often 3x to 5x over vanilla Redis) were possible without changing the underlying data structures.</p><p>However, KeyDB also serves as a vital case study on the long-term sustainability challenges facing community-led forks. Retrofitting parallelism into a single-threaded codebase introduces significant complexity, making it difficult to keep pace with the upstream features of Redis. As the project matured, the difficulty of maintaining complete compatibility while diverging architecturally highlighted a specific trade-off (the ease of adoption vs. the burden of maintenance). This history suggests that while forking offers a quick path to performance, ground-up rewrites like Dragonfly may offer a more sustainable trajectory for radical architectural changes.</p><h3>Architect’s Decision Matrix: Evaluating the Migration Path</h3><p>Adopting a specialized engine (Dragonfly, Garnet, or KeyDB) offers immense power, but it is not without trade-offs. Architects must weigh the operational complexity and ecosystem compatibility against the hardware consolidation benefits.</p><p>When evaluating a migration, consider the following vectors:</p><ul><li><strong>Throughput Requirements:</strong> If your current workload is comfortably handled by a standard Redis instance (under 50k — 100k ops/sec), the complexity of a non-standard engine may yield negative ROI. These high-performance engines shine at hyper-scale (hundreds of thousands to millions of ops/sec).</li><li><strong>Infrastructure TCO:</strong> Calculate the Total Cost of Ownership regarding node reduction. Specialized engines allow for massive hardware consolidation. If you are managing a Redis Cluster with 50+ nodes, replacing them with a highly available triplet of Dragonfly or Garnet nodes can drastically reduce cloud spend and networking overhead.</li><li><strong>Operational Maturity:</strong> Unlike Redis, which has over a decade of battle-testing and tooling support, newer engines have smaller communities. Your team must possess the internal capability to debug complex edge cases without relying on a vast repository of StackOverflow answers.</li><li><strong>Ecosystem Compatibility:</strong> While these engines claim Redis compatibility, subtle differences in command implementation or Lua script execution can occur. A migration requires a rigorous testing phase to ensure your specific client libraries and access patterns function as expected.</li></ul><p>In conclusion, the era of the single-threaded cache is ending for high-performance applications. Whether through the shared-nothing architecture of Dragonfly or the managed optimizations of Garnet, the future of caching is parallel, vertical, and incredibly fast.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3ec457c34be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enter Valkey 9.0]]></title>
            <link>https://medium.com/@maude.clonet/enter-valkey-9-0-221b6a5e25fe?source=rss-572095fc029f------2</link>
            <guid isPermaLink="false">https://medium.com/p/221b6a5e25fe</guid>
            <category><![CDATA[valkey]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[redis-alternatives]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[linux-foundation]]></category>
            <dc:creator><![CDATA[Maude Clonet]]></dc:creator>
            <pubDate>Thu, 01 Jan 2026 19:00:24 GMT</pubDate>
            <atom:updated>2026-01-17T11:57:22.573Z</atom:updated>
            <content:encoded><![CDATA[<h4>Redefining High-Performance Data Stores Through Open Innovation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uhCwNq2gGmH7Sboi.jpg" /><figcaption>Nano Banana Pro generated — Prompted by myself with love</figcaption></figure><p>The landscape of in-memory key-value stores is undergoing a seismic shift. Following recent licensing changes in the ecosystem, the industry has rallied around Valkey, a fully open-source alternative under the stewardship of the Linux Foundation. With the release of Valkey 9.0, the project moves beyond mere compatibility to establish a new benchmark for performance and scalability. This release introduces a suite of architectural overhauls (ranging from threading models to cluster management) that position it as a formidable engine for modern, high-density applications.</p><p>This analysis explores the four critical pillars of Valkey 9.0, detailing how it achieves extreme throughput and operational resilience.</p><h3>Asynchronous Threading Overhaul for Extreme Throughput</h3><p>At the heart of Valkey 9.0 lies a fundamental re-architecture of its processing engine. While previous iterations relied on traditional threading models that often hit ceilings on modern multi-core hardware, version 9.0 introduces a sophisticated asynchronous threading overhaul. This change is designed to eliminate the internal contention that typically throttles performance during peak loads.</p><p>The results of this re-engineering are stark. Benchmarks indicate a massive 40% performance gain over the Redis 7.2 baseline. By optimizing asynchronous I/O and command multiplexing (handling multiple signals simultaneously without blocking), the engine utilizes hardware resources with unprecedented efficiency. For enterprise architects and developers pushing the limits of scale, Valkey 9.0 is pushing boundaries toward the theoretical maximum of 1 billion requests per second on high-density hardware infrastructure.</p><h3>Zero-Downtime Slot Migration and Enhanced Resharding</h3><p>Horizontal scaling (adding more nodes to a cluster to handle increased load) has historically come with a penalty: latency spikes. Traditional methods of resharding involved a legacy key-by-key migration strategy, which often resulted in blocking operations that could interrupt real-time services.</p><p>Valkey 9.0 completely dismantles this limitation by introducing a highly efficient background transfer system. This release leverages snapshot-based atomic handoffs, a mechanism that allows data to move between nodes without locking the database or stalling client requests. This ensures that cluster rebalancing is virtually invisible to the end user. The result is zero-downtime slot migration, eliminating the latency jitter traditionally associated with scaling operations and providing a truly seamless path for growth.</p><h3>First-Class Multi-Database Support in Clusters</h3><p>For years, users of clustered in-memory stores faced a rigid architectural constraint: the inability to effectively use multiple numbered databases (like DB 0, DB 1, etc.) within a clustered environment. This forced developers to manage fragmented cluster instances or rewrite application logic to rely solely on key prefixes for namespace isolation.</p><p>Valkey 9.0 overcomes this long-standing limitation by enabling first-class multi-database support in clusters. This feature allows architects to maintain logical namespace isolation (keeping different datasets separate but within the same cluster) just as they would in a standalone instance. This is a game-changer for legacy application migration, as it simplifies the transition path without requiring complex code refactoring or the management of sprawling, fragmented infrastructure.</p><p>More details about this <a href="https://valkey.io/blog/numbered-databases/">on the Valkey blog</a></p><h3>Open Governance and a Performance-First Roadmap</h3><p>Beyond the code, Valkey 9.0 represents a philosophical victory for the open-source community. As a project hosted by the Linux Foundation, it marks a decisive shift toward vendor-neutral development. Unlike proprietary or restrictively licensed alternatives, Valkey is driven by a community-led approach that prioritizes engineering excellence over commercial product segmentation.</p><p>This open governance model ensures that core optimizations and advanced features remain accessible to all users without the constraints of restrictive licensing. The roadmap is defined by a “performance-first” ethos, guaranteeing that future innovations focus on raw speed, stability, and utility for the developer community (rather than upselling enterprise tiers). Valkey 9.0 is not just a database update, it is a declaration that the future of high-performance data infrastructure belongs to the open community.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=221b6a5e25fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Resilience in RAM with Redis]]></title>
            <link>https://medium.com/@maude.clonet/resilience-in-ram-with-redis-f73336f1c197?source=rss-572095fc029f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f73336f1c197</guid>
            <category><![CDATA[high-availability]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[redis-sentinel]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[redis-cluster]]></category>
            <dc:creator><![CDATA[Maude Clonet]]></dc:creator>
            <pubDate>Thu, 01 Jan 2026 18:54:23 GMT</pubDate>
            <atom:updated>2026-01-17T11:57:31.506Z</atom:updated>
            <content:encoded><![CDATA[<h4>Ensuring zero data loss with RDB, AOF, and next-gen Cluster replication</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wTaazRC6GjbsQ7AA.png" /><figcaption>Nano Banana Pro generated — Prompted by myself with love</figcaption></figure><p>For years, Redis held a reputation primarily as an ephemeral cache (a blazing fast layer for transient data). However, as modern architectures have evolved, Redis has graduated from a simple side-cache to a primary data store and a critical message broker. This shift demands more than just raw throughput; it requires robust data resilience.</p><p>Operating entirely in Random Access Memory offers speed, but it introduces the terrified realization that a power failure could wipe out the entire dataset. To run Redis in production as a reliable system of record, engineers must master the intricate balance of persistence strategies, high-availability orchestration, and the mechanics of sharding. Here is how we ensure resilience in the volatile world of RAM.</p><h4>Balancing Persistence: Mastering RDB and AOF Foundations</h4><p>At the core of Redis durability lies the tug-of-war between performance and data safety. Redis offers two distinct mechanisms to save in-memory data to disk: Redis Database (RDB) and Append Only File (AOF).</p><p><strong>RDB</strong> performs point-in-time snapshots. It forks the Redis process to create a compact binary representation of the dataset at specific intervals. Because the saving process happens in a child process using copy-on-write memory, the main thread remains relatively unblocked. However, RDB carries a “disaster window” risk; if Redis crashes between snapshots, any data written since the last save is lost.</p><p><strong>AOF</strong> takes the opposite approach by logging every write operation received by the server. This ensures higher durability (potentially saving every single write), but often results in larger files and slower restoration times.</p><p>The expert implementation usually involves a hybrid approach, but the real challenge lies in mitigating persistence-induced latency. When the AOF log grows too large, Redis triggers a “rewrite” to compact the file. Historically, this could impact CPU usage significantly.</p><p>To solve this, modern Redis versions (specifically Redis 7.0 and later) introduced <strong>Multi-Part AOF</strong>. Instead of a single monolithic file, the AOF is split into three components:</p><ul><li><strong>Base AOF:</strong> A snapshot-like file representing the data at the start of the rewrite.</li><li><strong>Incremental AOFs:</strong> Files containing new commands executed during the rewrite.</li><li><strong>Manifest File:</strong> A tracker that orders and manages these files.</li></ul><p>This architecture eliminates the complexity of the old rewrite mechanism. By appending to smaller files rather than rewriting a massive one from scratch, we eliminate bottlenecks and drastically accelerate recovery times during a restart.</p><h4>Orchestrating High Availability with Redis Sentinel</h4><p>Persistence protects data on disk, but it does not ensure service continuity. If the primary node fails, your application needs an immediate fallback. This is the domain of <strong>Redis Sentinel</strong>.</p><p>Sentinel is not a passive monitor; it is an active orchestration system designed to manage failover without human intervention. It operates on a <strong>quorum-based consensus engine</strong>. A single Sentinel seeing a master node go down creates a SDOWN (Subjective Down) condition. However, failover is not triggered until a specific number of Sentinels agree that the master is unreachable, upgrading the status to ODOWN (Objective Down).</p><p>The lifecycle of a high-availability event involves several distinct phases:</p><ol><li><strong>Detection:</strong> The quorum confirms the master is down.</li><li><strong>Election:</strong> Sentinels vote to elect a leader Sentinel to authorize the failover.</li><li><strong>Reconfiguration:</strong> The elected Sentinel picks the best replica (based on replication offset and priority), promotes it to master, and reconfigures the remaining replicas to follow the new leader.</li><li><strong>Notification:</strong> Sentinel acts as a configuration provider. Clients connect to Sentinel to ask “who is the current master?” rather than connecting to a specific IP address.</li></ol><p>This automated reconfiguration process ensures that even during catastrophic hardware failures, the downtime experienced by client applications is measured in seconds, not minutes.</p><h4>Horizontal Scaling: Internal Mechanics of Redis Cluster</h4><p>When dataset sizes exceed the RAM capacity of a single server, or when write throughput hits a single-core bottleneck, vertical scaling hits a wall. <strong>Redis Cluster</strong> solves this through horizontal scaling via a shared-nothing topology.</p><p>The magic number in Redis Cluster is <strong>16,384</strong>. The key space is divided into 16,384 hash slots. Every key is hashed (using the CRC16 algorithm) and mapped to one of these slots. The slots are then distributed across the available master nodes.</p><p>Unlike Sentinel, which manages a single master-replica set, Cluster manages data placement. However, efficiency relies heavily on the client side. A “dumb” client might send a request to Node A for a key that lives on Node B. Node A will respond with a MOVED error, telling the client to go to Node B. This creates an extra network hop (doubling the latency for that request).</p><p>To mitigate this, production environments must utilize <strong>smart clients</strong>. These clients cache the slot-map locally. When the application requests Key_X, the client calculates the hash, checks its internal map, and opens a connection directly to the correct node. This creates a localized access pattern that prevents unnecessary network hops and ensures that latency remains predictable even as the cluster scales to hundreds of nodes.</p><h4>The Next Frontier: Dual-Channel Replication and Performance Gains</h4><p>As we look toward Redis 8.0 and the emerging Valkey 8.0 (the high-performance fork), the architecture of replication is undergoing a massive overhaul. In previous versions, the replication link between a master and a replica was a single channel. This meant that control messages (like pings) and bulk data transfer (like RDB loading or heavy write streams) shared the same pipe.</p><p>During periods of high write throughput, the replication buffer could easily overflow, or large data transfers could block the heartbeat signals, causing the replica to disconnect and restart the synchronization process in a destructive loop.</p><p>The solution is <strong>Dual-Channel Replication</strong>.</p><p>This next-generation architecture splits the connection into two distinct streams:</p><ol><li><strong>Control Channel:</strong> Reserved for status checks, pings, and acknowledgments.</li><li><strong>Data Channel:</strong> Dedicated to the heavy lifting of command propagation and bulk transfer.</li></ol><p>By decoupling these operations, the system prevents “head-of-line blocking.” Even if the data channel is saturated with a massive batch job, the control channel remains open, allowing the master and replica to maintain their health status. Benchmarks indicate that this separation reduces synchronization time by up to 18% and significantly lowers the chance of buffer overflow errors. This ensures that the replica stays in sync (and ready for failover) even under the most aggressive write loads.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f73336f1c197" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Redis, beyond the cache]]></title>
            <link>https://medium.com/@maude.clonet/redis-beyond-the-cache-c2953d31c635?source=rss-572095fc029f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2953d31c635</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[vector-search]]></category>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[redis]]></category>
            <dc:creator><![CDATA[Maude Clonet]]></dc:creator>
            <pubDate>Thu, 01 Jan 2026 18:42:57 GMT</pubDate>
            <atom:updated>2026-01-17T11:57:44.875Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to use Redis as a primary datastore with Strings, Hashes, and Vector Search</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_U3_ZvwQ9k1_DX1ybFZVpQ.png" /><figcaption>Nano Banana Pro generated — Prompted by myself with love</figcaption></figure><p>For years, developers have treated Redis as a transient sidekick (a blazing fast cache to patch over slow SQL queries). It sits in front of the “real” database, storing session tokens or caching API responses with a short Time To Live (TTL). However, limiting Redis to caching is akin to buying a Ferrari solely to listen to its radio.</p><p>Redis is not merely a key-value store; it is a data structure server. By leveraging its persistent memory architecture and rich data types, you can architect systems where Redis serves as the primary source of truth. From memory-efficient object modeling to powering Generative AI pipelines, here is how to architect applications that live entirely in memory.</p><h3>Architecting Foundations: Beyond Basic Strings and Hashes</h3><p>The journey from using Redis as a cache to a primary datastore begins with data modeling. The most common anti-pattern in Redis adoption is treating it like a “string-only” bucket, where developers serialize massive JSON objects and dump them into a simple String key. While simple, this approach creates serialization overhead and network congestion when you only need to read or update a single field.</p><p>To architect a primary store, you must master the <strong>Hash</strong>.</p><p>Hashes are maps between string fields and string values, making them the perfect data type to represent objects (like users, products, or devices). Unlike a serialized JSON string, a Hash allows you to use HGET or HINCRBY to manipulate individual fields atomically without retrieving the entire object.</p><p>More details on my <a href="https://medium.com/@maude.clonet/how-redis-hashes-save-memory-1e2326730423">dedicated article about Redis Hashes</a></p><h4>The Memory Optimization: Listpacks</h4><p>The true power of the Hash lies in its internal memory encoding. Redis dynamically swaps underlying encoding methods based on the size of the data to optimize RAM usage.</p><p>When a Hash contains a small number of fields, and the values are small, Redis does not use a standard hash table. Instead, it uses a <strong>listpack</strong> (the modern successor to the ziplist). A listpack is a tightly packed, linear array of serialized data. Because it lacks the metadata overhead of a hash table bucket structure, it is incredibly memory efficient.</p><p>For a system storing millions of user profiles, keeping your objects within the hash-max-listpack-entries threshold can reduce memory footprint by up to 50% compared to traditional relational schemas or naive String storage. This allows you to fit significantly more data into RAM, making Redis a viable primary store for massive datasets.</p><h3>Streamlining Workflows: Atomic Queues and Relational Sets</h3><p>Building high-throughput workflows in traditional databases often involves complex locking mechanisms or external message brokers. Redis solves these concurrency challenges through atomic operations on <strong>Lists</strong> and <strong>Sets</strong>.</p><h4>Reliable Messaging with Lists</h4><p>Redis Lists are implemented as linked lists, making them ideal for high-velocity queues. However, a primary datastore requires reliability. A standard “pop” operation removes data; if the worker crashes immediately after popping, that job is lost forever.</p><p>To implement a reliable queue (similar to RabbitMQ or SQS) natively in Redis, you utilize atomic movement commands like LMOVE (formerly the RPOPLPUSH pattern). This command atomically removes an element from a &quot;Work&quot; queue and places it into a &quot;Processing&quot; queue in a single operation. If the consumer fails, the data remains safe in the &quot;Processing&quot; queue, allowing a monitor process to requeue it later. This guarantees exactly-once or at-least-once delivery semantics without external dependencies.</p><h4>High-Performance Relational Logic with Sets</h4><p>While Redis is NoSQL, it offers powerful set theory operations that mimic relational joins but at significantly higher speeds.</p><p>Sets are unordered collections of unique strings. They are invaluable for real-time tagging systems or tracking unique visitors. For example, if you need to find “Users who are Premium (Set A) AND logged in today (Set B),” you do not need to iterate through rows. You simply run SINTER (Set Intersection).</p><p>Redis computes this intersection using highly optimized C algorithms. Because the lookups are O(1) and the intersection complexity is proportional to the size of the smaller set, you can filter millions of users in microseconds. This enables real-time analytics dashboards that would bring a traditional SQL JOIN to a crawl.</p><h3>Real-Time Analytics: The Skip-List Mechanics of Sorted Sets</h3><p>If Strings are the bread and butter of Redis, <strong>Sorted Sets (ZSets)</strong> are the diamond drill bits. A Sorted Set is a collection of unique strings where every member is associated with a floating-point score. The elements are ordered by this score.</p><h4>The Hybrid Architecture</h4><p>Sorted Sets are technically fascinating because they use a dual internal data structure:</p><ol><li><strong>A Hash Table:</strong> Mappings of Objects to Scores (allowing O(1) lookups of a user&#39;s current score).</li><li><strong>A Skip-List:</strong> A probabilistic data structure that links elements in sorted order across multiple “levels.”</li></ol><p>This Skip-List architecture allows Redis to maintain order during insertions and perform range queries with O(log(N)) time complexity.</p><h4>Gaming Leaderboards and Rate Limiters</h4><p>This architecture makes Sorted Sets the industry standard for gaming leaderboards. You can retrieve the “Top 10 Players” out of 50 million users instantly with ZREVRANGE, regardless of how many users are in the system.</p><p>Beyond gaming, Sorted Sets are the engine behind precise <strong>Sliding Window Rate Limiters</strong>. By using the current Unix timestamp as the “score” and a unique request ID as the “member,” you can maintain a rolling window of API usage.</p><p>This logic executes in constant time relative to the window size, ensuring your API protection scales linearly with traffic.</p><h3>The AI Frontier: Vector Search and Semantic Caching</h3><p>The most recent evolution of Redis transforms it from a structural store into a Vector Database, positioning it as a critical component in Generative AI and Large Language Model (LLM) architectures.</p><h4>HNSW and Vector Indexing</h4><p>Traditional search looks for exact keyword matches. Vector search looks for <em>meaning</em>. By converting text, images, or audio into high-dimensional vectors (lists of floating-point numbers), you can perform similarity searches.</p><p>Redis implements <strong>HNSW (Hierarchical Navigable Small World)</strong> indexing. This is a graph-based algorithm that allows for approximate nearest neighbor search. Instead of calculating the distance between a query vector and every single document in your database (which is slow), HNSW traverses a multi-layered graph to “zoom in” on the most similar vectors. This allows Redis to return relevant context for RAG (Retrieval-Augmented Generation) applications in single-digit milliseconds.</p><h4>Semantic Caching</h4><p>The killer application for Redis in the AI era is <strong>Semantic Caching</strong>.</p><p>LLM API calls (like GPT-4) are expensive and slow. A standard cache fails here because users rarely type the exact same query twice. However, “How do I reset my password?” and “I forgot my credentials, help” mean the same thing.</p><p>By storing the <em>vector embedding</em> of the questions in Redis, you can intercept incoming queries, vectorize them, and search for semantically similar previous questions. If a match is found within a specific similarity threshold, Redis returns the cached answer immediately. This creates a “Semantic Cache” that bypasses the LLM entirely, dramatically reducing latency and slashing operational costs.</p><h4>The Future is Memory-First</h4><p>By evolving your stack from a “cache-aside” pattern to a Redis-primary architecture, you aren’t just gaining speed, you are simplifying your infrastructure. By unifying your object storage, reliable messaging, real-time analytics, and vector search into a single, high-performance engine, you eliminate the “impedance mismatch” between disparate databases and microservices.</p><p>As the demand for real-time responsiveness and AI-driven insights continues to grow, Redis stands as a testament that the fastest way to manage data is to keep it exactly where it can be used: in memory. Whether you are building a global leaderboard or a cutting-edge RAG pipeline, the tools are already in your hands. It’s time to take the Ferrari out of the garage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2953d31c635" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Under the hood: why is Redis so fast?]]></title>
            <link>https://medium.com/@maude.clonet/under-the-hood-why-is-redis-so-fast-cb3f76d12ede?source=rss-572095fc029f------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb3f76d12ede</guid>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[backend-engineering]]></category>
            <category><![CDATA[database-performance]]></category>
            <dc:creator><![CDATA[Maude Clonet]]></dc:creator>
            <pubDate>Thu, 01 Jan 2026 18:31:23 GMT</pubDate>
            <atom:updated>2026-01-17T11:57:53.308Z</atom:updated>
            <content:encoded><![CDATA[<h4>Decoding I/O Multiplexing, the RESP protocol, and the single-threaded myth</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-nDvmwkyW6TShkkfyhq67A.png" /><figcaption>Nano Banana Pro generated — Prompted by myself with love</figcaption></figure><p>In the landscape of modern database technology, Redis is frequently cited as the gold standard for performance. When developers need sub-millisecond latency or high throughput, they almost instinctively reach for Redis. While the common answer to “why is it so fast?” is usually “because it runs in RAM,” that is a drastic oversimplification.</p><p>Memory storage is merely the canvas; the speed comes from the painting technique. The true secret to Redis’s performance lies in a rigorous adherence to efficiency, spanning from its architectural philosophy to the byte-level design of its networking protocol.</p><p>In this second article of this serie about Redis ( <a href="https://medium.com/@maude.clonet/the-great-redis-schism-aa059a67d3b3">read the first here</a>), I invite you to look under the hood. We will dissect the engineering decisions regarding threading models, kernel-level I/O management, and memory structures to understand how Redis squeezes every cycle out of the CPU.</p><h3>The Single-Threaded Architecture: Debunking Common Misconceptions</h3><p>The most discussed aspect of Redis is its single-threaded architecture (often viewed as a limitation by newcomers). However, this design choice is arguably the single greatest contributor to its speed.</p><p>To be precise, Redis uses a single thread for its main event loop. This means that all client requests (GET, SET, INCR, etc.) are executed sequentially. In a world obsessed with multi-threading and horizontal scaling, this seems counterintuitive. Why not use all the cores?</p><p>The answer lies in the elimination of complexity. Multi-threaded systems require locks (mutexes) to prevent race conditions when multiple threads access shared data. Managing these locks introduces significant overhead. Furthermore, multi-threading relies on the operating system to switch contexts between threads. Context switching is computationally expensive; it involves saving the execution state, swapping registers, and often flushing CPU caches.</p><p>By sticking to a single execution thread for commands, Redis guarantees atomicity without locks. There is no overhead from thread synchronization, and the CPU spends its time processing data rather than managing resource contention.</p><h4>The Evolution: Redis 6+ and Valkey</h4><p>It is important to note that the “single-threaded” label is evolving. While the command execution remains single-threaded to preserve atomicity, modern iterations like Redis 6.0 and the open-source fork Valkey have introduced I/O threading.</p><p>These versions offload the time-consuming tasks of reading from the network socket and writing the response back to the client to background threads. This allows the main thread to focus exclusively on memory manipulation. Additionally, operations like UNLINK (asynchronous delete) allow Redis to reclaim large amounts of memory in a background thread, preventing the main loop from blocking during the deletion of massive keys.</p><h3>Mastering I/O Multiplexing: The Power of epoll and kqueue</h3><p>If Redis uses a single thread for commands, how does it handle 10,000 concurrent client connections without choking? The answer is I/O Multiplexing.</p><p>Redis employs a Reactor design pattern. Rather than blocking the thread while waiting for a network packet to arrive (which would bring the database to a halt), Redis asks the operating system kernel to watch the sockets for it.</p><p>On Linux, this is achieved via epoll; on macOS and BSD, it utilizes kqueue.</p><p>Here is the flow:</p><ol><li>Redis provides the kernel with a list of file descriptors (connections) it is interested in.</li><li>The kernel monitors these connections asynchronously.</li><li>When data arrives on a socket, the kernel signals Redis (via the event loop) that the specific descriptor is “readable.”</li><li>Redis processes only the connections that have pending data.</li></ol><p>This mechanism allows a single thread to monitor thousands of connections with negligible overhead. The CPU is never idle waiting for network latency; it only processes requests when the data is fully buffered and ready to be acted upon. This non-blocking I/O approach is what allows Redis to maintain high throughput even as the number of connected clients scales up.</p><h3>Performance by Design: Memory Locality and Data Structure Optimization</h3><p>Being an in-memory database eliminates the latency of disk I/O, but Redis goes further by optimizing for CPU cache efficiency. In modern computing, fetching data from main RAM is significantly slower than fetching it from the CPU’s L1, L2, or L3 caches.</p><p>Redis developers have historically been obsessive about memory layout. The goal is to reduce “pointer chasing” (jumping around memory addresses) which leads to cache misses.</p><h4>Customized Data Structures</h4><p>Redis does not simply use standard programming language arrays or hash maps. It implements specialized structures designed for memory efficiency:</p><ul><li><strong>Ziplists (and listpacks):</strong> For small lists or hashes, Redis encodes the data into a single, contiguous block of memory. This reduces memory fragmentation and ensures that when the CPU fetches the object, the data is likely already in the cache line.</li><li><strong>Intsets:</strong> When a Set consists only of integers, Redis stores them as a sorted array of integers rather than a hash table. This drastically reduces memory usage and allows for O(1) checks or fast binary searches.</li></ul><p>By tailoring data structures to the specific data being stored, Redis minimizes the memory footprint and maximizes the probability of CPU cache hits, effectively bypassing the bottlenecks that plague systems relying on generic object wrappers.</p><h3>RESP Protocol: The Foundation of High-Speed Client Communication</h3><p>Finally, the speed of the engine means nothing if the communication channel is clogged. Redis uses RESP (REdis Serialization Protocol), a protocol designed specifically for the intersection of performance and simplicity.</p><p>Many modern databases use JSON or heavy binary formats (like Protobuf) for communication. JSON requires expensive parsing logic (scanning for brackets, quotes, and escape characters). Complex binary formats require significant CPU cycles to serialize and deserialize.</p><p>RESP strikes a balance. It is binary-safe yet human-readable.</p><p>A simple command to set a key looks like this:</p><pre>*3<br>$3<br>SET<br>$5<br>mykey<br>$5<br>value</pre><ul><li>*3 tells the server to expect an array of three elements.</li><li>$3 tells the server the next string is exactly 3 bytes long.</li></ul><p>Because the length of every argument is prefixed, the Redis parser does not need to scan the data to find the end of a string. It reads the length, allocates the memory, and reads the bytes directly. This reduces the parsing complexity to O(N) where N is the number of bytes, with very small constant factors.</p><p>This lightweight protocol allows client libraries in virtually any language (Python, Go, Java, Node.js) to construct requests and parse responses with minimal CPU overhead, ensuring that the client application is rarely the bottleneck.</p><p>More details on the <a href="https://redis.io/docs/latest/develop/reference/protocol-spec">official RESP specification</a></p><h3>Conclusion</h3><p>Redis is not fast simply because it avoids the hard drive. It is fast because it is a holistic engineering achievement. By combining an atomic single-threaded execution model, kernel-level I/O multiplexing, cache-aware data structures, and a streamlined network protocol, Redis eliminates the friction that slows down traditional systems. Understanding these internal mechanics allows developers to not just use Redis, but to architect applications that truly leverage its power.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb3f76d12ede" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Great Redis Schism]]></title>
            <link>https://medium.com/@maude.clonet/the-great-redis-schism-aa059a67d3b3?source=rss-572095fc029f------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa059a67d3b3</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[valkey]]></category>
            <category><![CDATA[open-source-licensing]]></category>
            <category><![CDATA[redis]]></category>
            <dc:creator><![CDATA[Maude Clonet]]></dc:creator>
            <pubDate>Thu, 01 Jan 2026 18:22:52 GMT</pubDate>
            <atom:updated>2026-01-17T11:58:02.386Z</atom:updated>
            <content:encoded><![CDATA[<h4>Navigating the shift from BSD to Source-Available and the rise of Valkey</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*svMVoEDnlTmGooKyvEY6qQ.png" /><figcaption>Nano Banana Pro generated — Prompted by myself with love</figcaption></figure><p>For over a decade, Redis has been the “ketchup” of the modern technology stack: it goes with everything. Whether you are building a scrappy startup MVP or architecting a global streaming service, the remote dictionary server has been the default choice for caching, message brokering, and high-speed data manipulation.</p><p>However, in early 2024, the tectonic plates of the database world shifted. The move by Redis Ltd. to abandon the permissive BSD license in favor of more restrictive terms triggered an immediate community reaction, resulting in the creation of Valkey. This article explores the engineering origins of the project, the economic realities that forced the split, and how engineering teams should navigate this new, bifurcated landscape.</p><h3>The Origins of Minimalist Performance</h3><p>To understand the magnitude of the 2024 split, one must first appreciate the specific philosophy that made Redis ubiquitous. Redis was not born in a corporate boardroom, it was born out of frustration by Salvatore Sanfilippo (known online as <strong>antirez</strong>) in 2009.</p><h4>The Architecture of Purity</h4><p>Antirez’s vision was radically different from the heavy, complex relational databases of the era. He prioritized a “mental model” mapping directly to code. If you understood how a Linked List or a Hash Map worked in C, you understood Redis.</p><ul><li><strong>Single-Threaded Event Loop:</strong> Unlike multi-threaded architectures that grapple with complex locking mechanisms and race conditions, Redis utilized a single-threaded event loop. This eliminated context-switching overhead, allowing it to serve millions of requests per second with predictable latency.</li><li><strong>Data Structure Fidelity:</strong> Redis wasn’t just a key-value store (like Memcached), it was a <em>data structure server</em>. It exposed Lists, Sets, Sorted Sets, and Hashes as native primitives.</li><li><strong>The BSD License:</strong> Perhaps most importantly, Redis was released under the <strong>BSD 3-Clause license</strong>. This permissive license allowed anyone (from hobbyists to hyperscalers) to use, modify, and even monetize the code without contributing back.</li></ul><p>This combination of engineering purity and legal permissiveness established Redis as the industry standard for in-memory performance.</p><h3>The 2024 Pivot: Dual-Licensing and Economic Conflict</h3><p>On March 20, 2024, the era of the BSD license ended. Redis Ltd. announced that all future versions of Redis would be dual-licensed under the <strong>Redis Source Available License v2 (RSALv2)</strong> and the <strong>Server Side Public License v1 (SSPLv1)</strong>.</p><h4>The “Cloud-on-Cloud” War</h4><p>This decision was not arbitrary, it was a response to the “strip-mining” of open-source software. For years, hyperscale cloud providers (AWS, Google Cloud, Azure) offered managed Redis services (e.g., ElastiCache) generating billions in revenue. While these providers built massive businesses on top of the Redis engine, Redis Ltd. argued that they contributed disproportionately little back to the core project’s sustainability.</p><h4>Decoding the New Licenses</h4><p>The shift effectively moved Redis from “Open Source” (OSI definition) to “Source Available.”</p><ul><li><strong>The Restriction:</strong> You can still view the source code, modify it, and use it internally for free. However, you cannot offer Redis as a managed service to others.</li><li><strong>The Impact:</strong> This effectively killed the business model of competitors attempting to sell “Redis-as-a-Service” without a commercial agreement with Redis Ltd.</li></ul><p>While economically rational for the commercial entity, this move shattered the trust of the open-source purists and Linux distributors. It signaled that the project’s governance was ultimately beholden to shareholder value rather than community consensus.</p><h3>The Rise of Valkey: Preserving the Open-Source Legacy</h3><p>The industry’s reaction was swift and decisive. Within weeks of the license change, the Linux Foundation announced <strong>Valkey</strong>, a hard fork of Redis 7.2.4.</p><h4>Why Valkey is Different</h4><p>Valkey is not just a copy, it represents a migration of the project’s intellectual center of gravity.</p><ul><li><strong>Vendor-Neutral Governance:</strong> Unlike Redis, which was controlled by a single company, Valkey is governed by the Linux Foundation. This ensures that no single entity can pull the rug out from under the users regarding licensing in the future.</li><li><strong>The Maintainer Migration:</strong> Crucially, several former core maintainers of Redis-engineers from AWS, Google, Ericsson, and Oracle-shifted their efforts to Valkey. This provided the fork with immediate technical legitimacy.</li><li><strong>Standardization:</strong> Major cloud providers, including AWS and Google Cloud, have already announced support for Valkey in their managed services. For the broader infrastructure ecosystem, Valkey has become the de facto successor to the open-source Redis lineage.</li></ul><p>The roadmap for Valkey is aggressive, focusing on multi-threaded performance improvements (an area where the original Redis was conservative) and reliable, predictable slot migration for clustered environments.</p><h3>The Case for Enterprise Redis: Evaluating the Commercial Ecosystem</h3><p>Despite the momentum behind Valkey, dismissing the official Redis distribution would be a mistake. For many organizations, particularly those focused on application development rather than infrastructure management, Redis Ltd. offers a compelling value proposition.</p><h4>Beyond the Cache</h4><p>Redis Ltd. has spent years building a “Super Redis” that goes far beyond simple caching.</p><ul><li><strong>Redis Stack:</strong> This suite integrates powerful modules that transform Redis into a multi-model database: <br>- <strong>RedisSearch:</strong> Full-text search capabilities at in-memory speeds.<br>- <strong>RedisJSON:</strong> Native storage and manipulation of JSON documents.<br>- <strong>Vector Search:</strong> Capabilities for AI/ML vector similarity search, positioning Redis as a player in the RAG (Retrieval-Augmented Generation) stack.</li><li><strong>Developer Experience:</strong> Tools like <strong>Redis Insight</strong> provide a polished GUI for data visualization and debugging, a stark contrast to the CLI-heavy approach of the open-source past.</li></ul><h4>The Verdict</h4><p>The schism has created two distinct paths:</p><ol><li><strong>The Infrastructure Path (Valkey):</strong> If you need a rock-solid, high-performance distributed cache and you rely on cloud-managed services (like ElastiCache), Valkey is your future. It preserves the open-source spirit and guarantees long-term stability without licensing headaches.</li><li><strong>The Application Path (Redis Enterprise):</strong> If you are leveraging advanced features like Vector Search, JSON manipulation, or require enterprise-grade SLAs and support, the commercial Redis offering remains superior.</li></ol><p>The “Great Schism” is not the death of Redis, it is a specialized bifurcation. The market has simply separated the raw engine from the luxury vehicle, allowing developers to choose the model that best fits their architectural and economic requirements.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa059a67d3b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>