<?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 Jhonatan Raphael on Medium]]></title>
        <description><![CDATA[Stories by Jhonatan Raphael on Medium]]></description>
        <link>https://medium.com/@jhon.raphael?source=rss-5ec8193da17b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*embZOMm_K_Vkjc1TfFP7Og.jpeg</url>
            <title>Stories by Jhonatan Raphael on Medium</title>
            <link>https://medium.com/@jhon.raphael?source=rss-5ec8193da17b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 17:45:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jhon.raphael/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[Replication: what happens when one copy of your data is not enough?]]></title>
            <link>https://medium.com/@jhon.raphael/replication-what-happens-when-one-copy-of-your-data-is-not-enough-8ac82f8966f3?source=rss-5ec8193da17b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ac82f8966f3</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Jhonatan Raphael]]></dc:creator>
            <pubDate>Sun, 16 Aug 2026 15:03:59 GMT</pubDate>
            <atom:updated>2026-08-16T15:20:09.836Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part 3 of the Principles of Distributed Systems series.</h4><p>Hi everyone! 👋</p><p>Before we begin, a quick update on this series. What started as a series on Distributed Systems is evolving into a structured technical library covering three main areas: <strong>Computer Science Fundamentals</strong>, <strong>System Design &amp; Distributed Architecture</strong>, and <strong>Software Engineering</strong>.</p><p>The content will be organized into <strong>Core</strong> and <strong>Advanced</strong> topics and, whenever it makes sense, will follow a consistent structure: <strong>The Problem → How It Works → Relationship with the CAP Theorem → Real-World Applications → How It Comes Up in Interviews → Conclusion</strong>. The idea is to always start with a concrete engineering problem and introduce concepts as they become necessary to understand it.</p><p>In the first articles of this series, we explored the <strong>Dual Write Problem</strong> and <strong>Idempotency</strong>. Now, let’s start with another common problem: <strong>what happens when a single copy of our data is no longer enough?</strong></p><h3>1. The Problem: a single copy of the data</h3><p>Imagine an application that depends on a single database. As long as that database is available, the model is simple: all reads and writes go through the same place, and there is a single version of the state.</p><p>The first problem appears when that database becomes unavailable. Even if every other component of the application is still running, a significant part of the system can no longer serve requests because it has lost access to its data. The database has become a <strong>single point of failure</strong>, a common term in distributed systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NmeMNjpESnH-IzBxA_rbow.png" /><figcaption>A single database as a single point of failure</figcaption></figure><p>Availability is not the only limitation. As the application grows, read traffic may eventually reach a point where a single instance can no longer handle the entire load. We can add CPU, memory, and capacity to the machine, but <strong>vertical scaling</strong> has physical and economic limits.</p><p><strong>Data location</strong> also matters. If all the data is stored in the United States, for example, users in Brazil, Europe, or Japan have to communicate across large geographical distances for every operation. Even with an extremely fast database, we cannot eliminate the physical latency of the network.</p><p>One way to address these problems is to stop depending on a single copy and maintain the same data across multiple nodes. This is where <strong>Replication</strong> comes in.</p><h3>2. How it works</h3><p>Replication is the process of maintaining copies of the same data across multiple nodes. These copies can be used to increase availability, distribute reads, and, in geographically distributed architectures, move data closer to users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9fHB8j9a3Oxp2v_BFSqNA.png" /><figcaption>From a single database to multiple replicas</figcaption></figure><p>Creating additional copies, however, introduces a question that did not exist when we had only one database: <strong>how do we make sure they all represent the same state?</strong></p><p>Imagine three replicas containing balance = 100. A client updates the balance to 80. That change needs to reach the other replicas, and for some period of time, one replica may already contain 80 while another still contains 100.</p><p>If a client performs a read at that moment, the result may depend on which replica serves the request. Replication solves some problems, but introduces a new one: <strong>keeping multiple copies coordinated</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e7CNVsPL5jWjf6u0H2XdcQ.png" /><figcaption>Replicas temporarily holding different versions of the same data</figcaption></figure><h3>Leader-Based Replication</h3><p>A common replication strategy is to designate one replica to receive writes, usually called the <strong>leader</strong> or <strong>primary</strong>. The other replicas receive changes from that node and, depending on the architecture, may also serve reads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ctxOtM1312_xYUiCtKP1Sg.png" /><figcaption>Leader-based Replication</figcaption></figure><p>This model simplifies write coordination by establishing one node responsible for ordering writes and propagating them to the other copies. Other strategies exist, such as <strong>multi-leader</strong> and <strong>leaderless replication</strong>, each with different mechanisms and trade-offs. We won’t explore them in depth here; they may be covered later in the <strong>Advanced</strong> part of the series.</p><p>Regardless of the strategy, we still need to decide <strong>when a write can be considered complete</strong>.</p><p>With <strong>synchronous replication</strong>, we can wait for one or more replicas to confirm the update before responding to the client. This provides stronger guarantees that the update exists on multiple nodes, but adds communication to the critical path of the operation.</p><p>With <strong>asynchronous replication</strong>, the write can be acknowledged before the other replicas have received the update. This reduces the need to wait for the other copies, but creates a window in which different replicas may hold different versions of the same data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4hcHvbkqJaE3ry9ZuxXZ9w.png" /><figcaption>Synchronous vs Asynchronous replication</figcaption></figure><p>This difference between the state of the replicas is known as <strong>replication lag</strong>. A user might, for example, make a change and immediately perform a read against a replica that has not received the update yet, temporarily seeing the previous value.</p><p>This leads us to a broader question: <strong>what guarantees should a system provide about the state observed by its clients?</strong> This is one of the key decisions that emerges when we start working with multiple copies of the same data.</p><h3>3. Relationship with the CAP Theorem</h3><p>It is always important to understand how the problem we are analyzing relates to the CAP Theorem. In the case of replication, this relationship emerges naturally as soon as we distribute multiple copies of the same data.</p><p>In a distributed system, we have to assume that communication failures between nodes can happen. In other words, <strong>Partition Tolerance P</strong> is not a property we can simply give up. The system needs to define how it will continue to behave even when communication between some of its nodes is unavailable.</p><p>Replication is often used to increase <strong>Availability A</strong>. If one replica is unavailable or unreachable, another may continue serving requests. Multiple replicas can also distribute load and bring data closer to users.</p><p>When we combine these two properties — tolerating partitions and remaining available — the problem of <strong>Consistency C </strong>naturally emerges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u7yxB_EMm3Rlsc8i345aRA.png" /></figure><p>Imagine that a write is accepted by one replica while another cannot be reached. If we want the system to remain available, we cannot depend on the participation of that second replica to complete every operation. As a consequence, different copies may temporarily observe different states.</p><p>In this model, we are favoring <strong>Availability + Partition Tolerance (AP)</strong> and accepting weaker consistency, often eventual consistency, until the replicas are able to converge again.</p><p>This does not mean that replication is incompatible with strong consistency. A distributed database can provide strong consistency guarantees, but it needs to solve the problem introduced by multiple copies through coordination mechanisms.</p><p>That coordination comes at a cost. To provide a strong guarantee, the system needs to obtain the necessary confirmations before responding to the operation. This adds communication to the critical path, potentially increasing latency and reducing throughput. In addition, if the nodes required to provide that guarantee are unavailable or unable to communicate, the system may need to reject or delay certain operations rather than respond with potentially inconsistent state.</p><p>In that case, we are making the opposite choice: <strong>we prioritize Consistency C and Partition Tolerance P at the expense of Availability A </strong>for that operation. The cost is not only higher latency under normal conditions, but also a greater chance that the operation cannot be served during failures.</p><p>This is precisely why the ability to work with different consistency guarantees is so useful in replicated systems. Not every operation has the same business requirements. Some can accept temporarily stale data in exchange for lower latency and higher availability; others need to observe the latest state, even if that requires additional coordination and makes the operation less available during failures.</p><p>We can therefore think about replication as a simple sequence:</p><blockquote>1. Replication increases our ability to remain available</blockquote><blockquote>2. Multiple copies introduce the consistency problem</blockquote><blockquote>3. Stronger consistency guarantees require coordination</blockquote><blockquote>4. Business requirements determine where that cost is worth paying.</blockquote><p>The CAP Theorem helps explain why these choices exist. More important than classifying an entire system as “AP” or “CP” is understanding <strong>how each operation needs to behave and which guarantees we are prioritizing in that context</strong>.</p><h3>4. Real-World Applications</h3><p>Replication appears in virtually every modern distributed storage system. Many of these technologies internally handle much of the complexity involved in maintaining multiple copies of the data, but that does not eliminate the need to understand the guarantees they provide.</p><p>At VTEX, we designed a system where a user needed to retrieve information about a product return shortly after the return was created. If the write occurred on one replica and the following read was routed to another replica that had not yet received the update, the user could see the previous state.</p><p>One possibility would be to use a <strong>strongly consistent read</strong>. Amazon DynamoDB, for example, allows applications to choose between <strong>eventually consistent</strong> and <strong>strongly consistent</strong> reads in supported scenarios. The choice depends on the requirements of the operation: some reads can tolerate temporarily stale data, while others need to observe the latest state.</p><p>This flexibility is especially important because stronger guarantees may require more coordination between replicas. In architectures distributed across regions, this may mean adding cross-region communication to the critical path of an operation, increasing latency and dependency between regions.</p><p>On the other hand, allowing replicas to operate more independently can improve latency and availability, but it means accepting periods in which different copies do not yet observe exactly the same state.</p><p>The database may abstract away much of this complexity, but <strong>choosing the right guarantee remains an architectural decision</strong>. To make that decision correctly, we need to understand the behavior of the technology we are using and, more importantly, the requirements of the operation we are building.</p><h3>5. How It Comes Up in Interviews</h3><p>Replication comes up constantly in System Design interviews, even when the question does not explicitly mention it.</p><p>Imagine that, while designing a system, you choose a database. The interviewer might simply ask: <strong>“What happens if this database goes down?”</strong></p><p>Adding replicas seems like a natural answer, but that decision opens up several other questions. We need to define which node receives writes, whether reads can be served by replicas, what happens when one of them is lagging, and which guarantees we want to provide when some nodes are unavailable.</p><p>A more mature answer starts with the system requirements. If the main problem is read volume, read replicas can help distribute the load. If users are geographically distributed, replicas closer to them can reduce latency. If availability is the primary requirement, we need to think about failover and how the system behaves when a node goes down.</p><p>On the other hand, if certain operations require strong consistency guarantees, we need to consider the level of coordination required between replicas and the impact of that decision on latency and availability.</p><p>The point is not to simply answer <strong>“we can add replicas.”</strong> Replication is the beginning of the discussion, not the end. What matters is being able to explain <strong>why we need those copies, what guarantees we expect from them, and what new problems we introduce by creating them</strong>.</p><h3>6. Conclusion</h3><p>Replication addresses a fundamental limitation of relying on a single copy of our data. With multiple replicas, we can increase availability, distribute reads, and bring data closer to users.</p><p>But creating additional copies also introduces a new problem: <strong>how do we keep them coordinated?</strong> We need to decide when a write can be considered complete, which replicas can serve operations, and which guarantees we want to preserve when they do not hold exactly the same state.</p><p>Part of this complexity may be abstracted away by the database, but the guarantees we choose still directly affect the properties of our system.</p><p>Ultimately, replication is not just about creating copies of data. It is about understanding <strong>which guarantees we need to provide and what costs we are willing to pay to maintain them</strong>.</p><p>See you in the next post! 👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ac82f8966f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Idempotency: Designing Systems That Expect Duplicates]]></title>
            <link>https://medium.com/@jhon.raphael/idempotency-designing-systems-that-expect-duplicates-75ca0346e2fe?source=rss-5ec8193da17b------2</link>
            <guid isPermaLink="false">https://medium.com/p/75ca0346e2fe</guid>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Jhonatan Raphael]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 21:10:07 GMT</pubDate>
            <atom:updated>2026-08-04T21:17:26.420Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part 2 of the Principles of Distributed Systems series.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nVMFGcAf6nmjPT-DTQuYRg.png" /><figcaption>Duplicate deliveries in a distributed system</figcaption></figure><p>In the previous article, I discussed the <strong>Dual Write Problem</strong> and how failures between two operations can leave a distributed system in an inconsistent state. If you haven’t read it yet, I recommend starting there: <a href="https://medium.com/@jhon.raphael/the-dual-write-problem-and-why-it-keeps-coming-back-e3617fcd26cf"><strong>The Dual Write Problem (and Why It Keeps Coming Back)</strong></a>.</p><p>This time, I’d like to explore a different problem — one that every distributed system eventually faces.</p><p>Imagine your service receives an event indicating that an order has been placed or a payment has been approved. The message is processed successfully: the database is updated, the customer receives an email, and the next step of the workflow is triggered. Everything works exactly as expected.</p><p>A few seconds later, however, the very same event arrives again. Then it arrives a third time. At this point, the most important question isn’t:</p><blockquote><strong><em>“Why was this message delivered more than once?”</em></strong></blockquote><p>The real question is:</p><blockquote><strong><em>“Will my system still be correct when that inevitably happens?”</em></strong></blockquote><h3>Why do duplicate messages happen?</h3><p>Many engineers intuitively think that a message should be delivered exactly once. In reality, distributed systems rarely work that way.</p><p>Duplicate deliveries are a natural consequence of building software on unreliable networks. A message may be retried because of a timeout, an acknowledgement (ACK) may be lost, a consumer may crash immediately after processing the event, or an entire service may be restarted during a failover. None of these situations necessarily indicates a bug.</p><p>In fact, duplicates are often created by the very mechanisms that make distributed systems reliable. Retries exist because temporary failures happen, and replaying an operation is usually safer than assuming it never completed.</p><p>This changes how we should approach the problem. Instead of asking how to eliminate duplicate messages, we should ask how to make duplicate messages harmless.</p><h3>The Principle</h3><p>This is exactly where <strong>idempotency</strong> becomes essential.</p><p>An operation is idempotent when executing it once or executing it multiple times produces the same final state. If the same payment approval event is processed three times, the order should still be released only once, the payment should still be approved only once, the customer should receive a single email, and inventory should be reserved a single time. Notice that the objective is <strong>not</strong> to prevent duplicates. The objective is to guarantee that duplicates don’t create additional side effects.</p><p>That’s an important distinction, because in distributed systems we often have little control over whether a message will be delivered again. What we can control is how our application behaves when that happens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fdMfec-jrC9Vd0OoNAKxzg.png" /><figcaption>Multiple executions, one final state</figcaption></figure><h3>How is idempotency usually implemented?</h3><p>Although implementations vary, the underlying idea is remarkably simple.</p><p>Each operation carries a unique identity — an eventId, paymentId, refundId, or another business identifier. Before executing the operation, the system checks whether that identity has already been processed.</p><p>The important detail is that this check must itself be consistent. If checking and recording the identifier are not performed atomically, two concurrent executions may both conclude that the operation hasn’t been processed yet, producing duplicate side effects anyway.</p><p>If the identifier already exists, the system simply returns success. Otherwise, it performs the operation and records its execution.</p><p>From that point on, it doesn’t matter how many times the same message is delivered again — the effect remains exactly the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dxVHVImdRIM3x771JhYIJw.png" /><figcaption>Typical idempotency flow</figcaption></figure><h3>Where I’ve applied this principle</h3><p>One of the most interesting applications of idempotency I worked on happened while building a <strong>distributed workflow orchestrator</strong> at Mercado Livre.</p><p>Automatic retries were part of the normal execution model, so tasks could legitimately be replayed. To keep workflows consistent, we implemented idempotency in the component responsible for persisting state of the tasks. That ensured that replaying a task never changed its state twice, significantly reducing unnecessary failures while preserving workflow consistency.</p><p>I encountered the same principle again in a completely different context at VTEX. One component of the Order Management System was responsible for sending refund requests to the payment Gateway. Since several scenarios could trigger the same refund more than once, we deliberately relied on an important property of the Gateway itself: refund operations were already idempotent.</p><p>That decision greatly simplified the architecture. Instead of trying to eliminate retries entirely, we could safely resend refund requests whenever necessary, knowing that the payment provider itself guaranteed that the refund would be executed only once.</p><h3>Final Thoughts</h3><p>After spending some time building distributed systems, I’ve realized that the question is rarely:</p><blockquote><strong><em>“How do I prevent duplicate messages?”</em></strong></blockquote><p>A much better question is:</p><blockquote><strong><em>“Will my system remain correct when duplicate messages inevitably happen?”</em></strong></blockquote><p>That shift in perspective changes the way we design software.</p><p>Distributed systems shouldn’t be built under the assumption that failures won’t happen. They should be built assuming they will — and that retries, replays, and duplicate deliveries are simply part of normal operation.</p><p><strong>Idempotency doesn’t exist to prevent duplicates. It exists to make duplicates harmless.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75ca0346e2fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Dual Write Problem (and Why It Keeps Coming Back)]]></title>
            <link>https://medium.com/@jhon.raphael/the-dual-write-problem-and-why-it-keeps-coming-back-e3617fcd26cf?source=rss-5ec8193da17b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3617fcd26cf</guid>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <dc:creator><![CDATA[Jhonatan Raphael]]></dc:creator>
            <pubDate>Sat, 27 Jun 2026 21:18:27 GMT</pubDate>
            <atom:updated>2026-06-27T21:18:27.653Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Part 1 of the </em><strong><em>Principles of Distributed Systems</em></strong><em> series.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zo1KvbQfWg_a8aDLaiC3fQ.png" /><figcaption>One write succeeds. The other doesn’t. That’s all it takes for a distributed system to become inconsistent.</figcaption></figure><p>When designing distributed systems, one challenge appears over and over again: maintaining consistency across two write operations performed against independent distributed components. At first glance, the workflow seems straightforward. In practice, however, it hides one of the most common sources of inconsistency in distributed architectures.</p><p>Consider a simple example. Imagine a service responsible for creating an order. After persisting the order in a database, the service publishes an OrderCreated event to a message broker. As long as both operations succeed, the system remains consistent. The problem begins when only one of them succeeds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LHOmeWmPXV6KEI3mgdqz3g.png" /><figcaption>Expected behavior when both write operations succeed.</figcaption></figure><p>In distributed systems, communication failures are not exceptional events — they are part of the system’s normal operating conditions. If the database write succeeds but publishing the event fails — whether because of a timeout, an HTTP 500 response, or a temporary broker outage — the persisted state now exists without the rest of the ecosystem ever becoming aware of it. From the perspective of downstream services, that order simply never existed.</p><p>This is known as the <strong>Dual Write Problem</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ml86-O3MFCO9Ap5RCL6cHw.png" /><figcaption>The order exists in the database, but the event was never published, leaving downstream services with an inconsistent view of the system</figcaption></figure><p>Throughout my career, I’ve encountered this problem in completely different architectures.</p><p>In one project, we were building a microservices orchestration platform. One of the services persisted its state in a key-value database while publishing events responsible for coordinating distributed workflows across multiple services. Eventually, temporary failures in the messaging infrastructure created inconsistencies between the persisted state and the events delivered to the rest of the system.</p><p>More recently, while designing another distributed domain, I found myself facing exactly the same challenge: how to propagate persisted changes reliably to other services.</p><p>Different technologies. Different business domains. Exactly the same problem.</p><h3>The Connection with the CAP Theorem</h3><p>Although the Dual Write Problem is not a direct consequence of the CAP Theorem, both stem from the same fundamental limitation: we cannot assume perfect communication between distributed components.</p><p>Whenever a database and a message broker operate as independent systems, there is no atomic operation capable of guaranteeing both of the following simultaneously:</p><ul><li>Persist the data.</li><li>Publish the corresponding event.</li></ul><p>Since these components communicate over a network, we must assume that communication failures, temporary outages, and network partitions can occur at any time. Under these conditions, such guarantees simply do not exist. This limitation is precisely what makes the Dual Write Problem inevitable.</p><p>Viewed through this lens, the CAP Theorem tells us that, in the presence of a network partition, it is impossible to guarantee both strong consistency and availability at the same time. As a result, many distributed architectures embrace eventual consistency to synchronize independent components whenever that trade-off aligns with business requirements.</p><h3>Strategies for Solving the Problem</h3><p>The most widely adopted solution is the <strong>Transactional Outbox Pattern</strong>.</p><p>Instead of persisting the entity and immediately publishing the corresponding event, the application stores both the business entity and an Outbox record within the same database transaction. Event publication is no longer part of the business transaction itself.</p><p>A separate process continuously reads pending Outbox records and publishes them to the message broker.</p><p>This guarantees that if the business transaction commits successfully, the corresponding event will eventually be published as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*PvyM3dPH-mtfrISwsnKOtQ.png" /><figcaption>The business transaction persists both the entity and the Outbox record atomically. Event publication happens asynchronously after the transaction commits.</figcaption></figure><p>Another popular approach is <strong>Change Data Capture (CDC)</strong>.</p><p>Rather than explicitly storing events in an Outbox table, a dedicated component continuously monitors changes in the database and converts them into events. Since events are derived directly from persisted data, the application no longer needs to coordinate two independent write operations.</p><p>Event publication becomes a consequence of persistence, effectively eliminating the Dual Write Problem at the application layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*RGVljkOEvfMNMv44KRxnDg.png" /><figcaption>Events are derived directly from persisted changes, removing the need for the application to perform two independent write operations</figcaption></figure><p>Although Outbox and CDC are implemented differently, they share the same architectural principle.</p><p>The business transaction is no longer responsible for coordinating persistence and event publication. That responsibility is delegated to a reliable mechanism, allowing events to be propagated asynchronously while maintaining eventual consistency.</p><blockquote>In distributed architectures, events should be a consequence of persistence — not a second independent write operation.</blockquote><p>This principle extends far beyond Outbox and CDC. It underpins many architectural patterns designed to eliminate the Dual Write Problem while preserving reliability in distributed systems.</p><h3>Conclusion</h3><p>One of the most interesting aspects of the Dual Write Problem is that it keeps reappearing regardless of the company, programming language, database, or messaging technology involved.</p><p>Tools evolve rapidly. Every year brings new databases, message brokers, frameworks, and cloud services. The fundamental problems of distributed computing, however, remain the same.</p><p>That is why understanding these underlying principles is often far more valuable than mastering a particular technology.</p><p>They allow us to recognize recurring patterns, evaluate architectural trade-offs, and design distributed systems that are resilient, scalable, and capable of evolving as products and organizations grow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3617fcd26cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>