Designing a Scalable Product Reviews and Ratings System

Designing a Scalable Product Reviews and Ratings System
System Design · Trust, Aggregation & Fake Review Detection

Designing a Scalable Product Reviews & Ratings System

How marketplaces at the scale of hundreds of millions of products and billions of reviews collect star ratings and written feedback, aggregate them in real time, and — critically — detect and stop fake reviews before they mislead a single shopper.

01

Introduction & History — Why Reviews and Ratings Became Core Infrastructure

The single most influential piece of UI in modern commerce is a star rating — and the system behind it is far larger than it looks.

Every time you buy something online, you are almost certainly doing one thing before you click “buy”: scrolling down to the reviews. A five-star average with a few hundred ratings feels safer than a product with no reviews at all, even if the product itself is identical. This single number — the average star rating — has become one of the most powerful pieces of user interface in modern commerce. It influences billions of dollars of purchasing decisions every single day.

Reviews are not a new idea. Long before the internet, people asked shopkeepers, neighbours, and friends “is this any good?” before spending money. What changed with the internet was scale. A small-town shopkeeper could vouch for a product to a few hundred regular customers. A modern marketplace needs a system that can collect, verify, aggregate, and display trustworthy opinions from millions of strangers, for hundreds of millions of products, updated within seconds, in dozens of languages, while simultaneously fighting off organized fraud rings trying to buy fake five-star ratings.

The earliest online review systems, from the late 1990s, were simple: a form, a database table, and a page that computed an average on every page load. That approach worked when a website had a few thousand products and a few tens of thousands of reviews. It falls apart completely once a marketplace has hundreds of millions of products, tens of millions of daily review submissions and views, and organized adversaries actively trying to manipulate the numbers for profit. The system we will design in this article is built for that second world — the world of Amazon, Flipkart, Yelp, TripAdvisor, Google Maps, and App Store scale review platforms.

Real-Life Analogy

Think of a reviews system like a courtroom that has to process millions of testimonies a day. It is not enough to just record what a witness says (the review text and star rating). The system also has to check who the witness is, whether they were actually present at the event (did they really buy the product), whether their story matches other evidence, and whether groups of witnesses are colluding to tell the same false story. A reviews platform is simultaneously a public library of opinions and a fraud investigation unit, running at the same time, on every single submission.

In this tutorial we will design such a system end to end: how a review is submitted, how it is validated and stored, how ratings are aggregated into the number you see on a product page, how that aggregate stays fast even when a product has ten million reviews, and — the hardest part — how the platform tells the difference between a genuine customer sharing an honest opinion and a paid reviewer, a bot, or a seller reviewing their own product under a fake name.

1.1 How the Problem Has Evolved Over Two Decades

It is worth understanding how thinking about this problem has changed, because the changes explain many of today’s design choices. In the early web, reviews were treated purely as a content feature — the goal was simply to give shoppers a place to leave opinions and to display them attractively. Fraud existed but was mostly opportunistic and small scale: an individual seller asking a friend to post a glowing review.

As marketplaces grew and reviews became measurably tied to sales conversion, the economics of manipulation changed completely. Once a data-driven seller could observe that moving from a 3.8 to a 4.3 average rating meaningfully increased sales, an entire industry of paid review brokers emerged, offering bulk five-star reviews for a fee. This forced platforms to treat reviews infrastructure the same way they treat payments infrastructure — as a system that must assume adversarial actors are present at all times, not as an edge case to patch later. That shift in mindset, from “content feature” to “adversarial trust system,” is the single biggest change in how these systems are architected today, and it is why fraud detection is presented in this article as a first-class component sitting right next to submission and aggregation, rather than as an appendix.

A second important shift has been the move from purely explicit signals, meaning the star rating itself, to a much richer set of implicit signals used behind the scenes: how long a reviewer spent reading a product’s page before purchasing, whether they returned the item, how their device and account relate to thousands of other accounts. None of this richer signal set is shown to the shopper directly — the shopper still just sees a star rating and some text — but it is what makes that simple-looking number trustworthy at scale.

1.2 A Short Timeline of Reviews Infrastructure

Late 1990s

First online reviews. A form, a database table, and a live AVG(rating) query recomputed on every page load. Works fine at a few thousand products.

2000–2010

Marketplaces grow into the millions of products. Precomputed rollups and denormalized rating summaries replace live averages. Fraud is still opportunistic and mostly manual.

2010–2018

“Reviews influence sales” becomes measurable and monetizable. Paid review brokerages emerge. Platforms build first-generation ML classifiers on review text and start capturing device and behavioural fingerprints.

2018–present

Reviews infrastructure is treated as adversarial trust infrastructure. Layered fraud detection combining text, behaviour, graph, and purchase signals is the norm. Regulators begin fining marketplaces that fail to police fake reviews.

i
What an Interviewer May Ask

“Why has reviews infrastructure gotten so much harder over the last decade?” The strongest answer names two things — the direct economic tie between rating and sales conversion that made manipulation profitable at industrial scale, and the shift from treating reviews as a content feature to treating them as an adversarial trust system with the same rigor as payments infrastructure.

02

Problem & Motivation — What Makes This Genuinely Hard

“Let users write a review and show an average rating” sounds like a weekend project. The real constraints turn it into a first-order distributed systems problem.

On the surface, “let users write a review and show an average rating” sounds like a weekend project. A single table with columns for product_id, user_id, rating, and text, plus a query that runs AVG(rating), would technically work for a small site. The real difficulty appears only once you add the constraints that a major marketplace actually operates under.

2.1 The Scale Problem

A large marketplace can have hundreds of millions of products and tens of billions of reviews accumulated over years. Millions of people are reading product pages every minute, and each of those page loads needs an accurate, fast rating summary. If every page view triggered a live AVG() query across a table with ten million rows for a single popular product, the database would fall over almost immediately. Reads vastly outnumber writes — for every person who writes a review, thousands of people simply read the star rating and move on. The system has to be designed around that asymmetry.

2.2 The Freshness Problem

A new review, especially a very negative one about a safety issue, needs to be reflected in the aggregate rating quickly, or the platform loses credibility. But recomputing an exact average for a product with millions of reviews on every single new submission is wasteful. The system needs a way to keep aggregates fresh without recalculating from scratch every time.

2.3 The Trust Problem — Fake Reviews

This is the problem that separates a toy reviews feature from a production-grade reviews platform. As soon as reviews start influencing sales, they become a target for manipulation. Sellers pay for five-star reviews. Competitors post fake one-star reviews to sabotage a rival’s listing. Bot farms create thousands of throwaway accounts to inflate ratings. Genuine buyers get incentivized with free products in exchange for suspiciously positive five-star reviews, which most platforms now restrict or ban outright because it quietly breaks the “reviews reflect real opinions” contract with shoppers. A reviews system that does not actively detect and suppress this behaviour is not trustworthy, no matter how well it scales technically.

Why This Matters Commercially

Regulators increasingly treat fake reviews as consumer protection violations, not just a quality problem. Marketplaces that fail to police manipulated ratings face fines, loss of shopper trust, and reputational damage that directly affects revenue. Fake review detection is not a “nice to have” feature bolted onto reviews — for a modern marketplace it is a core, load-bearing part of the system.

2.4 The Abuse-Resistance Problem

Beyond fake positive reviews, the system must resist spam, harassment, personally identifiable information leaks in review text, offensive content, and coordinated brigading where many accounts pile onto a single product with review bombing after a controversy unrelated to product quality.

2.5 The Consistency Problem

If a shopper submits a review and immediately reloads the page, should they see their own review right away, or is a short delay acceptable in exchange for a much simpler, more scalable architecture? Different parts of the system can tolerate different levels of staleness, and recognizing that is central to a good design.

2.6 The Multi-Language and Multi-Market Problem

A global marketplace collects reviews in dozens of languages, often for the same product sold across many countries. A shopper in one country benefits from seeing translated reviews from another market, but a fraud detection system trained mostly on English text can miss manipulation patterns in other languages entirely if language is not treated as a first-class dimension of the design. Text-based fraud signals need either language-specific models or a shared multilingual embedding space so that suspicious near-duplicate phrasing can be detected even when reviews are written in different languages by the same fraud ring.

2.7 The Recency and Relevance Problem

A flat lifetime average treats a five-year-old review the same as one from yesterday, even though product quality, manufacturing, and seller behaviour can change significantly over that time. A shopper deciding today cares much more about what buyers experienced in the last few months than about opinions formed years ago on an earlier version of the product. This motivates weighting more recent reviews more heavily in the displayed summary, which in turn adds complexity to the aggregation logic described later in this article.

2.8 The Cold-Start Problem

A brand-new product with zero or very few reviews presents a different challenge: a single five-star review would show a perfect rating that is statistically meaningless, while a single one-star review would unfairly tank a product before it has any track record. The system needs a principled way to represent uncertainty when there are very few data points, rather than naively displaying a raw average of one or two ratings as if it were as reliable as an average built from ten thousand reviews.

The rest of this article designs a system that solves all of these problems together: it scales to marketplace-level traffic, keeps ratings fresh and relevant, resists fraud and abuse across languages and markets, handles the cold-start case gracefully, and makes deliberate, justified trade-offs about consistency.

i
Framing to Repeat Out Loud

The core difficulty of a reviews system is not counting stars — it is running a public library of opinions and an active fraud investigation unit on the same event stream, at planet scale, without letting either job slow the other one down.

03

Architecture & Components — High-Level System Design

Before looking at any single component, see the full picture: entry points, services, the event backbone, and storage.

Before looking at any single component, it helps to see the full picture. The diagram below shows every major moving part: the entry points a request goes through, the services that do the work, the queue that decouples slow processing from fast responses, and the storage systems that persist everything.

Notice the shape of this design. Everything that a shopper is waiting on — submitting a review, reading a product page — is handled by a fast path that talks to a database and returns quickly. Everything that is expensive or can tolerate a short delay — fraud scoring, moderation, recalculating rollups — happens asynchronously, driven by events on a queue. This separation is the single most important architectural decision in the whole system.

3.1 Component Walkthrough

01 · CDN

Caches static assets and fully or partially rendered product review pages close to the user, cutting latency and offloading traffic from origin servers.

02 · Load Balancer

A layer 7 load balancer distributes incoming requests across many stateless application instances and across regions, and removes unhealthy instances from rotation.

03 · API Gateway

Single entry point that authenticates the caller, enforces per-user and per-IP rate limits, validates request shape, and routes to the correct backend service.

04 · Review Submission Service

Accepts new reviews and ratings, performs synchronous validation, writes the review as “pending”, and publishes an event for downstream processing.

05 · Review Read Service

Serves review lists and rating summaries to product pages, almost always from cache or read replicas rather than the primary write database.

06 · Rating Aggregation Service

Consumes review events and incrementally updates precomputed rollups (average rating, rating histogram, review count) per product.

07 · Fake Review Detection

Scores every incoming review for fraud signals using a rules engine and a machine learning model, and routes suspicious reviews to moderation.

08 · Moderation Service

Manages the human review queue for content that automated systems flag as uncertain, offensive, or policy-violating.

09 · Message Queue

Kafka or an equivalent log-based queue decouples the fast write path from slower asynchronous consumers and provides replay and buffering.

10 · Sharded Write Database

The system of record for raw review data, partitioned across many shards so no single database instance becomes a bottleneck.

11 · Cache Layer

Redis or a similar in-memory store holds hot rating summaries and recent review pages so most reads never touch a database.

12 · Feature Store

Stores precomputed behavioural and account-level features that the fraud detection model needs at low latency, such as reviewer velocity or device fingerprints.

i
What an Interviewer May Ask

“Why not just write directly to the database and compute the average on read?” Be ready to explain that this works at small scale, but the write path becomes a bottleneck once reviews spike (for example during a flash sale), and recomputing a live average across millions of rows on every page view does not scale. The event-driven separation of “accept quickly, process asynchronously” is the answer they are looking for.

3.2 Why Not a Single Monolithic Service

It is reasonable to ask whether all of this — submission, reading, aggregation, fraud detection, moderation — could simply live inside one application talking to one database. At small scale, it genuinely could, and many products start exactly that way. The reasons this design splits into separate services are specific and concrete rather than complexity for its own sake. Fraud detection needs GPU or high-CPU machine learning inference infrastructure that would be wasteful to provision for every instance of a service that is mostly doing simple database reads and writes. The read path needs to scale to a request volume that is orders of magnitude higher than the write path, and coupling them in one deployable unit means every read-path scaling decision also scales fraud detection infrastructure unnecessarily, and vice versa. Different teams typically own different parts of this system in a large organization — a trust and safety team owns fraud detection and moderation, while a core commerce team owns submission and display — and independent services let each team deploy on their own schedule without coordinating a shared release. None of these reasons apply meaningfully to a small application with modest traffic, which is exactly why this decomposition is a decision that should be made deliberately once scale and organizational structure justify it, not adopted reflexively on day one.

3.3 Data Ownership Across Services

A subtle but important architectural rule in this design is that each service owns its own data store, and no service reaches directly into another service’s database. The read service does not query the write database’s tables directly; it reads only from the cache and rollup store that the aggregation worker maintains specifically for that purpose. This separation means the write database’s internal schema can evolve — adding a column, changing an index, migrating to a different sharding scheme — without breaking the read path, because the two are connected only through the well-defined event stream and the derived rollup store, never through a shared table.

04

Internal Working — How a Single Review Moves Through the System

Architecture diagrams show components; the real understanding comes from following one request end to end.

Architecture diagrams show components, but the real understanding comes from following one request end to end. Let’s trace what happens when a shopper who genuinely bought a pair of headphones submits a four-star review with a short comment.

4.1 Step by Step

  1. Authentication and rate limiting. The API gateway checks that the request carries a valid session token and that this user has not exceeded a sensible number of review submissions in the last hour. This first line of defence stops the crudest bot attacks before they reach any business logic.
  2. Purchase verification. The submission service checks whether this account has an order history entry for this product. Many platforms label such reviews “Verified Purchase” and weight them more heavily, while still allowing unverified reviews with lower trust weight rather than blocking them outright.
  3. Synchronous validation. Basic checks happen immediately: rating is between one and five, text does not exceed a length limit, no banned words trigger an instant block, attached images pass a basic content-safety scan, and any detected personal information in the text is flagged for redaction before the review is stored. These checks are intentionally kept cheap and fast, running in single-digit milliseconds, because they sit directly in the critical path the user is waiting on, unlike the far more expensive fraud scoring that happens afterward.
  4. Write as pending, respond fast. The review is stored with a status of pending and the API responds quickly. The user does not wait for fraud scoring or moderation — that would make the product feel slow and would tie up request threads on expensive machine learning inference.
  5. Asynchronous fraud scoring. The event is picked up by the fraud detection service, which computes a risk score using both fast rule checks and a machine learning model, described in full detail later in this article.
  6. Verdict and rollup update. Depending on the score, the review is auto-published, sent to human moderation, or auto-rejected. If published, the aggregation worker updates the precomputed rating rollup for the product, which is what the read path actually serves.
Real-Life Analogy

This is exactly how airport security works for checked baggage. You hand over your bag at check-in and are told “you’re done, go to your gate” (the fast synchronous accept). Behind the scenes, your bag goes through an X-ray scanner and possibly a manual search (the asynchronous fraud and moderation pipeline) before it is loaded onto the plane. You are never made to stand at the X-ray machine waiting for your own bag to clear — the airline decouples “accept the bag” from “verify the bag is safe,” exactly like decoupling review submission from fraud scoring.

4.2 Handling Edits and Deletions

Reviews are not static once published. A shopper might edit their text a week later after using the product longer, or delete the review entirely. Both operations need to correctly propagate through the same pipeline used for the original submission, rather than being treated as special cases bolted on afterwards.

An edit is modeled internally as a new event, carrying both the old and new rating. The aggregation worker uses the difference to adjust the rollup in a single atomic step — subtracting the old rating’s contribution and adding the new one — rather than deleting and re-inserting, which would briefly and incorrectly show the count as one lower than reality. An edited review is also re-scored by the fraud detection pipeline, since editing text is itself a signal: fraud rings sometimes leave an innocuous review initially and edit in promotional or manipulated content once the review has accumulated trust and visibility.

A deletion, similarly, publishes a removal event that the aggregation worker uses to decrement the rollup, and the underlying row is soft-deleted rather than physically removed, preserving the audit trail described in the data flow section that follows.

05

Data Flow & Lifecycle — The Full Life of a Review

A review is not a single write-once row. It moves through distinct states over its lifetime.

A review is not a single write-once row. It moves through distinct states over its lifetime, and understanding this lifecycle is essential to designing the schema and the services correctly.

Several important design decisions follow directly from this lifecycle diagram.

Reviews Are Never Truly Deleted

When a review is rejected or a product is delisted, the row is not physically removed. It is marked with a terminal status. This matters for audit trails, for appeals (“why was my review rejected?”), and for training future fraud models on confirmed-bad examples.

Post-Publication Monitoring Never Stops

A review that looked legitimate on day one can later be revealed as part of a fraud ring once more data accumulates — for example, if fifty accounts that all reviewed the same product turn out to share the same device fingerprint. The system needs a path to re-open published reviews for re-scoring, not just a one-time gate at submission.

Data Flow Across the Two Paths

It helps to separate the write path from the read path explicitly, because they scale completely differently.

AspectWrite PathRead Path
VolumeLower — a fraction of readers ever write a reviewVery high — every product page view reads the rating
Latency toleranceCan tolerate a short delay before publicationMust be very fast, typically under 100 ms
Consistency needsStrong consistency for the review itselfEventual consistency is acceptable for aggregates
Primary storageSharded relational database, source of truthCache and precomputed rollups
Bottleneck riskFraud scoring latency, database write contentionCache misses, hot key contention on popular products
i
What an Interviewer May Ask

“Walk me through what happens if the fraud detection service is completely down for ten minutes.” A strong answer: reviews continue to be accepted and stored as pending because the write path does not depend on fraud scoring being available at that instant — the event simply queues up in Kafka. Once the fraud service recovers, it drains the backlog. This is the value of decoupling through a durable queue rather than a synchronous call.

5.1 Event Schema Evolution

Every event published onto the queue carries a schema version, managed through a schema registry, so that consumers can be upgraded independently of producers. When a new field is added to the review event — for example, adding a structured “pros and cons” field alongside free text — older consumers that do not yet understand the new field simply ignore it rather than failing to parse the event entirely, because the schema evolution rules require new fields to be optional with sensible defaults. This discipline is what allows the submission service, the fraud detection service, the aggregation worker, and the search indexer to each be deployed on independent schedules without a coordinated, risky simultaneous rollout every time the event shape changes even slightly.

5.2 Exactly-Once vs. At-Least-Once Processing

Message queues like Kafka typically provide at-least-once delivery by default, meaning a consumer might occasionally see the same event more than once, for example if it crashes after processing an event but before acknowledging it. For the aggregation worker, naively applying the same increment event twice would corrupt the rollup. The fix is to make the consumer logic idempotent: each event carries a unique identifier, and the aggregation worker records which event identifiers it has already applied, skipping any it has seen before. This achieves effectively-once processing semantics on top of an at-least-once delivery guarantee, which is a common and important pattern anywhere a queue-driven worker mutates cumulative state.

06

Trade-offs — What This Design Gets Right, and What It Costs

Every architectural choice buys something and costs something. Naming both keeps the design honest.

6.1 Advantages of the Event-Driven Design

Pros

  • Fast, predictable write latency. Users get a quick response regardless of how expensive fraud scoring is.
  • Independent scaling. The fraud detection service, which is CPU and GPU heavy, can be scaled separately from the lightweight submission service.
  • Resilience to partial failure. If the moderation service or the ML model goes down, the queue simply buffers events instead of rejecting user submissions outright.
  • Replayability. Because Kafka retains events, the fraud model can be re-run against historical review events whenever it is retrained, without needing to re-scan the entire database.
  • Clear ownership boundaries. Each service has a narrow, well-defined responsibility, which makes it easier for different teams to own, test, and reason about their part of the system in isolation.
  • Backpressure handling built in. A sudden burst of submissions during a promotional event does not need to be handled by the submission service itself; the queue naturally absorbs the burst, and downstream consumers process it at their own sustainable pace.

Cons

  • Eventual visibility. A review is not instantly visible to everyone else — there is a delay, typically seconds to a few minutes, before it is auto-published or queued for moderation. Some products intentionally show the submitter their own pending review with a “your review is under review” label to soften this.
  • Operational complexity. The system now has many moving parts — a queue, multiple consumer services, a feature store — each of which needs its own monitoring, deployment pipeline, and on-call ownership.
  • Eventual consistency of aggregates. The star rating shown to a shopper might lag the true state by a few seconds. This is almost always an acceptable trade-off, but it is a real one.
The Central Trade-off in One Sentence

We accept a small amount of staleness and architectural complexity in exchange for a system that stays fast and available even when the expensive parts — fraud detection, moderation, and aggregation — are under heavy load or temporarily degraded.

6.2 CAP Theorem Framing

The reviews system leans towards availability and partition tolerance (AP) for the read path — shoppers should always see some rating, even a slightly stale one, rather than an error page. The write path for the review itself leans towards consistency for the specific row being written (a user’s own submission should not silently disappear), while the aggregate rollups are explicitly designed to be eventually consistent across the fleet.

6.3 Choosing Where to Spend Consistency, Deliberately

A common mistake in system design discussions is treating consistency as a single global dial that applies uniformly to an entire system. In practice, a well-designed system makes a distinct, deliberate choice for each piece of data. This system makes three different choices side by side: the individual review row is strongly consistent, because losing or duplicating a specific user’s submission is unacceptable and directly damages trust in the product. The aggregate rating rollup is eventually consistent, because a few seconds of staleness in an average across thousands of reviews is invisible to a shopper and the performance benefit is enormous. The fraud detection verdict is deliberately delayed and asynchronous, because correctness there matters far more than speed, and rushing a fraud decision synchronously would either slow down every submission or force the model to be too simplistic to be effective. Recognizing that different pieces of data in the same system can and should make different trade-offs is one of the more mature ideas in distributed systems design, and it is worth stating explicitly rather than leaving implicit.

6.4 Consistency Choices at a Glance

DataConsistency choiceWhy
Individual review rowStrong consistencyLosing or duplicating a specific user’s submission directly damages product trust.
Aggregate rating rollupEventual consistencySeconds of staleness in a large average are invisible to shoppers; performance gain is enormous.
Fraud verdictDeliberately delayedAccuracy of the verdict matters more than freshness; rushing forces model over-simplification.
Search index over review textEventually consistentA small lag between publication and searchability is acceptable in exchange for a dedicated index.
07

Scaling to Billions of Reviews and Millions of Requests per Minute

The number a shopper sees is never computed live from raw review rows — it is a precomputed rollup.

7.1 The Read Path — Precompute, Don’t Recompute

The single most important performance decision in this system is that the number a shopper sees — the average rating and the count — is never computed live from raw review rows. It is a precomputed rollup, updated incrementally by the aggregation worker every time a review is published, rejected, or edited.

Incremental rollup update — Java
// Incremental rollup update - Java
public class RatingRollupUpdater {

    public void applyNewReview(String productId, int newRating) {
        RatingRollup rollup = rollupStore.getOrCreate(productId);

        rollup.totalReviewCount += 1;
        rollup.ratingSum += newRating;
        rollup.histogram[newRating - 1] += 1;

        double newAverage = (double) rollup.ratingSum / rollup.totalReviewCount;
        rollup.averageRating = round(newAverage, 2);

        rollupStore.save(productId, rollup);
        cache.set("rating:" + productId, rollup, Duration.ofMinutes(10));
    }

    public void applyRemovedReview(String productId, int oldRating) {
        RatingRollup rollup = rollupStore.getOrCreate(productId);

        rollup.totalReviewCount -= 1;
        rollup.ratingSum -= oldRating;
        rollup.histogram[oldRating - 1] -= 1;

        if (rollup.totalReviewCount > 0) {
            rollup.averageRating = round(
                (double) rollup.ratingSum / rollup.totalReviewCount, 2);
        } else {
            rollup.averageRating = 0.0;
        }

        rollupStore.save(productId, rollup);
        cache.evict("rating:" + productId);
    }
}

This turns an expensive AVG() over millions of rows into a constant-time arithmetic update. The read path then simply fetches the rollup — almost always from cache — rather than touching the raw review table at all.

7.2 Caching Strategy

Rating summaries are extremely cache-friendly: they are read far more often than they change, and a few seconds or even a couple of minutes of staleness is invisible to a shopper. A typical setup uses Redis with a short time-to-live and cache invalidation triggered by the aggregation worker whenever a rollup changes, combined with a CDN layer caching fully rendered product pages for anonymous, non-logged-in traffic.

Hot Key Problem

A viral or flash-sale product can receive a disproportionate share of both reads and writes, turning its single cache key into a hot spot that overwhelms one Redis node. The standard fix is to shard the hot key itself — for example maintaining several partial counters per product that are summed on read — or to add a short local in-memory cache in front of Redis for the very hottest products.

i
Production Example

Large marketplaces route rating and review reads through multiple cache tiers: an edge CDN cache for anonymous product page views, a regional Redis cluster for personalized or logged-in views, and read replicas as the final fallback. This layering means the primary write database almost never sees a read query for popular products.

Geographic distance adds real, physical latency that no amount of clever code can remove — a request travelling between distant continents spends a meaningful fraction of a second just on network transit, before any application logic even runs. Placing cache nodes and read replicas in the same region as the shoppers they serve is therefore not an optimization to consider later; it is a baseline requirement for meeting sub-hundred-millisecond latency targets globally. This is precisely why the CDN layer sits at the very edge of the architecture, physically closest to the end user, and why regional cache clusters exist rather than relying on a single global cache location that would force every read, everywhere in the world, through one geographic point.

7.3 Write Path Scaling

Review submissions are sharded across many database instances, typically by product_id hash, so writes for different products land on different shards and no single database becomes a bottleneck during a spike. The message queue absorbs bursts — if fraud scoring temporarily can’t keep up with a surge of submissions during a big sale event, messages simply queue rather than being dropped or causing submission failures.

7.4 Solving the Cold-Start Problem with Bayesian Averaging

A raw average of one or two reviews is statistically unreliable, but the platform still needs to show something. The standard fix, borrowed directly from Bayesian statistics, is to blend the product’s own small sample with a prior belief based on the overall average rating across the whole category. This pulls a product with very few reviews towards the category-wide average instead of letting a single extreme rating dominate, and it naturally converges to the true average as more reviews accumulate.

Bayesian weighted average — Java
// Bayesian weighted average rating - Java
public double bayesianAverage(int productReviewCount,
                                double productAverage,
                                double categoryAverage,
                                int confidenceWeight) {
    // confidenceWeight represents how many "virtual" prior
    // reviews of the category average we blend in
    return ((confidenceWeight * categoryAverage)
            + (productReviewCount * productAverage))
            / (confidenceWeight + productReviewCount);
}

A related technique, the Wilson score interval, is used when ranking products by “percentage positive” rather than a five-star average — for example, sorting search results by how confidently positive their reviews are, rather than by raw average, so that a product with two five-star reviews does not outrank a product with ten thousand reviews averaging 4.7 stars.

7.5 Concurrency — Safely Updating a Shared Counter Under Load

A popular product can receive many review submissions within the same second, especially right after a promotional push. If the rollup update in the aggregation worker is implemented as a naive read-modify-write, two concurrent updates can race: both read the same starting count, both add one, and one increment is silently lost. This is a classic lost-update concurrency bug, and it is solved with either atomic increment operations at the storage layer, or optimistic concurrency control using a version number that is checked and incremented on every write, causing the losing writer to retry.

Optimistic concurrency control for rollup updates — Java
// Optimistic concurrency control for rollup updates - Java
public void applyWithRetry(String productId, int rating) {
    int maxRetries = 5;
    for (int attempt = 0; attempt < maxRetries; attempt++) {
        RatingRollup current = rollupStore.getWithVersion(productId);
        RatingRollup updated = current.withIncrement(rating);

        boolean success = rollupStore.compareAndSwap(
            productId, current.version, updated);

        if (success) {
            return;
        }
        // another writer won the race, retry with fresh data
    }
    throw new ConcurrencyException("Failed to update rollup after retries");
}

At very high write volume for a single hot product, even optimistic retries can start to contend heavily. A further optimization is to maintain several partial counters per product, called counter sharding, where each write picks one partial counter at random to increment and the read path sums all partial counters together. This trades a slightly more expensive read for a much cheaper, contention-free write.

7.6 Back-of-Envelope Numbers

MetricIllustrative Scale
Total productsHundreds of millions
Total reviews storedTens of billions over the platform’s lifetime
Peak review readsMillions of requests per minute during sale events
Peak review writesThousands of submissions per second at flash-sale peaks
Acceptable read latencyUnder 100 milliseconds at p99
Acceptable write-to-visible delaySeconds to a few minutes, clearly communicated to the user
i
What an Interviewer May Ask

“How would you avoid recalculating the average rating from scratch every time?” This is almost always asked directly. The expected answer is exactly the incremental rollup pattern above: maintain a running sum and count, and update them arithmetically rather than re-scanning the review table.

08

Replication, Consensus & Networking — Keeping Data Consistent Across Machines

Making “data written to one machine reliably shows up on the machines that need it” true, at scale, is its own engineering problem.

Everything discussed so far assumes that data written to one machine reliably ends up visible on the machines that need it. Making that assumption true, at scale, across regions, is its own substantial engineering problem, and it is worth examining directly because it shapes several of the earlier design decisions.

8.1 Leader-Based Replication

Each database shard uses a single leader that accepts all writes for that shard, with one or more followers that replicate the leader’s write-ahead log. Reads are served from followers whenever slightly stale data is acceptable, which, as established earlier, is true for almost all review reads. Replication can be synchronous, where the leader waits for at least one follower to confirm before acknowledging the write, or asynchronous, where the leader acknowledges immediately and followers catch up shortly after. This system uses semi-synchronous replication for the review write path: the leader waits for one follower acknowledgment before confirming to the client, which protects against losing a just-written review if the leader crashes a moment later, while avoiding the higher latency cost of waiting for every follower.

8.2 Leader Election and Failover

When a shard’s leader becomes unreachable, the remaining nodes need to agree on a new leader without any ambiguity about who is now authoritative — a classic distributed consensus problem. Rather than implementing consensus logic from scratch, production systems rely on a battle-tested consensus protocol, most commonly Raft, either built into the database engine itself or implemented by a coordination service such as etcd or ZooKeeper that the database cluster consults for leader election. The key property this provides is that at any given moment, all healthy nodes agree on exactly one leader for a given shard, preventing the dangerous scenario of two nodes both believing they are the leader and accepting conflicting writes simultaneously, known as split-brain.

8.3 Why This Matters for the Reviews System Specifically

A split-brain scenario in the reviews database could allow the same review to be written differently on two different nodes that both think they are the leader, or allow a rollup update to be lost entirely during a leadership transition. Choosing a database technology with strong, well-tested consensus guarantees, and configuring semi-synchronous replication for the write path, is a deliberate trade of a small amount of write latency for a much stronger guarantee that a shopper’s submitted review is never silently lost or duplicated during a node failure.

8.4 Cross-Region Networking

For a global marketplace, cross-region network latency, typically in the range of one hundred to two hundred milliseconds between distant regions, makes synchronous cross-region replication impractical for the write path without unacceptably slowing down every review submission. Instead, each region operates its own leader for locally created data, with asynchronous cross-region replication for data that genuinely needs to be visible globally, such as a seller’s aggregate rating when that seller operates storefronts in multiple regions. This is another instance of the same underlying principle seen throughout this article: keep the fast path local and synchronous where it matters to the user, and push anything that can tolerate delay onto an asynchronous path.

i
What an Interviewer May Ask

“How do you prevent split-brain during a database failover?” A strong answer names a specific consensus mechanism, such as Raft-based leader election, and explains that it guarantees a majority quorum agrees on the current leader before any node is allowed to accept writes as leader, which is what prevents two nodes from simultaneously believing they hold leadership.

09

High Availability & Reliability — Keeping Reviews Available When Things Fail

A reviews system does not need to be perfectly correct at every millisecond, but it does need to stay available.

A reviews system does not need to be perfectly correct at every millisecond, but it does need to stay available. A shopper should never see a broken product page just because the fraud detection service had a bad deployment.

9.1 Redundancy at Every Layer

  • Multi-AZ and multi-region deployment. Application services and databases are deployed across multiple availability zones, and for the largest platforms, multiple geographic regions, so a single data center failure does not take down the whole system.
  • Database replication. Each database shard has at least one, usually two, replicas. Read traffic is served from replicas; the primary handles writes and replicates asynchronously or semi-synchronously to replicas.
  • Queue durability. Kafka topics are replicated across brokers, so a single broker failure does not lose in-flight review events.
  • Graceful degradation. If the fraud detection ML model is unavailable, the system falls back to rules-only scoring rather than blocking all submissions or, worse, auto-publishing everything unchecked.

9.2 Failure Mode — Cache Cluster Outage

If Redis becomes unavailable, the read service falls back to read replicas directly. This is slower and increases database load, so the read service applies more aggressive request coalescing and short-lived in-process caching during the outage to avoid overwhelming the replicas — a classic example of a circuit breaker protecting a downstream dependency.

9.3 Disaster Recovery

Regular automated backups of the sharded databases, combined with point-in-time recovery, protect against data corruption or accidental deletion. Cross-region replication of critical data ensures that a full regional outage results in, at worst, a brief failover window rather than permanent data loss. Recovery Point Objective and Recovery Time Objective targets are typically set in minutes for a system this central to the shopping experience.

i
Production Example

Large-scale marketplaces treat review and rating availability as part of the core product page SLA, because a broken rating widget on a high-traffic product page directly affects conversion. Review infrastructure is monitored with the same rigor as checkout infrastructure, even though it is “just” reviews.

9.4 Failure Mode — Message Queue Backlog During a Sale Event

During a major promotional event, review submissions can spike dramatically as shoppers who bought items during a previous sale come back to leave feedback. If the fraud detection consumers cannot keep pace, the Kafka topic backlog grows. Because the write path only depends on successfully publishing the event, not on it being consumed immediately, submissions continue to succeed even as the backlog grows — shoppers experience no disruption. The operational response is to auto-scale the fraud detection consumer fleet based on consumer lag rather than CPU utilization alone, since lag is a more direct measure of whether the pipeline is keeping up with actual demand.

9.5 Testing for Resilience

Resilience is validated proactively, not just documented. Regular chaos engineering exercises deliberately kill database replicas, introduce artificial latency into the fraud scoring service, and simulate full regional failover, verifying that the system degrades gracefully — slower, perhaps showing slightly staler ratings — rather than failing outright. These exercises are what give confidence that the circuit breakers, fallback caches, and retry logic described throughout this article actually work under real failure conditions, rather than only in the diagrams. A useful discipline many teams adopt is scheduling these exercises on a fixed recurring cadence rather than only after an incident, since a resilience mechanism that has not been exercised in months is effectively untested code, regardless of how confidently it was designed and reviewed at the time it was written.

10

Security — Protecting the Reviews Pipeline

Every layer of the pipeline is a target. Defence in depth is the only durable answer.

10.1 Authentication and Authorization

Every write request must be tied to an authenticated account. Session tokens are short-lived and validated at the API gateway. Authorization rules prevent, for example, a moderator-only endpoint from being callable by a regular shopper account, and prevent one user from editing or deleting another user’s review.

10.2 Input Validation and Sanitization

Review text is user-generated content rendered back to millions of other users, which makes it a natural target for cross-site scripting attacks. All review text is sanitized and encoded before storage and again before rendering, and rich formatting is restricted to a safe, limited markup subset rather than raw HTML.

10.3 Rate Limiting and Abuse Prevention

Per-account and per-IP rate limits at the API gateway prevent a single actor from flooding the system with submissions. Device fingerprinting and CAPTCHA challenges are triggered when submission patterns look automated — for example, dozens of five-star reviews from the same IP address within a few minutes.

10.4 PII Protection

Review text sometimes accidentally contains personal information — a phone number, an email address, or a full name in a complaint. Automated scanning flags likely PII in review text so it can be redacted or the review held for review before publication, protecting both the reviewer and third parties mentioned in the text. This scanning runs as part of the same synchronous validation step that checks length limits and banned words, since PII exposure is a harm that should ideally never reach publication even briefly, rather than something corrected after the fact through the asynchronous pipeline.

A related concern is that the rich behavioural and device data collected for fraud detection is itself sensitive personal data, and needs the same data protection discipline as any other personal information the company holds. Access to raw device fingerprints, IP history, and account linkage graphs is restricted to the systems and personnel that genuinely need it for fraud investigation, with retention periods that delete or anonymize this data once it is no longer needed, balancing the fraud-fighting value of the data against the privacy cost of holding it indefinitely.

10.5 Protecting the Fraud Model Itself

The fraud detection system is itself a target. Adversaries probe it to learn what gets flagged, then adjust their behaviour to slip under the threshold. Mitigations include not exposing exact scores or thresholds to the public, randomizing some review sampling into manual audit regardless of score, and continuously retraining models so that adversaries chasing a static target keep falling behind.

Common Mistake

Relying purely on client-side validation for anything security related. All meaningful checks — purchase verification, rate limits, content moderation, fraud scoring — must happen server-side, because a client can always be bypassed or scripted directly against the API.

10.6 Threat Model Summary

ThreatPrimary defence
Automated bot account creationCAPTCHA challenges, device fingerprinting, email and phone verification
Cross-site scripting via review textServer-side sanitization and safe rendering with restricted markup
Credential stuffing to hijack accounts and post reviewsRate-limited login attempts, anomaly detection on login location and device
API scraping to reverse-engineer fraud thresholdsRate limiting, response obfuscation, no exposure of raw scores
Insider abuse by moderatorsAudit logging of every moderation decision, tied to a named account
Denial of service against the submission endpointLayered rate limiting at the load balancer and API gateway, upstream DDoS protection

10.7 Encryption and Data Protection

All traffic between clients and the API gateway is encrypted in transit using TLS, and data at rest in the sharded databases and object storage is encrypted using standard disk or database-level encryption. Access to raw review data, especially anything linked to a real identity, is restricted through role-based access control, so that, for example, a data analyst working on aggregate rating trends does not need or receive access to individual users’ account details.

Taken together, these security measures share a common philosophy with the fraud detection design discussed later in this article: no single control is treated as sufficient on its own. Authentication stops anonymous abuse, rate limiting stops volume-based attacks that slip past authentication, input sanitization stops content-based exploits regardless of who submitted them, and access control limits the damage even if one of the earlier layers is somehow bypassed. This defence-in-depth approach, where each layer assumes the layers before it might eventually fail, is what allows the system to remain trustworthy even as individual attack techniques inevitably evolve over time.

11

Deep Dive — Detecting Fake and Manipulated Reviews

This is the part of the system that turns a simple CRUD feature into a genuinely hard engineering problem.

This is the part of the system that turns a simple CRUD feature into a genuinely hard engineering problem. Fake reviews take many forms, and no single technique catches all of them. A production-grade detection pipeline layers several independent signals so that an adversary has to defeat all of them simultaneously, not just one. What makes this domain especially difficult compared to many other trust-and-safety problems is that the adversary is economically motivated and actively adaptive: unlike a spam bot that keeps repeating an ineffective pattern indefinitely, a paid review network or a sophisticated seller has a direct financial incentive to study what gets caught and adjust, which means detection cannot be a one-time engineering project with a fixed endpoint — it is an ongoing, adversarial process that requires the same continuous investment as any other security discipline.

It also helps to be precise about what “fake” actually covers, because treating it as a single monolithic category leads to weaker detection. Some manipulated reviews are entirely fabricated by accounts that never interacted with the product at all. Others come from real people who did receive and use the product, but were financially incentivized to leave a specific, predetermined rating, which makes the review dishonest in intent even though the underlying experience was genuine. Still others are real, unbiased opinions that simply get miscounted because they were duplicated, posted from a compromised account, or swept up in a review-bombing campaign unrelated to actual product quality. Each of these sub-categories benefits from a different mix of the signal types described below, which is part of why a single unified score, rather than several distinct specialized checks, tends to underperform in practice.

11.1 Categories of Fake and Low-Trust Reviews

CategoryDescriptionTypical signal
Incentivized reviewsReviewer received a free product or payment in exchange for a positive reviewDisclosure text patterns, seller-linked reviewer clusters
Bot-generated reviewsAutomated scripts create accounts and post templated text at scaleText similarity across accounts, submission timing patterns
Seller self-reviewsSeller or their associates review their own product under alternate accountsShared payment methods, device fingerprints, IP ranges
Competitor sabotageCoordinated negative reviews to damage a rival’s ratingSudden burst of low ratings with no purchase history, review bombing patterns
Review farmsOrganized groups of real people paid to leave reviews across many unrelated productsReviewer graph shows accounts touching many disconnected products in a pattern

11.2 Layered Detection Architecture

Rather than a single model making a single decision, the system runs several independent detectors and combines their outputs. This layered approach is both more accurate and more resilient — an adversary who defeats the text model still has to get past the behavioural and graph-based checks.

1. Text Signals

Genuine reviews tend to have natural variation in vocabulary, length, and structure. Fake reviews, especially those generated in bulk, often show telltale patterns: unusually generic superlative language, near-duplicate phrasing across supposedly unrelated reviewers, or text that reads like it was written about the product category rather than the specific item actually used. Text embeddings — numerical representations of meaning produced by a language model — let the system measure how similar two pieces of review text really are, even when the wording has been superficially changed to avoid exact-match detection.

2. Behavioural Signals

How an account behaves is often more revealing than what it writes. Key behavioural features include how quickly after account creation the first review was posted, how many reviews the account posts per day compared to typical users, whether reviews are posted in unnatural bursts, and whether the device or browser fingerprint is shared across many accounts that all reviewed the same seller’s products.

3. Graph Signals

Fraud rarely happens in isolation. Building a graph where reviewers, products, sellers, devices, and payment instruments are nodes, and reviews or shared attributes are edges, reveals clusters that are invisible when looking at any single review in isolation. A tightly connected cluster of accounts that all reviewed the same small set of products, share IP ranges, and were created within days of each other is a strong fraud signal even if each individual review looks perfectly normal in isolation.

4. Purchase and Order Signals

Whether the reviewer actually bought the product, whether they returned it shortly after, and whether the order was placed through a suspicious payment pattern all feed into the trust score. A “Verified Purchase” badge is itself a strong, simple, and highly effective fake-review deterrent, because it raises the cost of faking a review from “create an account” to “complete an actual purchase.”

Simplified fraud scoring service — Java
// Simplified fraud scoring service - Java
public class FraudScoringService {

    public FraudVerdict scoreReview(ReviewEvent event) {
        double textScore = textSignalScorer.score(event.getReviewText());
        double behaviorScore = behaviorSignalScorer.score(event.getReviewerId());
        double graphScore = graphSignalScorer.score(
            event.getReviewerId(), event.getSellerId());
        double purchaseScore = purchaseSignalScorer.score(
            event.getReviewerId(), event.getProductId());

        double finalScore = ensembleModel.combine(
            textScore, behaviorScore, graphScore, purchaseScore);

        if (finalScore >= REJECT_THRESHOLD) {
            return FraudVerdict.autoReject(finalScore);
        } else if (finalScore >= REVIEW_THRESHOLD) {
            return FraudVerdict.sendToModeration(finalScore);
        } else {
            return FraudVerdict.autoPublish(finalScore);
        }
    }
}

Graph Clustering in Practice

Building the reviewer-seller-device graph is only half the work; the harder part is finding suspicious dense clusters inside a graph with hundreds of millions of nodes. Rather than running an expensive full graph algorithm on every single new review, production systems maintain the graph incrementally and run community detection algorithms, such as label propagation or connected components analysis, on a regular batch cadence, then cache the resulting cluster risk score so it can be looked up cheaply at review-submission time.

Connected-component risk lookup — Java
// Simplified connected-component risk lookup - Java
public class GraphSignalScorer {

    public double score(String reviewerId, String sellerId) {
        String clusterId = clusterIndex.getClusterFor(reviewerId);
        if (clusterId == null) {
            return 0.0; // no known cluster, neutral signal
        }

        ClusterRiskProfile profile = clusterRiskStore.get(clusterId);
        if (profile == null) {
            return 0.0;
        }

        double sizeSignal = normalizeClusterSize(profile.getMemberCount());
        double densitySignal = profile.getConnectionDensity();
        double sellerOverlapSignal = profile.getSellerConcentration(sellerId);

        return weightedSum(sizeSignal, densitySignal, sellerOverlapSignal);
    }
}

A cluster that is unusually dense, unusually large for how recently its accounts were created, and concentrated around a small number of sellers is treated as high risk, and every review coming from a member of that cluster inherits an elevated base score, even if that specific review’s text and behaviour look unremarkable in isolation.

Temporal Pattern Detection

Genuine review volume for a product tends to track its sales volume fairly smoothly. A sudden, sharp spike in five-star reviews disconnected from any corresponding spike in verified purchases is a strong anomaly signal on its own, independent of anything about the content of the individual reviews. Time-series anomaly detection, comparing the current review velocity against a rolling historical baseline for that product and category, catches exactly this pattern and is often one of the cheapest, highest-signal checks in the entire pipeline.

11.3 The Role of Human Moderators

Machine learning models are deliberately tuned to be conservative: reviews that are clearly fraudulent are auto-rejected, reviews that are clearly genuine are auto-published, and everything in the uncertain middle goes to a human moderation queue. This keeps false positives — genuine reviewers wrongly blocked — low, which matters enormously for user trust, while still catching the bulk of obvious fraud automatically. A small percentage of auto-published and auto-rejected reviews are also randomly sampled for human audit, which both catches model drift and produces fresh labeled training data.

11.4 Continuous Learning Loop

Fraud tactics evolve constantly, so the detection system cannot be a static, one-time-trained model. Moderator decisions, user reports, and confirmed fraud ring takedowns all feed back into the training data, and the model is retrained on a regular cadence. This closes the loop between detection and adaptation. Treating the model as a living system that requires ongoing care, rather than a one-off deliverable that ships and is then left alone, is what separates a fraud detection pipeline that stays effective for years from one whose accuracy quietly decays within a few months as adversaries learn to route around its blind spots.

i
What an Interviewer May Ask

“How would you detect a fake review that reads perfectly naturally and comes from a real, aged account?” This is the question that tests whether a candidate understands layered detection. The right answer is that no single text-based check catches this — you need behavioural and graph signals: is this reviewer connected to a cluster of other accounts that all reviewed the same narrow set of products, and does the timing or purchase pattern look organic. Individually normal-looking reviews can still be caught by how they relate to each other.

Common Mistake

Building fraud detection as a single “is this text fake” classifier and stopping there. Sophisticated fraud rings specifically optimize their text to sound natural, precisely because they know a text classifier is the easiest signal to defeat. A resilient system always combines behavioural and relational signals with text signals.

12

Monitoring, Logging & Metrics — Knowing the System Is Healthy and Honest

A reviews platform needs two independent monitoring surfaces — system health and trust-and-safety health.

Monitoring a reviews platform has two distinct dimensions: standard system health, and trust and safety health. Both need dashboards, alerts, and on-call ownership.

12.1 System Health Metrics

  • Request latency at p50, p95, and p99 for submission and read endpoints.
  • Queue lag — how far behind the fraud detection and aggregation consumers are from the head of the Kafka topic.
  • Cache hit ratio for rating summaries; a sudden drop signals a cache invalidation bug or an outage.
  • Database replication lag between primaries and read replicas.
  • Error rates per service, broken down by endpoint and dependency.

12.2 Trust and Safety Metrics

  • Fraud flag rate — the percentage of submitted reviews flagged as medium or high risk, tracked over time to catch sudden spikes that might indicate a new attack pattern.
  • Moderator queue depth and average time-to-decision, since a growing backlog delays legitimate reviews from being published.
  • False positive rate, measured from user appeals and moderator overturns of auto-rejections.
  • Model score distribution drift, which can indicate either a genuine change in reviewer behaviour or the fraud model going stale.

12.3 Logging and Tracing

Every review carries a trace ID from submission through fraud scoring to publication, so a support agent or engineer investigating “why was my review rejected” can reconstruct the full decision path — which rule fired, what the model score was, and whether a moderator overrode the automated verdict. Structured logs at each stage, correlated by this trace ID, are essential for both debugging and for responding to user appeals fairly.

i
Production Example

Marketplaces publish transparency reports summarizing how many reviews were removed for policy violations, giving both regulators and shoppers visibility into the scale of the moderation effort — a practice made possible only because every decision was logged and traceable in the first place.

12.4 Alerting Strategy

Not every metric deviation deserves to wake an engineer at 3 am. Alerts are tiered by severity and by how directly they affect shoppers. A spike in submission endpoint error rate, or a cache hit ratio collapse that will directly slow down product pages, pages the on-call engineer immediately. A gradual rise in the fraud flag rate over several days, by contrast, is routed to the trust and safety team’s daily review rather than triggering a page, since it usually reflects a slower-moving trend that benefits from human analysis rather than an urgent reactive fix.

Anomaly-based alerting, rather than fixed static thresholds, works well for trust and safety metrics specifically because normal traffic patterns already vary a great deal by day of week, time of day, and ongoing promotional events. A model that learns the expected range for a given hour and day, and alerts only on statistically significant deviation from that learned baseline, produces far fewer false alarms than a single fixed threshold ever could.

12.5 Dashboards for Different Audiences

The engineering on-call dashboard focuses on latency, error rates, and queue lag. A separate trust and safety dashboard focuses on flag rates, moderator queue depth, and model score distributions. A third, business-facing dashboard tracks review volume, average rating trends by category, and the overall health of the review ecosystem in language that is meaningful to product and policy stakeholders rather than infrastructure metrics. Building all three from the same underlying event stream, rather than three separate ad hoc pipelines, keeps them consistent with each other and avoids the common failure mode where different teams report conflicting numbers for what should be the same underlying reality.

13

Deployment & Cloud Considerations — Running This System in Production

A brilliant architecture poorly deployed still fails users. Deployment discipline is not optional.

Each service in the architecture is deployed as an independently scalable, containerized unit, typically orchestrated with Kubernetes, so that the fraud detection service — which needs more CPU and sometimes GPU resources for model inference — can be scaled independently of the lightweight, high-throughput read service.

13.1 Deployment Strategy

  • Rolling and canary deployments. New versions of any service, especially the fraud scoring model, are rolled out to a small percentage of traffic first and compared against the existing version before a full rollout.
  • Shadow deployment for ML models. New fraud model versions run in shadow mode, scoring live traffic without affecting real decisions, so their behaviour can be validated against the current production model before cutover.
  • Feature flags. New moderation rules or UI changes to how reviews are displayed are gated behind flags, allowing fast rollback without a full redeploy.

13.2 Multi-Region Considerations

A global marketplace serves shoppers across many geographies with different data residency requirements. Review data for users in a given region is often required to be stored within that region for regulatory reasons, which pushes the design towards regional database clusters with careful, deliberate cross-region replication only for data that genuinely needs to be global, such as a seller’s aggregate rating that spans multiple storefronts.

This regional isolation also has a useful side effect for resilience: a serious outage confined to one region’s infrastructure does not automatically take down review functionality for shoppers in other regions, since each region largely operates as a self-contained deployment with its own load balancers, application instances, database shards, and cache clusters. Only a narrow set of cross-cutting concerns, such as the fraud model artifact itself and global seller reputation data, actually need to flow between regions, and those flows are deliberately built as asynchronous, best-effort replication rather than anything the regional fast path depends on synchronously.

13.3 Managed Cloud Services Mapping

ComponentAWSGCP
Event streamKinesis / MSK (managed Kafka)Pub/Sub / Confluent on GCP
Sharded write DBAurora Postgres (partitioned) / DynamoDB with GSIsCloud SQL / Spanner
Sharded cacheElastiCache for RedisMemorystore for Redis
Object storage for mediaS3Cloud Storage
Search index over reviewsOpenSearch ServiceVertex AI Search / self-managed Elasticsearch on GKE
ML inference for fraudSageMaker / self-managed on EKS with GPU node poolsVertex AI / self-managed on GKE

13.4 Cost Optimization

Machine learning inference for fraud scoring is one of the more expensive parts of the pipeline. Common cost controls include batching inference requests where a small delay is acceptable, using smaller distilled models for the first-pass rule engine and reserving the larger model for borderline cases, and auto-scaling the inference fleet down aggressively during low-traffic hours while keeping a warm minimum to avoid cold-start latency spikes.

13.5 Rollback Readiness

Every deployment, but especially fraud model deployments, needs a fast, well-rehearsed rollback path. Because a bad fraud model version can either let a wave of fake reviews through or wrongly block genuine reviewers at scale within minutes, the deployment pipeline keeps the previous known-good model version warm and ready to receive traffic instantly, rather than requiring a full cold redeploy to revert. Automated rollback triggers, based on a sudden spike in either the flag rate or the appeal rate immediately following a deployment, remove the need for a human to notice the problem before reverting begins.

13.6 Infrastructure as Code

All of the infrastructure described in this article — the Kubernetes clusters, the database shard topology, the Kafka topic configuration, the caching layer — is defined declaratively as code and deployed through a version-controlled pipeline, rather than configured manually. This matters especially for a system with regional data residency requirements, since spinning up a fully compliant regional deployment for a new market becomes a matter of applying a known-good configuration template rather than manually reconstructing infrastructure decisions from memory.

Practical Tip

Instrument every fraud-model deployment with an automatic guardrail: if the appeal rate or the flag rate deviates more than a preconfigured percentage from a rolling baseline within the first fifteen minutes of the new version taking traffic, the pipeline auto-reverts to the previous known-good model instead of waiting for a human to notice the problem in a dashboard.

14

Databases, Caching & Load Balancing — The Storage Layer in Detail

Storage decisions ripple through everything else. Getting sharding, caching, and search index shape right early avoids painful migrations later.

14.1 Sharding Strategy

The primary write database is sharded by product_id, so all reviews for a given product live on the same shard, keeping “fetch all reviews for this product” queries efficient. A separate index, keyed by user_id, supports “show me my reviews” queries without needing a cross-shard scan.

14.2 Schema Sketch

Core review + rollup schema — SQL (per shard)
-- Core review table (per shard)
CREATE TABLE reviews (
    review_id       BIGINT PRIMARY KEY,
    product_id      BIGINT NOT NULL,
    user_id         BIGINT NOT NULL,
    rating          SMALLINT NOT NULL CHECK (rating BETWEEN 1 AND 5),
    review_text     TEXT,
    verified_purchase BOOLEAN DEFAULT FALSE,
    status          VARCHAR(20) NOT NULL DEFAULT 'pending',
    fraud_score     DOUBLE PRECISION,
    created_at      TIMESTAMP NOT NULL DEFAULT now(),
    updated_at      TIMESTAMP NOT NULL DEFAULT now()
);

CREATE INDEX idx_reviews_product ON reviews (product_id, status);
CREATE INDEX idx_reviews_user ON reviews (user_id);

-- Precomputed rollup table
CREATE TABLE rating_rollups (
    product_id      BIGINT PRIMARY KEY,
    review_count    BIGINT NOT NULL DEFAULT 0,
    rating_sum      BIGINT NOT NULL DEFAULT 0,
    average_rating  NUMERIC(3,2) NOT NULL DEFAULT 0,
    histogram_1     BIGINT NOT NULL DEFAULT 0,
    histogram_2     BIGINT NOT NULL DEFAULT 0,
    histogram_3     BIGINT NOT NULL DEFAULT 0,
    histogram_4     BIGINT NOT NULL DEFAULT 0,
    histogram_5     BIGINT NOT NULL DEFAULT 0
);

14.3 Consistency Between Cache and Database

Keeping a cache and its underlying database in agreement is a well-known source of subtle bugs. This system uses a cache-aside pattern for reads: the read service checks Redis first, and on a miss, reads from a replica and populates the cache. Writes flow differently — rather than updating the cache directly from the write path, the aggregation worker explicitly invalidates or refreshes the relevant cache key whenever it updates a rollup, ensuring the cache is never left holding a value that the source of truth has already moved past. The alternative, writing to the cache directly from multiple different services, was deliberately avoided, because it creates multiple independent code paths that can each get the invalidation logic slightly wrong, and those small inconsistencies are notoriously difficult to track down in production.

14.4 Why a Relational Database, Not Just a Document Store

Reviews benefit from relational integrity — a review must reference a valid product and user, ratings are constrained to a fixed range, and moderation status transitions follow clear rules well suited to constraints and transactions. Sharded relational databases such as partitioned Postgres or a distributed SQL system give this structure while still scaling horizontally, which is why they remain a common choice for the review system of record, even though the read-heavy aggregate layer is served from a key-value cache.

14.5 Caching Layers Recap

LayerWhat it cachesTypical TTL
CDNFully rendered product pages for anonymous trafficMinutes, invalidated on major rating change
Redis clusterRating rollups, recent review pagesSeconds to tens of minutes
Local in-process cacheExtremely hot keys during traffic spikesSeconds

14.6 Full-Text Search and Sorting

Shoppers often want to sort or filter reviews — “most helpful,” “most recent,” or search within review text for a specific keyword like “battery life.” The primary sharded relational database is not well suited to fast full-text search across billions of rows, so published review text is also indexed into a dedicated search engine such as Elasticsearch or OpenSearch. The relational database remains the source of truth; the search index is a derived, eventually consistent read-optimized copy, kept in sync through the same event stream that drives the aggregation worker. This is a textbook example of the CQRS pattern applied a second time, specifically for the search use case.

14.7 Load Balancing

Load balancers operate at two levels: a global layer that routes users to the nearest healthy region using geo-DNS or anycast, and a regional layer that spreads requests across application instances using health checks and round-robin or least-connections algorithms. The fraud detection service, being stateful with respect to model version, uses consistent routing so that A/B tested model variants see a stable slice of traffic for the duration of an experiment.

15

APIs & Microservices — Service Boundaries and API Design

Each service owns one clearly bounded responsibility and talks to the others only through well-defined APIs or events.

Each service in the architecture owns a single, clearly bounded responsibility, communicating with others only through well-defined APIs or events, never by reaching directly into another service’s database.

15.1 Representative API Surface

Reviews REST API surface
POST   /v1/products/{productId}/reviews
GET    /v1/products/{productId}/reviews?cursor=...&limit=20
GET    /v1/products/{productId}/rating-summary
PATCH  /v1/reviews/{reviewId}
DELETE /v1/reviews/{reviewId}
POST   /v1/reviews/{reviewId}/report
GET    /v1/users/{userId}/reviews
POST   /v1/moderation/reviews/{reviewId}/decision   (internal, moderator-only)

Notice that reading the rating summary is a separate, lightweight endpoint from listing individual reviews. Product pages almost always need the summary immediately and the review list only on demand or on scroll, so splitting these lets the client fetch only what it needs and lets the backend cache the summary far more aggressively than the full review list.

15.2 Pagination

Review lists use cursor-based pagination rather than offset-based pagination. With potentially millions of reviews on a single product, an offset-based LIMIT 20 OFFSET 500000 query would force the database to scan and discard half a million rows on every page. A cursor built from the last seen review’s sort key and ID avoids this entirely.

15.3 Why Microservices Here, Specifically

The submission, read, aggregation, fraud detection, and moderation responsibilities have genuinely different scaling profiles, different failure tolerances, and different teams that typically own them in a large organization. Splitting them into independent services allows the fraud detection team to deploy new model versions daily without touching the read service, and lets the read path be scaled purely for throughput without carrying the operational weight of machine learning infrastructure.

i
What an Interviewer May Ask

“Would you make fraud detection synchronous or asynchronous in the request path, and why?” The expected answer weighs both sides: synchronous would let you block genuinely obvious fraud before it’s ever stored, but at the cost of submission latency and tight coupling to a heavy ML service. The common production answer is a hybrid — cheap, fast rule checks run synchronously to catch the most blatant abuse immediately, while the full ensemble model runs asynchronously.

15.4 Idempotency for Safe Retries

Mobile clients on unreliable networks frequently retry a submission request after a timeout, even though the original request may have actually succeeded on the server. Without protection, this can create duplicate reviews from a single user action. The submission endpoint requires an idempotency key generated by the client for each logical submission attempt; the server stores recently seen keys and returns the original result for a duplicate key instead of creating a second review. This small detail prevents an entire class of confusing duplicate-review bugs that are otherwise very hard to reproduce and debug.

15.5 API Versioning

As the review schema evolves — for example, adding support for video attachments or structured pros-and-cons fields — the API is versioned explicitly in the URL path, and older client versions continue to be served by maintaining backward-compatible response shapes for at least one full deprecation cycle. This matters enormously for a reviews system specifically because mobile app clients cannot be force-upgraded instantly, and a breaking change to the review submission payload would otherwise lock out a meaningful fraction of users overnight.

16

Design Patterns and Anti-Patterns — Patterns That Show Up Repeatedly

These patterns aren’t chosen independently — they compose into a coherent way to keep independent services in agreement.

16.1 Patterns Used

  • CQRS (Command Query Responsibility Segregation). Writes go through the submission service into the sharded database; reads go through a separate service backed by cache and precomputed rollups. The two paths are optimized independently.
  • Event sourcing lite. Review state transitions are driven by a durable event log, which makes it possible to replay history — useful both for rebuilding rollups after a bug and for retraining fraud models on past data.
  • Circuit breaker. Protects downstream dependencies like the database and the ML scoring service from being overwhelmed during partial outages.
  • Strangler pattern for model rollout. New fraud model versions gradually take over a growing percentage of traffic rather than a single hard cutover.
  • Saga-style compensating actions. If a review is later found fraudulent after publication, a compensating event decrements the rollup and re-flags the reviewer’s account, rather than requiring a distributed transaction across services.
  • Outbox pattern. To avoid the classic dual-write problem — where a service writes to its database and then separately publishes an event, risking one succeeding while the other fails — the submission service writes the review and its corresponding event to the same local database transaction, and a separate relay process reads from this outbox table and publishes to Kafka. This guarantees the event is eventually published if and only if the database write actually committed.

These patterns are not chosen independently of each other; they compose. The outbox pattern guarantees an event is reliably published, the event log enables replay for both rollup rebuilding and search index rebuilding, idempotent consumers make redelivery safe, and the saga-style compensating actions handle the cases where a decision needs to be reversed after the fact. Together they form a coherent approach to keeping several independently owned services in agreement without ever needing a single distributed transaction spanning all of them, which would be both slow and fragile at this scale.

16.2 Anti-Patterns to Avoid

  • Computing aggregates live on every read. Does not scale past a small catalog; always precompute and update incrementally.
  • Single monolithic fraud check with no layering. A single text classifier is easy for adversaries to learn and evade; always combine independent signal types.
  • Synchronous fraud scoring blocking submission. Couples user-facing latency to the cost of the heaviest part of the system.
  • Hard-deleting rejected reviews. Destroys the audit trail and the negative training examples the fraud model needs most.
  • Treating all reviews as equally trustworthy in the average. Ignoring verified-purchase status and fraud score when computing the displayed average throws away the most useful trust signal the system has.
Common Mistake

Building fraud detection as an afterthought bolted onto an already-launched reviews feature. Retrofitting behavioural and graph signals after millions of reviews already exist, without having captured device fingerprints or IP history from day one, means losing access to signals that can never be reconstructed retroactively. Fraud resistance needs to be part of the schema and event design from the very first version.

16.3 Bulkhead Isolation

Named after the watertight compartments in a ship’s hull, the bulkhead pattern allocates separate resource pools — thread pools, connection pools, or entirely separate service instances — to different categories of work, so that one overloaded category cannot sink the whole system. In this design, the fraud detection service reserves separate inference capacity for synchronous rule checks versus asynchronous ML scoring, so a sudden burst of expensive ML inference requests cannot starve the fast rule checks that gate initial submission.

16.4 Pattern Cheat-Sheet

PatternWhere it appearsWhat it buys
CQRSWrite path vs read path split; also search indexReads and writes scale independently
OutboxSubmission service → KafkaNo lost events on dual-write failure
Idempotent consumerAggregation worker, search indexerEffectively-once processing on at-least-once delivery
Circuit breakerCache access, ML scoring callsLocalized failure instead of cascading outage
BulkheadFraud rule pool vs ML poolSlow ML calls cannot starve fast rule checks
Saga / compensating actionPost-publication fraud findingReversal without distributed transactions
17

Best Practices & Common Mistakes — Lessons from Running This in Production

Operational discipline is what turns a design that works on paper into a system that stays trustworthy over years.

17.1 Best Practices

  1. Weight verified purchases more heavily than unverified reviews in both the displayed average and the fraud model, since it is the single strongest low-cost trust signal available.
  2. Make the moderation decision explainable. Log which specific signal or rule drove a rejection so appeals can be handled fairly and quickly, and so patterns in false positives are visible.
  3. Keep false-positive rate as a first-class metric, not just fraud catch rate. A system that blocks too many genuine reviewers erodes trust just as much as one that lets too much fraud through.
  4. Design the event schema to capture rich context up front — device fingerprint, IP, session data — even before you have a use for all of it, because reconstructing this after the fact is impossible.
  5. Separate the “is this review fraudulent” decision from the “is this review policy-violating” decision. Offensive but genuine reviews and fraudulent but polite reviews need different handling paths.
  6. Randomly audit a slice of auto-published and auto-rejected reviews continuously, not just when something goes wrong, to catch model drift early.

17.2 Common Mistakes

  • Letting sellers or their close associates see which specific signals trigger fraud flags, which effectively hands adversaries a manual for evading detection.
  • Over-indexing on star rating alone and ignoring review recency — a product whose quality dropped after a manufacturing change can still show an inflated average built from years-old reviews unless recency weighting is applied.
  • Not rate-limiting review edits, which lets a bad actor repeatedly rewrite a review to probe the fraud model’s boundaries.
  • Ignoring the seller’s incentive structure — if a seller can request review removal too easily, genuine negative feedback about real defects gets suppressed, which is a different kind of trust failure from fake positive reviews.
  • Underestimating how quickly adversaries adapt once a detection technique becomes predictable — a rule that catches a fraud pattern today often stops working within weeks once the pattern becomes known, which is exactly why continuous retraining and layered signals matter more than any single clever rule.
  • Failing to distinguish between a genuinely negative but honest review and a malicious review-bombing attack unrelated to the product itself, such as a coordinated pile-on following an unrelated controversy about the company. Both look superficially similar — a burst of low ratings — but require very different handling: the former is valuable signal that should stay visible, while the latter is manipulation that should be filtered from the average even though it is not “fake” in the sense of being written by non-existent customers.

17.3 Organizational Lessons

Beyond the purely technical practices above, teams that run reviews platforms at scale consistently report a few organizational lessons. First, trust and safety cannot be a purely reactive function bolted onto an engineering team’s backlog; it needs dedicated ownership with its own roadmap, metrics, and headcount, because fraud tactics evolve continuously and require sustained attention rather than occasional firefighting. Second, the moderation team and the machine learning team need a tight feedback loop — moderators are the single richest source of high-quality labeled training data, and a moderation tool that does not make labeling fast and easy directly slows down how quickly the fraud model can improve. Third, transparency with genuine users about why their review was delayed or rejected, even in general terms, meaningfully reduces support burden and appeal volume compared to a system that gives no explanation at all. Finally, it is worth remembering that the goal of all this engineering effort is not fraud detection for its own sake, but a shopper’s ability to trust a number on a screen enough to spend real money based on it — every architectural decision in this article, from sharding strategy to graph-based clustering, ultimately exists in service of that one simple, human outcome.

Practical Tip

Make the false-positive rate a top-line trust-and-safety metric on the same dashboard as the fraud catch rate, and treat any deployment that moves it materially in the wrong direction as an incident, not a metric. A model that blocks two percent more genuine reviewers to catch one percent more fake ones is usually a net negative for shopper trust, even though its “fraud caught” number went up.

18

Real-World and Industry Examples — How This Plays Out at Real Companies

Across every one of these examples the same underlying shape recurs, because the underlying problem is the same everywhere.

i
Amazon

Amazon prominently labels “Verified Purchase” reviews, actively pursues legal action against operators of paid fake-review brokerages, and uses machine learning models that analyze reviewer behaviour patterns, not just review text, to detect coordinated manipulation.

i
Yelp

Yelp runs a well-known automated recommendation software system that filters reviews it judges less reliable out of the main displayed average, while still keeping them visible in a separate, less prominent section rather than deleting them outright — a deliberate transparency choice.

i
TripAdvisor

TripAdvisor publishes an annual transparency report detailing how many fake review submissions it detected and blocked, and uses a combination of automated detection and a dedicated content integrity team for borderline cases, reflecting the same automated-plus-human moderation pattern described in this article.

i
App Stores

Mobile app stores combine device and account signals with review timing patterns to catch review-gating and incentivized-review schemes, since a sudden burst of five-star reviews immediately after an app update is a strong, well-known fraud indicator across the industry.

i
Google Maps & Local Reviews

Google’s local review systems combine automated content policy checks with signals derived from a reviewer’s overall history across many locations, since a single account posting extreme one-star or five-star reviews across dozens of unrelated businesses in a short window is treated very differently from an account with a long, varied, organic review history.

i
Flipkart & Regional Marketplaces

Large regional marketplaces operating primarily in markets with high mobile commerce growth face an additional dimension of the fraud problem: a large share of new accounts are genuinely first-time internet shoppers, which can look statistically similar to fraud farm accounts created for review manipulation. This pushes detection systems to lean more heavily on graph and purchase signals rather than account-age heuristics alone, since account age is a much weaker signal in fast-growing markets than in mature ones.

Across every one of these examples, the same underlying shape recurs: a fast, asynchronous ingestion path; layered fraud signals that combine text, behaviour, and relationships rather than relying on any single check; and a human-in-the-loop moderation process for the genuinely uncertain cases. This is not a coincidence — it is the pattern that survives contact with real adversaries at real scale. The specific weighting of each signal, and the thresholds chosen for auto-publish versus auto-reject versus human review, differ by company and by market, but the overall architecture converges again and again on this same layered design because the underlying problem — distinguishing genuine opinions from manufactured ones, at massive volume, without slowing down genuine shoppers — is fundamentally the same everywhere it appears. Studying how these companies each independently arrived at broadly similar architectures is itself a useful exercise for any engineer designing a trust-sensitive system, because convergent design across unrelated organizations facing the same constraints is usually a strong signal that the underlying pattern reflects genuine engineering necessity rather than mere convention.

19

Frequently Asked Questions

The questions that come up most often in design reviews, interviews, and appeals inboxes.

Q1

Why not compute the average rating with a live database query?

Because read volume vastly exceeds write volume, and recomputing an average over potentially millions of rows on every single page view does not scale. Precomputed, incrementally updated rollups turn an expensive aggregation into constant-time arithmetic.

Q2

Is it acceptable for a new review to take a few minutes to appear?

Yes, and in most production systems this delay is intentional. It gives the fraud detection pipeline time to score the review before it can influence the public rating, trading a small amount of freshness for a large amount of trustworthiness.

Q3

Can fake review detection ever be fully automated with no humans involved?

In practice, no. Automated models handle the clear-cut majority of cases at both ends of the confidence spectrum, but the ambiguous middle — and the appeals process for users who believe they were wrongly flagged — needs human judgment to keep the false-positive rate low and maintain user trust.

Q4

How is this different from a general content moderation system?

It overlaps heavily, but reviews add a dimension general content moderation does not always have: the review is tied to a specific commercial transaction and a specific rating number, so beyond “is this content policy-violating,” the system also has to answer “does this rating and text represent a genuine, unbiased opinion from someone who actually experienced the product.”

Q5

Why shard by product_id instead of user_id?

Because the dominant query pattern is “fetch all reviews for this product,” which stays fast when all of a product’s reviews live on one shard. Fetching a single user’s review history is comparatively rare and can be served through a separate secondary index without needing to shard by user.

Q6

How should a brand-new product with only two reviews display its rating?

Rather than showing a raw average of just two data points, the platform blends the product’s small sample with a category-wide prior using a Bayesian weighted average, described earlier in the scalability section. This produces a rating that is honest about low confidence without hiding the rating entirely, and it naturally converges to the true average as more genuine reviews accumulate.

Q7

What happens if a review is flagged as fraudulent after it has already influenced the displayed rating for weeks?

The aggregation worker applies a compensating event that subtracts the flagged review’s contribution from the rollup, exactly mirroring how it would handle a normal deletion. Because the raw review row was never physically deleted, the audit trail also preserves a record that the rating changed as a result of a later fraud finding, which supports transparency reporting and appeals.

Q8

Should the same fraud thresholds apply uniformly to every product category?

No. Categories differ enormously in typical review volume, price point, and incentivized-review prevalence — a low-cost impulse-buy category naturally sees more high-velocity review bursts than an expensive appliance category. Thresholds and even model versions are commonly tuned per category so that normal behaviour in a high-velocity category is not constantly misclassified as suspicious.

Q9

How does the system avoid two nodes both thinking they are the database leader after a failover?

By relying on a proven consensus protocol, typically Raft, either built into the database or provided by an external coordination service, which guarantees that a new leader is only recognized once a majority of nodes agree, preventing the split-brain scenario where conflicting writes could be accepted by two different nodes simultaneously.

Q10

Why does the aggregation worker need idempotent event processing?

Because the underlying message queue provides at-least-once delivery, meaning the same event can occasionally be redelivered after a consumer crash. Without idempotency, a redelivered increment event would double-count a review in the rollup. Tracking already-processed event identifiers turns an at-least-once guarantee into effectively-once behaviour for the purposes of the aggregate counts.

20

Summary & Key Takeaways

The core ideas, distilled into a small set of principles you can carry into your next design review.

Key Takeaways
  • Separate the fast, synchronous write path from the slower, asynchronous fraud and moderation pipeline using a durable event queue.
  • Never compute rating averages live at read time — maintain incrementally updated rollups and cache them aggressively.
  • Fake review detection must layer multiple independent signal types — text, behaviour, graph relationships, and purchase history — because no single signal is robust against a determined adversary.
  • Keep humans in the loop for uncertain cases, and keep false-positive rate as important a metric as fraud catch rate.
  • Design the event and schema layer from day one to capture the rich contextual data that fraud detection will eventually need, since it cannot be reconstructed retroactively.
  • Treat availability of the read path as non-negotiable, using caching, circuit breakers, and graceful degradation so a failure in fraud scoring or moderation never breaks the shopper-facing product page.
  • Make deliberate, distinct consistency choices for each category of data — strong consistency for an individual submitted review, eventual consistency for aggregate rollups, and delayed asynchronous processing for fraud verdicts — rather than applying one uniform consistency policy across the entire system.

20.1 The One-Paragraph Design Story

A shopper taps a product page and sees a star rating. That number is served from Redis, updated by an aggregation worker that consumes review events from Kafka. When another shopper submits a review, the API gateway authenticates and rate-limits them, the submission service verifies the purchase and writes the review as pending, and immediately returns 202 Accepted. The event flows onto Kafka, where the fraud detection service scores it using a layered ensemble of text, behavioural, graph, and purchase signals. Depending on the score, the review is auto-published, sent to a human moderator, or auto-rejected. If published, the aggregation worker updates the rollup, invalidates the cache, and the next shopper who loads the page sees a fresh number — typically within seconds. Every layer of this system exists to keep that experience fast, trustworthy, and resilient.

Final Thought

The goal of every architectural choice in this article is not fraud detection or throughput for its own sake. It is a shopper’s ability to trust a small number on a screen enough to spend real money based on it. Everything else — the sharding, the queues, the graph algorithms, the moderation queue — exists in service of that one human outcome.

Leave a Reply

Your email address will not be published. Required fields are marked *