Architecture Review: Two-Sided Marketplace Platform
A two-sided marketplace architecture serving buyers, sellers, listings, transactions, search, and notifications from a shared infrastructure, where multiple independent domains must coordinate without tight coupling. Event sourcing captures every state transition; the saga pattern orchestrates multi-step transactions (create order, reserve inventory, charge payment, notify seller) with compensating transactions for partial failures. Kafka decouples domain event publication from consumption; RabbitMQ handles notification fanout; Elasticsearch serves listing search; Redis caches listing display and session state.
Evidence Confidence
Moderate
strong
Executive Summary
Two-Sided Marketplace Platform: moderate operational readiness (80% evidence confidence). 0 architectural strengths identified, 5 operational risks to manage. Primary concern: Cascading Failure. Requires Advanced operational maturity.
Readiness Rationale
Overall moderate readiness across 8 dimensions. Limited: scaling, team maturity. Strong: migration, observability, failure recovery.
Key Concerns
- !Cascading Failure
- !Hot Partition
Key Strengths
- +Architecture is well-defined for the marketplace platform problem profile
8
Assessments
5
Tradeoffs
6
Sections
11
Recommendations
Readiness Assessments
8Architectural Tradeoffs
5Recommendations
11Monitor: Hot Partition
risk_monitoringOne partition (a database shard, a Kafka topic partition, a Redis hash slot) receives traffic so far above its peers that it saturates while the others sit idle. Aggregate capacity looks healthy, but the hot partition throttles or lags, and everything routed to it degrades. The cause is skew in how keys map to partitions, and the fix depends on whether the skew is spread across many keys or concentrated in one.
Affects 1 node. (Marketplace Mixed)
Monitor: Cascading Failure
risk_monitoringA failure or degradation in one service causes increased load, held resources, or error propagation in its callers, which in turn degrade their callers, until the failure front propagates through the entire dependency graph and brings down services with no direct dependency on the original failure point.
Affects 0 nodes
Implement: Monitor read hotspot signals
observabilitySeed 'Read Hotspot Saturation' identifies 3 metrics relevant to hot_partition. Execution preview confirms this risk manifests under modelled load.
Metrics to instrument: partition_qps, p99_latency_ms, cache_hit_rate
Monolithic marketplace application with single database → Event-driven marketplace with Kafka + saga-based checkout flow
migration_planningTrigger: Checkout failures from payment provider unavailability causing full transaction rollback and user-facing errors; need for asynchronous notification delivery; listing search performance insufficient from PostgreSQL full-text search. Migrate from 'Monolithic marketplace application with single database' to 'Event-driven marketplace with Kafka + saga-based checkout flow'. Introduce the outbox pattern and Kafka event publishing before the saga orchestration layer. Validate event delivery reliability before building compensating transaction logic on top of it.
Saga implementation requires designing and testing all compensation paths: untested compensation logic fails exactly when it is most needed; Kafka adds operational complexity that small teams may not be ready to operate
PostgreSQL full-text search for listing discovery → Elasticsearch for listing search with CDC-based indexing
migration_planningTrigger: Listing search p99 > 1s; faceted navigation (category + price + location + rating) not supportable in PostgreSQL without full-table scans; ranking algorithm requiring feature vectors that PostgreSQL cannot efficiently support. Migrate from 'PostgreSQL full-text search for listing discovery' to 'Elasticsearch for listing search with CDC-based indexing'. Run the Elasticsearch index in shadow mode (populated but not serving traffic) for 2 weeks before cutting over search traffic. Validate that listing updates propagate within the expected SLA window during the shadow period.
Elasticsearch index must be initially populated from PostgreSQL before CDC takes over: initial sync must complete without data loss; Search index staleness during CDC consumer lag must be explicitly communicated in the search UX
Prepare runbook for: Burst Traffic Cold Cache Stampede
simulation_preparednessSimulation demonstrates critical degradation of redis, postgresql
Without a runbook, recovery from this failure mode will be ad-hoc
Prepare runbook for: Connection Pool Exhaustion with Horizontal User Scale
simulation_preparednessSimulation demonstrates critical degradation of postgresql
Without a runbook, recovery from this failure mode will be ad-hoc
Plan evolution: OLTP Analytics Queries → OLTP + OLAP Separation
evolution_planningEvolution from Unified OLTP + Analytics on PostgreSQL → Separated OLTP (PostgreSQL) + OLAP (ClickHouse/Snowflake)
Migration complexity: medium. Rollback: always.
Plan evolution: Single Cache Layer → Distributed Cache
evolution_planningEvolution from Single Redis Node / Sentinel Cluster → Distributed Redis Cluster (Consistent Hash Ring)
Migration complexity: medium. Rollback: complex.
Monitor threshold: Tier 1: Viral Listing Thundering Herd
scaling_monitoringSignal: Redis cache miss spike visible in monitoring; PostgreSQL query rate spiking for listing reads despite stable write volume; p99 listing API latency > 500ms during traffic spike events
Bottleneck: Cache TTL expiry on hot listings during peak traffic: all concurrent requests bypass cache simultaneously. Evolution: Implement staggered TTL jitter on listing cache entries; use probabilistic early refresh (refresh before TTL expiry when remaining TTL < 20% and request rate is high); implement single-flight/request coalescing at the application layer to collapse concurrent cache misses into a single database read
Monitor threshold: Tier 2: Checkout Saga Contention
scaling_monitoringSignal: Saga compensation events appearing in order event log; checkout p99 > 2s; pg_locks showing contended rows on inventory_reservations table; idempotency key conflicts increasing in payment service logs
Bottleneck: Concurrent checkout transactions competing for the same inventory rows; saga timeout thresholds too aggressive. Evolution: Increase inventory reservation table partition count; tune saga step timeout to 2x the observed p99 for each step under load; implement a per-listing checkout serialization queue to prevent N concurrent sagas competing for the same inventory
Scaling Pressure Signals
8Redis cache miss spike visible in monitoring; PostgreSQL query rate spiking for listing reads despite stable write volume; p99 listing API latency > 500ms during traffic spike events
Threshold
Tier 1: Viral Listing Thundering Herd
Likely Bottleneck
Cache TTL expiry on hot listings during peak traffic: all concurrent requests bypass cache simultaneously
Recommended Evolution
Implement staggered TTL jitter on listing cache entries; use probabilistic early refresh (refresh before TTL expiry when remaining TTL < 20% and request rate is high); implement single-flight/request coalescing at the application layer to collapse concurrent cache misses into a single database read
Saga compensation events appearing in order event log; checkout p99 > 2s; pg_locks showing contended rows on inventory_reservations table; idempotency key conflicts increasing in payment service logs
Threshold
Tier 2: Checkout Saga Contention
Likely Bottleneck
Concurrent checkout transactions competing for the same inventory rows; saga timeout thresholds too aggressive
Recommended Evolution
Increase inventory reservation table partition count; tune saga step timeout to 2x the observed p99 for each step under load; implement a per-listing checkout serialization queue to prevent N concurrent sagas competing for the same inventory
RabbitMQ queue depth > 100k messages; notification delivery latency > 5 minutes; downstream notification provider (SendGrid, FCM) rate limit errors in consumer logs; dead-letter queue receiving messages from retry exhaustion
Threshold
Tier 3: Notification Queue Backlog
Likely Bottleneck
Notification consumer throughput insufficient for event fanout rate; or downstream provider rate limiting
Recommended Evolution
Add notification consumer replicas; implement consumer-side rate limiting against downstream provider quotas; tune RabbitMQ prefetch count to prevent consumer overload on recovery; implement dead-letter queue with manual review tooling
Database connection pool exhausted by combination of checkout + search + listing writes all competing for the same PostgreSQL pool; single PostgreSQL primary CPU > 80% sustained; domain boundaries in code becoming unclear as direct table access crosses service lines
Threshold
Tier 4: Domain Service Decomposition Pressure
Likely Bottleneck
Shared PostgreSQL primary unable to serve multiple domain workloads simultaneously without resource contention
Recommended Evolution
Decompose into separate PostgreSQL databases per domain (listings, orders, payments, users) using the database-per-service pattern; each domain has its own connection pool; cross-domain data access goes through events, not direct database queries
Redis cache miss spike visible in monitoring; PostgreSQL query rate spiking for listing reads despite stable write volume; p99 listing API latency > 500ms during traffic spike events
Threshold
Escalation trigger: Cache TTL expiry on hot listings during peak traffic: all concurrent requests bypass cache simultaneously
Likely Bottleneck
Tier 1: Viral Listing Thundering Herd
Recommended Evolution
Monitor: partition_qps, p99_latency_ms, cache_hit_rate
Saga compensation events appearing in order event log; checkout p99 > 2s; pg_locks showing contended rows on inventory_reservations table; idempotency key conflicts increasing in payment service logs
Threshold
Escalation trigger: Concurrent checkout transactions competing for the same inventory rows; saga timeout thresholds too aggressive
Likely Bottleneck
Tier 2: Checkout Saga Contention
Recommended Evolution
Monitor: partition_qps, p99_latency_ms, cache_hit_rate
RabbitMQ queue depth > 100k messages; notification delivery latency > 5 minutes; downstream notification provider (SendGrid, FCM) rate limit errors in consumer logs; dead-letter queue receiving messages from retry exhaustion
Threshold
Escalation trigger: Notification consumer throughput insufficient for event fanout rate; or downstream provider rate limiting
Likely Bottleneck
Tier 3: Notification Queue Backlog
Recommended Evolution
Monitor: partition_qps, p99_latency_ms, cache_hit_rate
Database connection pool exhausted by combination of checkout + search + listing writes all competing for the same PostgreSQL pool; single PostgreSQL primary CPU > 80% sustained; domain boundaries in code becoming unclear as direct table access crosses service lines
Threshold
Escalation trigger: Shared PostgreSQL primary unable to serve multiple domain workloads simultaneously without resource contention
Likely Bottleneck
Tier 4: Domain Service Decomposition Pressure
Recommended Evolution
Monitor: partition_qps, p99_latency_ms, cache_hit_rate
Migration Readiness
12Migration Stages
3Monolithic marketplace application with single database → Event-driven marketplace with Kafka + saga-based checkout flow
infoMigration trigger: Checkout failures from payment provider unavailability causing full transaction rollback and user-facing errors; need for asynchronous notification delivery; listing search performance insufficient from PostgreSQL full-text search
PostgreSQL full-text search for listing discovery → Elasticsearch for listing search with CDC-based indexing
infoMigration trigger: Listing search p99 > 1s; faceted navigation (category + price + location + rating) not supportable in PostgreSQL without full-table scans; ranking algorithm requiring feature vectors that PostgreSQL cannot efficiently support
Monolithic PostgreSQL serving all domain writes → Domain-separated databases with event-based cross-domain data propagation
infoMigration trigger: Domain teams stepping on each other's schema migrations; database resource contention across domains (listing writes vs checkout transactions vs analytics); need to independently scale checkout volume without scaling listing read capacity
Risks
9Saga implementation requires designing and testing all compe
warningSaga implementation requires designing and testing all compensation paths: untested compensation logic fails exactly when it is most needed
Kafka adds operational complexity that small teams may not b
warningKafka adds operational complexity that small teams may not be ready to operate
Elasticsearch index must be initially populated from Postgre
warningElasticsearch index must be initially populated from PostgreSQL before CDC takes over: initial sync must complete without data loss
Search index staleness during CDC consumer lag must be expli
warningSearch index staleness during CDC consumer lag must be explicitly communicated in the search UX
Cross-domain queries that were previously JOIN operations mu
warningCross-domain queries that were previously JOIN operations must become event-driven denormalized data or API calls: significant application refactoring required
Domain event schema contracts must be versioned and maintain
warningDomain event schema contracts must be versioned and maintained: breaking changes require coordinated multi-service deployment
Projection lag creates a read-after-write window where users
criticalProjection lag creates a read-after-write window where users see stale data after their own writes. Mitigation: Route immediate post-write reads to the write store (session-scoped write token); accept eventual consistency only for non-user-initiated reads
↗ direct-db-to-cqrs
Projection rebuild after schema change can take hours or day
criticalProjection rebuild after schema change can take hours or days on large datasets. Mitigation: Design blue/green projection deployment: build new projection in parallel before switching traffic; test rebuild time in staging
↗ direct-db-to-cqrs
Cross-service workflows that previously used database transa
criticalCross-service workflows that previously used database transactions now require Saga orchestration. Mitigation: Design idempotent event handlers; implement compensating transactions for every multi-step workflow; test failure injection in staging
↗ modular-monolith-to-event-driven
Review Sections
6Referenced Intelligence