Amazon iconAmazonSep 17, 2026 ~7 min source read

Correctness-safe, low-latency membership lookups with ElastiCache for Valkey and Aurora PostgreSQL

Combine a Bloom filter, an exact-match cache, and Aurora PostgreSQL into a three-tier pattern that returns most membership answers in sub-millisecond time while avoiding false positives by always consulting the authoritative database when needed.

Implement a correctness-safe Bloom filter lookup with Amazon ElastiCache for Valkey and Amazon Aurora PostgreSQL

Share this story

Send the public story page.

Useful takeaways from this story.

Use a Bloom filter as a fast-negative gate: BF.EXISTS=0 proves absence and lets you short-circuit without downstream I/O.

Be deliberate about propagation and invalidation: the only functional correctness risk is the window between an Aurora commit and filter propagation, which requires a consistency model.

High-throughput systems often need to answer a binary membership question on a hot path (for example, "is this card blocked for this merchant?"). A relational lookup can be too slow for strict latency budgets. A standalone Bloom filter is fast and memory-efficient but allows false positives, which some applications cannot tolerate. The design goal is to serve most decisions with sub-millisecond latency while guaranteeing no false-positive business outcomes.

Tier 1 — Bloom filter (ElastiCache for Valkey)

  • Role: fast-negative gate. A BF.EXISTS call checks k hash positions in a compact bit array.
  • Behavior: if any bit is zero, the item is guaranteed absent (no downstream I/O). If all bits are set, the item is possibly present and must go to Tier 2.

Tier 2 — Exact-match cache (ElastiCache for Valkey)

  • Role: deterministic, authoritative answer for keys that were populated there.

Tier 3 — Aurora PostgreSQL (source of truth)

  • Role: canonical authoritative store. A primary-key point query returns the definitive answer, populates the cache, and drives updates to upstream tiers.

Why this composition is correctness-safe

Each tier provides a narrow guarantee. The Bloom filter never yields false negatives relative to the data it has been updated with, but it can yield false positives. Those false positives are harmless because Tier 2 and Tier 3 will resolve them: a BF.EXISTS=1 leads to a cache lookup and, if needed, a database query. The database always has the final word, so no false-positive business outcomes occur.

Operational notes and implementation choices

  • Co-locate tiers: ElastiCache for Valkey supports both Bloom commands (BF.EXISTS, BF.ADD) and key-value operations (GET, SET) on the same cluster. You can host Tier 1 and Tier 2 on one cluster using distinct key prefixes, reducing the deployment surface to one ElastiCache cluster plus one Aurora cluster.
  • Composite keys: when membership is scoped (tenant, merchant, entity), encode a composite key pattern so the Bloom filter and cache index membership consistently and unambiguously.
  • False-positive rate (FPR) tuning: choose the filter FPR when creating the Bloom filter. Lower FPR requires more memory but reduces the fraction of requests that advance past Tier 1.

Performance and cost considerations

  • Bloom filters provide large memory savings versus set-based indexes, reducing memory footprint for high-cardinality membership sets.
  • The Bloom filter reduces I/O by stopping absent-key requests at Tier 1. The remaining requests incur cache and occasional database read costs dictated by the FPR and cache miss rate.
  • Hosting both Valkey data structures on a single ElastiCache cluster simplifies operational cost and latency between Tier 1 and Tier 2.

More context around this story.

Ten Million Keys, One Missing Index
Dev iconDevSep 15, 2026

Ten Million Keys, One Missing Index

Open original cover image This article explores how a per-entity index improves Redis cache invalidation by replacing repeated full-keyspace scans with targeted lookups. All performance figures come from local benchmarks. The accompanying demo includes the implementation, benchmark scripts and recorded results. Run it

Valkey: Bringing Key-Value Databases to Enterprise Java
Dzone iconDzoneSep 22, 2026

Valkey: Bringing Key-Value Databases to Enterprise Java

Enterprise applications commonly face multiple data challenges. Some data requires transactional integrity and relationships, while other data prioritizes fast, predictable access. Sessions, counters, rate limits, temporary state, often-accessed objects, and coordination data may not benefit from the complexity of a re

Loading more related stories...

Keep reading in the app

Open the app view to save this story, compare related coverage, and continue from the same source.

Open in app