<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Felipe Camargos</title>
    <description>The latest articles on DEV Community by Felipe Camargos (@flpcamargos).</description>
    <link>https://dev.to/flpcamargos</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4207043%2F41403475-5870-452c-a47b-0858a74ffe1b.png</url>
      <title>DEV Community: Felipe Camargos</title>
      <link>https://dev.to/flpcamargos</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/flpcamargos"/>
    <language>en</language>
    <item>
      <title>I simulated two cases with 144 Pix lookups each. In one, both integrations stopped confirming payments after a deploy. In the other, only one went quiet. If you were on call, what would you ask an investigation agent to check first?</title>
      <dc:creator>Felipe Camargos</dc:creator>
      <pubDate>Mon, 23 Nov 2026 00:53:36 +0000</pubDate>
      <link>https://dev.to/flpcamargos/i-simulated-two-cases-with-144-pix-lookups-each-in-one-both-integrations-stopped-confirming-3ach</link>
      <guid>https://dev.to/flpcamargos/i-simulated-two-cases-with-144-pix-lookups-each-in-one-both-integrations-stopped-confirming-3ach</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/flpcamargos/when-pix-lookups-succeed-and-payments-stop-rate-limiting-with-bucket4j-and-redis-2p0l" class="crayons-story__hidden-navigation-link"&gt;When Pix lookups succeed and payments stop: rate limiting with Bucket4j and Redis&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/flpcamargos" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4207043%2F41403475-5870-452c-a47b-0858a74ffe1b.png" alt="flpcamargos profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/flpcamargos" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Felipe Camargos
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Felipe Camargos
                
                
              
              &lt;div id="story-author-preview-content-5096534" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/flpcamargos" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4207043%2F41403475-5870-452c-a47b-0858a74ffe1b.png" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Felipe Camargos&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/flpcamargos/when-pix-lookups-succeed-and-payments-stop-rate-limiting-with-bucket4j-and-redis-2p0l" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Nov 23&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/flpcamargos/when-pix-lookups-succeed-and-payments-stop-rate-limiting-with-bucket4j-and-redis-2p0l" id="article-link-5096534"&gt;
          When Pix lookups succeed and payments stop: rate limiting with Bucket4j and Redis
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/architecture"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;architecture&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/java"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;java&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/cloud"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;cloud&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/design"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;design&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/flpcamargos/when-pix-lookups-succeed-and-payments-stop-rate-limiting-with-bucket4j-and-redis-2p0l" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;1&lt;span class="hidden s:inline"&gt;&amp;nbsp;reaction&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/flpcamargos/when-pix-lookups-succeed-and-payments-stop-rate-limiting-with-bucket4j-and-redis-2p0l#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              

              1&lt;span class="hidden s:inline"&gt;&amp;nbsp;comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            12 min read
          &lt;/small&gt;
          
          &lt;div class="only-sidebar-menu-item trusted-visible-block print-hidden align-center"&gt;
                
                    
                
          &lt;/div&gt;

        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;/div&gt;


</description>
      <category>api</category>
      <category>backend</category>
      <category>debugging</category>
    </item>
    <item>
      <title>When Pix lookups succeed and payments stop: rate limiting with Bucket4j and Redis</title>
      <dc:creator>Felipe Camargos</dc:creator>
      <pubDate>Mon, 23 Nov 2026 00:52:00 +0000</pubDate>
      <link>https://dev.to/flpcamargos/when-pix-lookups-succeed-and-payments-stop-rate-limiting-with-bucket4j-and-redis-2p0l</link>
      <guid>https://dev.to/flpcamargos/when-pix-lookups-succeed-and-payments-stop-rate-limiting-with-bucket4j-and-redis-2p0l</guid>
      <description>&lt;p&gt;&lt;strong&gt;Originally published on Aws Builders&lt;/strong&gt; — &lt;a href="https://builder.aws.com/content/3MTxemt2XjYyb9s6vd2RiaqBcYQ/when-pix-lookups-succeed-and-payments-stop-rate-limiting-with-bucket4j-and-redis" rel="noopener noreferrer"&gt;Read the original article&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A customer looks up a Pix key, checks the recipient’s name, and closes the app. Days later, one integration is still sending lookups at its usual rate, with healthy latency and almost no payments. When would you open an investigation?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmnf26gro88tehw2jvms3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmnf26gro88tehw2jvms3.jpg" alt="A hand rests beside a smartphone showing a Pix recipient icon and an untapped payment button." width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pix is Brazil’s instant payment system. I worked on its architecture at my institution and helped build the rate limiter for key lookups. The tricky part was deciding when a lookup should spend a token and when a later payment should return one.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What a Pix lookup costs&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A Pix key lets a payer look up a recipient without typing their bank account details. The institution queries a directory operated by Brazil’s central bank, known as DICT, so the payer can check who will receive the money. Repeated reads also create an opportunity to collect personal data. &lt;a href="https://www.bcb.gov.br/content/estabilidadefinanceira/pix/Regulamento_Pix/X_ManualOperacionaldoDICT.pdf#page=76" rel="noopener noreferrer"&gt;[1]&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A token bucket with feedback from the payment&lt;/strong&gt;&lt;br&gt;
A token bucket holds a limited number of permits. An incoming request needs a permit to proceed. Tokens refill over time, which gives a customer room for a short burst of activity.&lt;br&gt;
The DICT rules also account for what happens after admission. For an individual payer’s bucket, version 8.5 of the operating manual specifies these amounts. &lt;a href="https://www.bcb.gov.br/content/estabilidadefinanceira/pix/Regulamento_Pix/X_ManualOperacionaldoDICT.pdf#page=76" rel="noopener noreferrer"&gt;[1]&lt;/a&gt;&lt;br&gt;
Key found: spend one token.&lt;br&gt;
Key missing: spend 20 tokens in total.&lt;br&gt;
Matching payment order received by SPI, the instant payment settlement system: return one token.&lt;br&gt;
Business users and participating institutions have their own parameters. An institution’s internal controls must be at least as restrictive as the DICT rules. Our local proof of concept uses a smaller, fictional penalty so the balance is easy to trace.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Why we moved the balance out of the JVM&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We started with Bucket4j in memory. With a single process, I could watch the balance fall after each request. With two replicas, each could spend what it believed was the same customer’s last token. Restarting a process could also hand the customer a full bucket. &lt;a href="https://github.com/bucket4j/bucket4j" rel="noopener noreferrer"&gt;[2]&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What mattered in the storage decision&lt;/strong&gt;&lt;br&gt;
We considered Redis, Apache Ignite, and Hazelcast. In the practical comparison with Ignite, our engineering and infrastructure teams chose Redis for this workload. Anderson Martins Silva and I described that evaluation in an earlier account.&lt;br&gt;
Contention: how long does a command take when several requests compete for the same balance?&lt;br&gt;
Java integration: how much work does it take to connect the existing Bucket4j application to shared state?&lt;br&gt;
Recovery: after a node fails, can the team establish how many tokens the customer still has?&lt;br&gt;
In production we watched command latency, connections, memory, and replication in Grafana. During a failover exercise, I would check the customer’s balance as soon as the application reconnected. A successful connection alone tells you little about which requests will be admitted next.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Two replicas race for the last token&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To reproduce the decision locally, I used spec-driven development (SDD). I wrote the acceptance criterion before generating the Java implementation and its tests. Criterion ADM-03 ties a customer-visible response to a downstream effect that we can count. &lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/specs/tasks.md" rel="noopener noreferrer"&gt;[7]&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The test that makes the race observable&lt;/strong&gt;&lt;br&gt;
Give one synthetic identity a single token in Redis. Freeze the test clock so no refill can occur.&lt;br&gt;
Send two concurrent POST /lookups requests, one to each replica. Use the same identity with different recipient IDs and different Idempotency-Key values.&lt;br&gt;
Check both responses, the directory receipts, and the final balance. One request returned HTTP 200 and read its recipient once. The other returned HTTP 429 (Too Many Requests) before reaching the directory. The balance was zero. &lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/src/test-component/java/com/camargos/ratelimit/LastTokenTest.java" rel="noopener noreferrer"&gt;[8]&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/src/test-component/java/com/camargos/ratelimit/LastTokenTest.java#L37-L43" rel="noopener noreferrer"&gt;LastTokenTest&lt;/a&gt; lets either replica win. The replica that returned 200 must have read exactly its own recipient. The one that returned 429 must have an empty read list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;assertThat(codes).containsExactlyInAnyOrder(200, 429);
assertThat(reads(first))
    .containsExactlyElementsOf(codes.getFirst() == 200 ? List.of("found-a") : List.of());
assertThat(reads(second))
    .containsExactlyElementsOf(codes.getLast() == 200 ? List.of("found-b") : List.of());
long remaining = balance();
assertThat(remaining).isZero();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We repeated the race with two Spring Boot containers sharing one Redis instance in Docker Compose. The directory receipt count moved from 20 to 21. Even without the test harness, we could see that exactly one additional read had occurred. &lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/docs/evidence.md" rel="noopener noreferrer"&gt;[10]&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiag6dj5miz74ngfks1x0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiag6dj5miz74ngfks1x0.jpg" alt="Figure 1. Two replicas compete for one shared token. Only the admitted lookup reaches the directory.&lt;br&gt;
" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 1. Two replicas compete for one shared token. Only the admitted lookup reaches the directory.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;What happens when a result arrives twice?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The service can reserve a token before a lookup, but it can charge for a missing key only after the directory replies. That gap matters if an event is redelivered or its consumer stops midway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Follow one missing key from ten tokens to six&lt;/strong&gt;&lt;br&gt;
Start with 10 tokens. Reserve one before the read, leaving 9.&lt;br&gt;
The directory reports a missing key. The fictional policy charges four in total, so debit three more. The balance is 6.&lt;br&gt;
Redeliver the same result concurrently. The balance stays at 6, and the history contains one additional debit. &lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/src/test-component/java/com/camargos/ratelimit/RecoveryTest.java" rel="noopener noreferrer"&gt;[9]&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnqvb2eekihmm1fdk71xk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnqvb2eekihmm1fdk71xk.png" alt="Figure 2. Admission pays for the read. A conclusive miss triggers the extra charge.&lt;br&gt;
" width="799" height="313"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 2. Admission pays for the read. A conclusive miss triggers the extra charge.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A successful lookup left 9 tokens. A timeout also left 9, with an inconclusive result. A timeout tells us that a read was attempted. It tells us nothing about whether the key exists.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What survives a consumer restart&lt;/strong&gt;&lt;br&gt;
One Redis transaction commits the bucket state, the operation receipt, and the event. The consumer records completion afterward. When two confirmations arrived for the same eligible order, the balance moved from 8 to 9 just once. [9]&lt;br&gt;
By this point in &lt;a href="https://dev.toRedisLedger"&gt;RedisLedger&lt;/a&gt;, Bucket4j has computed the new balance on a private copy. The transaction publishes that balance alongside its receipt and events. If another replica changes the watched account before EXEC, the operation retries.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try (Transaction tx = db.multi()) {
  if (snapshot != null) tx.hset(bytes(account), bytes("bucket"), snapshot);
  if (!change.fields.isEmpty()) tx.hset(account, change.fields);
  for (String event : change.events) tx.rpush("journey:events", event);
  tx.del(candidate);
  if (tx.exec() != null) return answer;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We injected a failure after a debit committed and before the consumer marked it complete. Further lookups for that identity returned HTTP 503 while another identity continued to work. After a restart with Redis preserved, the consumer recognized the receipt and released the identity with 8 tokens: the original 6 plus two scheduled refills. Losing Redis itself would require a separate recovery test.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Same lookup volume, different reasons to investigate&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;How many lookups find a key? How many lead to a payment order? We built two synthetic cases with the same 144 admitted lookups: two integrations, three ten-minute windows, and 24 lookups per integration per window. Both integrations confirmed 16 orders in the first window. &lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/docs/evidence.md" rel="noopener noreferrer"&gt;[10]&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where did confirmations disappear?&lt;/strong&gt;&lt;br&gt;
After a simulated deployment, both integrations dropped to zero orders. Each logged 16 confirmation errors in each later window. I would compare confirmation traces across versions and check the shared dependency.&lt;br&gt;
In the second case, Alpha had zero orders for two windows. Beta still confirmed 16 per window, and neither integration recorded confirmation errors. I would inspect Alpha’s client telemetry to see whether it ever attempted confirmation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7sek9kkfy7klk6lni17v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7sek9kkfy7klk6lni17v.png" alt="Figure 3. Each cell shows confirmed orders for 24 admitted lookups. Scope and persistence point to different next checks." width="799" height="313"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 3. Each cell shows confirmed orders for 24 admitted lookups. Scope and persistence point to different next checks.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;What to ask an investigation agent when orders disappear&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Looking at those two charts, I would give an agent a narrow assignment: which trace should the on-call engineer open first, and why? Lookup volume held steady in both cases. The clue is which integration stopped confirming orders, on which version, and when.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How the agent gets its evidence&lt;/strong&gt;&lt;br&gt;
The investigator runs outside the request path. For the demo, the server creates a synthetic case, scopes it to specific integrations, versions and time windows, and makes three reads by default: lookup and order metrics, confirmation errors, and deployment history. The investigator receives those aggregates. The application retains authority over balances.&lt;br&gt;
The local baseline uses deterministic rules. The optional Amazon Bedrock Converse adapter gets the same alert and facts. The model is asked to select one of two predefined hypotheses and return the source references and values that support it.&lt;a href="https://docs.aws.amazon.com/cli/latest/reference/bedrock-runtime/converse.html" rel="noopener noreferrer"&gt;[5]&lt;/a&gt;&lt;br&gt;
Here is what &lt;a href="https://dev.toBedrockAdapter"&gt;BedrockAdapter&lt;/a&gt; actually asks the model. Along with choosing one of two hypotheses, it must cite records that an engineer can compare across windows and integrations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;String prompt =
    "Assess this synthetic alert: "
        + alert
        + ". Sources: "
        + json.writeValueAsString(facts)
        + ". Return one JSON object with hypothesis (CONFIRMATION_REGRESSION or"
        + " INTEGRATION_GAP) and evidence (map of exact source references to integer values)."
        + " Cite comparative windows and integrations.";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An evaluator looks up every cited value and checks whether the matching references, taken together, support the chosen hypothesis. The program then adds the alternative explanation, missing information and next check defined for that hypothesis. An engineer reviews the resulting report. &lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/tree/0c67bbd3b85447c2c67a135e372bcdb9588e895f/src/main/java/com/camargos/ratelimit/investigation" rel="noopener noreferrer"&gt;[12]&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F315de2l2ugueidpekqo8.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F315de2l2ugueidpekqo8.gif" alt="Figure 4. The reader gathers three sources, the investigator proposes a hypothesis, and the evaluator checks its support before human review. The Bedrock path was exercised with scripted responses.&lt;br&gt;
" width="799" height="529"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Figure 4. The reader gathers three sources, the investigator proposes a hypothesis, and the evaluator checks its support before human review. The Bedrock path was exercised with scripted responses.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Two findings that send the on-call engineer to different places&lt;/strong&gt;&lt;br&gt;
After deployment, Alpha and Beta each recorded 16 errors and zero orders per window on v2. For example, health/alpha/v2/600/confirmationErrors is 16. A confirmation regression fits, but a downstream outage could have coincided with the rollout. The next check is dependency health and confirmation traces before and after a rollback.&lt;br&gt;
In the concentrated case, metrics/alpha/v1/1200/orders is 0 while metrics/beta/v1/1200/orders is 16. Alpha recorded no confirmation errors. Did its client ever attempt confirmation? Client telemetry can distinguish an interruption from an intentional lookup-only workflow. The data leaves intent unresolved. &lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/docs/evidence.md" rel="noopener noreferrer"&gt;[10]&lt;/a&gt;&lt;br&gt;
An AI agent can also be the client making the lookups. A sequence of authorized reads can still expose personal data. The purpose of the lookup and the fields the server returns matter well beyond payments. &lt;a href="https://api-security.owasp.org/editions/2023/en/0xa6-unrestricted-access-to-sensitive-business-flows/" rel="noopener noreferrer"&gt;[3]&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;The same question at a retail support desk&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A support agent needs a delivery date. If opening the order also reveals the customer’s phone number, full address, and purchase history, a routine question exposes far more than the task requires.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What did the support ticket authorize?&lt;/strong&gt;&lt;br&gt;
Risk: genuine details about a purchase can make a social engineering message more convincing. Brazil’s federal government has documented scams that use real personal details. &lt;a href="https://www.gov.br/cisc/pt-br/alertas-de-golpes-digitais/golpistas-enviam-mensagens-no-whatsapp-se-passando-por-entidades-do-governo" rel="noopener noreferrer"&gt;[6]&lt;/a&gt;&lt;br&gt;
Control: verify on the server that the ticket, order, and agent belong together. Return the delivery date for a delivery-date question. Audit the category of data accessed without copying the phone number into the log.&lt;br&gt;
Imagine two comparable shifts, each with 100 reads. One has 5 reads without a linked ticket, the other has 40. Before drawing a conclusion about either team, I would check assignment patterns and whether the integration recorded the link.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh30zj3tsoqegkecwhofi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh30zj3tsoqegkecwhofi.png" alt="Figure 5. At the same total volume, unlinked reads rose from 5 to 40 in this fictional support example.&lt;br&gt;
" width="799" height="313"&gt;&lt;/a&gt;&lt;em&gt;Figure 5. At the same total volume, unlinked reads rose from 5 to 40 in this fictional support example.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;What we measured locally&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The Java application makes the admission decision inline. Investigation runs separately on events with opaque IDs. The report deduplicates events and attributes each payment to the original lookup window.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Choose the denominator before raising an alert&lt;/strong&gt;&lt;br&gt;
Eight found keys and two missing keys give ten conclusive results. One additional timeout counts as a technical error. The missing-key fraction is 2/10, or 20%.&lt;br&gt;
Eleven admitted lookups and four orders give 2.75 lookups per order. With zero orders, the report shows both counts and leaves the ratio undefined.&lt;br&gt;
The default window is ten minutes, with two more minutes for the payment to arrive. A window needs at least 12 admissions to qualify for interpretation.&lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/docs/evidence.md" rel="noopener noreferrer"&gt;[10]&lt;/a&gt;&lt;br&gt;
For deterministic triage, all 16 cited values matched their sources in the deployment case, as did all 14 in the Alpha case. The scripted adapter returned 12 of 12 and 7 of 7 matching references, respectively. The evaluator recorded zero unsupported claims across the four outputs. &lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/docs/evidence.md" rel="noopener noreferrer"&gt;[10]&lt;/a&gt;&lt;br&gt;
What happens if the investigator cites the right record but gives the wrong number? &lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/src/main/java/com/camargos/ratelimit/investigation/Triage.java#L87-L92" rel="noopener noreferrer"&gt;Triage&lt;/a&gt; checks each reference and value against the case. Only matching pairs count toward support for the hypothesis.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var correct = new HashMap&amp;lt;String, Integer&amp;gt;();
evidence.forEach(
    (key, n) -&amp;gt; {
      if (n != null &amp;amp;&amp;amp; n.equals(facts.get(key))) correct.put(key, n);
    });
boolean supported = supports(hypothesis, correct);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These counts measure citation fidelity on two synthetic cases. A live model’s usefulness on unfamiliar incidents, its latency and its cost remain open questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What I would measure on AWS&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Amazon API Gateway: run a burst through gateway throttling and record which rejections came from the gateway and which came from the application’s per-identity rule.&lt;a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html" rel="noopener noreferrer"&gt; [4]&lt;/a&gt;&lt;br&gt;
Amazon ElastiCache: repeat the last-token and receipt checks during a node failover. Compare the resulting balance, receipts, and directory read count.&lt;br&gt;
End-to-end latency: measure lookup latency under realistic concurrency. For live Bedrock triage, separately measure response time, cost per investigation, and the fraction of claims supported by the cited evidence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reproduce the local result&lt;/strong&gt;&lt;br&gt;
With Java 25 and Docker running, start in the repository root. The first command runs the three test suites and the two synthetic investigations with a simulated Bedrock transport. The second starts the demo replicas on ports 8081 and 8082. &lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/README.md" rel="noopener noreferrer"&gt;[11]&lt;/a&gt;&lt;br&gt;
&lt;code&gt;sh gradlew clean build report investigate -Pmode=simulated&lt;/code&gt;&lt;br&gt;
&lt;code&gt;docker compose -f config/compose.yaml up -d --build&lt;/code&gt;&lt;br&gt;
The recorded build passed 8 unit, 3 integration, and 4 component tests. The README walks through a lookup on one replica and POST /payment-orders on the other, including retries with the original idempotency key. &lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/docs/evidence.md" rel="noopener noreferrer"&gt;[10]&lt;/a&gt; &lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/README.md" rel="noopener noreferrer"&gt;[11]&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The question I take into architecture reviews&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If lookups were still returning in a few milliseconds tomorrow, but payments stopped happening, which indicator would get your team’s attention?&lt;br&gt;
Working on Pix taught me to look for that answer in the events that follow an HTTP 200.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;References&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.bcb.gov.br/content/estabilidadefinanceira/pix/Regulamento_Pix/X_ManualOperacionaldoDICT.pdf#page=76" rel="noopener noreferrer"&gt;[1] Banco Central do Brasil. DICT Operating Manual, v8.5, section 13 (Portuguese).&lt;br&gt;
&lt;/a&gt;&lt;a href="https://github.com/bucket4j/bucket4j" rel="noopener noreferrer"&gt;[2] Bucket4j. Java rate limiting and distributed backends.&lt;/a&gt;&lt;br&gt;
&lt;a href="https://api-security.owasp.org/editions/2023/en/0xa6-unrestricted-access-to-sensitive-business-flows/" rel="noopener noreferrer"&gt;[3] OWASP. Unrestricted Access to Sensitive Business Flows.&lt;br&gt;
&lt;/a&gt;&lt;a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html" rel="noopener noreferrer"&gt;[4] AWS. Throttle requests to your REST APIs in API Gateway.&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/cli/latest/reference/bedrock-runtime/converse.html" rel="noopener noreferrer"&gt;[5] AWS. Amazon Bedrock Runtime Converse command reference.&lt;br&gt;
&lt;/a&gt;&lt;a href="https://www.gov.br/cisc/pt-br/alertas-de-golpes-digitais/golpistas-enviam-mensagens-no-whatsapp-se-passando-por-entidades-do-governo" rel="noopener noreferrer"&gt;[6] Brazilian federal government. Advisory on impersonation using personal data (Portuguese).&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/specs/tasks.md" rel="noopener noreferrer"&gt;[7] Proof of concept. Acceptance criteria and implementation tasks.&lt;br&gt;
&lt;/a&gt;&lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/src/test-component/java/com/camargos/ratelimit/LastTokenTest.java" rel="noopener noreferrer"&gt;[8] Proof of concept. LastTokenTest, the concurrent admission test.&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/src/test-component/java/com/camargos/ratelimit/RecoveryTest.java" rel="noopener noreferrer"&gt;[9] Proof of concept. RecoveryTest, duplicate delivery and restart reconciliation.&lt;br&gt;
&lt;/a&gt;&lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/docs/evidence.md" rel="noopener noreferrer"&gt;[10] Proof of concept. Recorded test and Docker Compose results (Portuguese).&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/blob/0c67bbd3b85447c2c67a135e372bcdb9588e895f/README.md" rel="noopener noreferrer"&gt;[11] Proof of concept. Run the experiments with Gradle and Docker Compose.&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/fCamargosRibeiro/context-aware-rate-limiting/tree/0c67bbd3b85447c2c67a135e372bcdb9588e895f/src/main/java/com/camargos/ratelimit/investigation" rel="noopener noreferrer"&gt;[12] Proof of concept. Java case reader, investigator, Converse adapter and hypothesis evaluator.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>java</category>
      <category>cloud</category>
      <category>design</category>
    </item>
    <item>
      <title>Beyond File Storage: Using Amazon S3 as a Historical Data Layer</title>
      <dc:creator>Felipe Camargos</dc:creator>
      <pubDate>Sun, 25 Oct 2026 18:48:23 +0000</pubDate>
      <link>https://dev.to/flpcamargos/beyond-file-storage-using-amazon-s3-as-a-historical-data-layer-1b06</link>
      <guid>https://dev.to/flpcamargos/beyond-file-storage-using-amazon-s3-as-a-historical-data-layer-1b06</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Author's Note: This article was originally written and published by me in English on the AWS Builder Center under the title Beyond File Storage: Using Amazon S3 as a Historical Data Layer. This version is an adaptation of the original content for Brazilian Portuguese. The original publication is available at: &lt;a href="https://builder.aws.com/content/3KxlKQJZTZievjgwR7VVJjQeOV4/beyond-file-storage-using-amazon-s3-as-a-historical-data-layer" rel="noopener noreferrer"&gt;Beyond File Storage: Using Amazon S3 as a Historical Data Layer&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When we talk about Amazon S3, the first use case that typically comes to mind is file storage. While this is indeed one of its most well-known applications, limiting S3 to that role means overlooking a significant portion of its potential.&lt;/p&gt;

&lt;p&gt;In addition to providing secure and scalable file storage, S3 can become a strategic component of modern data architectures, helping organizations reduce costs, retain historical information for extended periods, and make large volumes of data available for analytical queries without impacting transactional systems.&lt;/p&gt;

&lt;p&gt;I work with the Pix product at a credit union, and we frequently face challenges related to the continuous growth in transaction volumes. In this article, I will present a scenario that is quite common among large financial institutions and demonstrate how S3 can be used to address one of the key challenges associated with storing and querying historical data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Challenge of Pix Growth&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pix has established itself as Brazil's primary instant payment method. With millions of people performing transactions every day, financial institutions now manage an enormous volume of information that must be stored, audited, and made available when necessary.&lt;/p&gt;

&lt;p&gt;In a large financial institution, processing around 10 million transactions per day is not uncommon. When we analyze this volume over several years, the numbers become significant very quickly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhohn5ki8dpgyw7506gtx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhohn5ki8dpgyw7506gtx.png" alt="Estimated historical data growth for large-scale Pix operations, highlighting the storage and scalability challenges faced by financial institutions." width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These figures help illustrate a challenge that grows at the same pace as Pix adoption itself: how to store years of historical data without compromising the performance of systems responsible for day-to-day operations.&lt;/p&gt;

&lt;p&gt;Although keeping this entire volume in relational databases is technically feasible, the approach begins to present significant challenges as the dataset grows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem with Keeping Everything in the Transactional Database&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Payment systems must be fast and highly available. For this reason, they typically rely on transactional databases, commonly known as OLTP (Online Transaction Processing) systems.&lt;/p&gt;

&lt;p&gt;These databases are optimized for recording real-time operations such as transfers, payments, and balance inquiries. However, when the goal shifts to analyzing billions of historical records, the situation changes dramatically.&lt;/p&gt;

&lt;p&gt;Assuming a five-year retention period, an institution could accumulate approximately 18 billion records. In this context, seemingly simple queries can become extremely expensive.&lt;/p&gt;

&lt;p&gt;Consider a request to identify all transactions performed during a specific period or generate a detailed statement covering previous years. Even with proper partitioning strategies and indexing, the database would still need to process an enormous amount of information.&lt;/p&gt;

&lt;p&gt;Some of the most common impacts include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reading large volumes of historical data.&lt;/li&gt;
&lt;li&gt;Competition for processing and storage resources with daily transaction workloads.&lt;/li&gt;
&lt;li&gt;Increased latency in critical applications.&lt;/li&gt;
&lt;li&gt;Longer execution times for analytical queries.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Depending on the available infrastructure, queries like these may take several minutes to complete because OLTP databases were designed for transactional workloads rather than large-scale analytical processing.&lt;br&gt;
This is precisely where a Data Lake-based archival strategy begins to make sense.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Entering the Data Lake World&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An increasingly common approach is to keep only "hot" data in the transactional database, meaning data that is frequently accessed by applications.&lt;/p&gt;

&lt;p&gt;In the case of Pix, this could represent the most recent 60 or 90 days of transactions.&lt;/p&gt;

&lt;p&gt;Older records, often referred to as cold data, can be moved to Amazon S3, creating a dedicated historical storage layer.&lt;/p&gt;

&lt;p&gt;In modern architectures known as Lakehouses, S3 typically serves as the central storage layer. The Lakehouse concept combines characteristics of both Data Lakes and Data Warehouses, enabling the storage of massive datasets with flexibility while simultaneously providing advanced analytical capabilities.&lt;/p&gt;

&lt;p&gt;Under this model, historical data no longer competes for resources with transactional systems and can instead be consumed by specialized analytics platforms.&lt;/p&gt;

&lt;p&gt;The architecture would look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F48dtf5lcwbgmoendlfdz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F48dtf5lcwbgmoendlfdz.png" alt="Traditional architecture where historical and transactional workloads share the same relational database, causing resource contention and performance bottlenecks." width="761" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjmcr8jixk1x39oyoqrfi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjmcr8jixk1x39oyoqrfi.png" alt="Data Lakehouse architecture that separates transactional and analytical workloads by storing historical data in Amazon S3 and processing it with Databricks." width="800" height="303"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;S3, Parquet, and Databricks Working Together&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;After moving historical data into S3, a highly effective approach is to store it in formats such as Parquet or Delta Lake.&lt;/p&gt;

&lt;p&gt;Parquet is a columnar storage format designed specifically for analytical workloads. Unlike traditional relational databases, which often read entire rows, a columnar format allows queries to retrieve only the columns required for a specific operation.&lt;/p&gt;

&lt;p&gt;To further optimize query performance, historical datasets can be partitioned by year, month, or transaction date. This approach reduces the amount of data that analytical engines need to scan, improving query efficiency and reducing processing costs.&lt;/p&gt;

&lt;p&gt;On top of this storage layer, platforms such as Databricks can execute distributed queries using Apache Spark, a processing engine designed for large-scale data workloads.&lt;/p&gt;

&lt;p&gt;In practice, this means historical queries no longer need to run in the same environment responsible for processing daily Pix transactions.&lt;br&gt;
Instead, the workload is moved to a dedicated analytical infrastructure.&lt;br&gt;
This architectural shift brings several important benefits.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Workload Isolation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Analytical queries no longer compete with transactional workloads.&lt;/p&gt;

&lt;p&gt;While the database continues processing millions of payments in real time, the analytics cluster independently processes historical data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;More Efficient Data Access&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Because the data is stored in a columnar format, only the required columns are read.&lt;/p&gt;

&lt;p&gt;If a query needs only the transaction date and transaction amount, there is no need to load dozens of additional fields.&lt;/p&gt;

&lt;p&gt;This significantly reduces data scanning volumes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Automatic Optimizations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Platforms such as Databricks provide caching and optimization mechanisms that accelerate recurring queries.&lt;/p&gt;

&lt;p&gt;In addition, features such as Z-Ordering and Liquid Clustering help organize data physically, making filtering and search operations more efficient.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cost Reduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Another major advantage relates to storage economics.&lt;br&gt;
Maintaining large historical datasets in high-performance relational databases typically requires costly infrastructure, whereas S3 offers a much more economical model for long-term retention.&lt;/p&gt;

&lt;p&gt;As a result, organizations can balance performance and cost without sacrificing data availability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Comparing the Two Approaches&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When the two models are compared side by side, the benefits become even more apparent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv7mdfe9jofvip3w1qd2n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv7mdfe9jofvip3w1qd2n.png" alt="Comparison of architectural trade-offs between keeping historical data in transactional databases and using Amazon S3 as a dedicated historical data layer." width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This comparison shows that we are not simply talking about a new place to store files. We are discussing an architectural shift capable of separating responsibilities and allowing each technology to do what it was designed for.&lt;/p&gt;

&lt;p&gt;If your organization is facing this challenge, consider the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Audit how much of your historical data truly needs to remain in the transactional database.&lt;/li&gt;
&lt;li&gt;Evaluate your current storage costs versus potential savings with S3.&lt;/li&gt;
&lt;li&gt;Run a pilot using a subset of data, such as the last two years, stored in Parquet and queried through Databricks.&lt;/li&gt;
&lt;li&gt;Measure query performance and operational costs before and after migration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Although this article uses Databricks as an example for analytical processing, the same architectural pattern can be implemented using AWS-native services such as Amazon Athena, AWS Glue, Amazon EMR, and Amazon Redshift Spectrum, depending on the organization's requirements and analytical workloads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The continued growth of Pix is creating new challenges for financial institutions. As billions of transactions are generated every year, storing and retrieving historical data requires more sophisticated strategies than simply increasing the capacity of relational databases.&lt;/p&gt;

&lt;p&gt;In this context, Amazon S3 evolves from being much more than a file storage service. It becomes a strategic component of modern data architectures, capable of supporting long-term retention, reducing infrastructure costs, and enabling scalable access to historical information. By combining S3 with analytical technologies such as Parquet, Delta Lake, and distributed query engines, organizations can separate transactional and analytical workloads, allowing each platform to focus on what it was designed to do best.&lt;/p&gt;

&lt;p&gt;This approach not only improves performance and operational efficiency but also provides greater flexibility for future growth. As data volumes continue to expand, keeping years of information exclusively in transactional databases becomes increasingly expensive and difficult to scale. A Data Lake or Lakehouse strategy can help organizations balance performance, governance, and cost while maintaining access to valuable historical data.&lt;/p&gt;

&lt;p&gt;Ultimately, the value of Amazon S3 goes far beyond storing files. When used as a historical data layer, it becomes an architectural enabler for building scalable, resilient, and cost-effective solutions that can support the next generation of data-intensive applications.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Disclaimer:&lt;/strong&gt; The figures presented in this article are hypothetical estimates intended solely to illustrate the architectural concepts discussed. They are based on assumptions and author-provided inputs and were not derived from production systems, real-world workloads, or measured benchmarks. &lt;br&gt;
While the assumptions were informed by publicly available statistics published by Banco Central do Brasil (Bacen) regarding Pix, the values should not be interpreted as official figures, guaranteed projections, performance benchmarks, or results from an actual implementation. Context source: &lt;a href="https://www.bcb.gov.br/estabilidadefinanceira/pix-em-numeros-estatisticas" rel="noopener noreferrer"&gt;Banco Central do Brasil (Bacen) – Pix in Numbers&lt;/a&gt;. Accessed on October 21, 2026.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;About the Author&lt;/strong&gt;&lt;br&gt;
Felipe Camargos is a Software Engineer Specialist and Tech Lead at Sicredi, focused on Pix, cloud architecture, and large-scale distributed systems.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>aws</category>
      <category>databricks</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
