DBRaven
Governance

Governance Policies

10 policies

Deterministic policy definitions used to detect architecture governance violations across all scenarios. Each policy carries detection rules, operational risk analysis, and structured mitigation guidance.

1

critical

5

high

4

moderate

0

low

0

info

Analytics Workload Interference with OLTP

Operational Complexity2 rules
High

Running analytical queries against the same PostgreSQL instance that serves OLTP traffic causes query plan interference, buffer cache thrashing, and lock contention. Analytical queries scan large row ranges; OLTP queries require point lookups. These access patterns are fundamentally incompatible at scale and must be separated before the interference causes P99 degradation.

Operational Risks

  • ·Analytical sequential scans evict OLTP hot data from shared buffer cache
  • ·Long-running analytical transactions hold row-level locks, blocking OLTP writes
  • ·Autovacuum triggered by analytical write-heavy periods degrades OLTP QPS

Mitigation

  • Route all analytical queries to a dedicated read replica using pg_replica_routing
  • Introduce a dedicated analytics store (columnar database, data warehouse) for heavy aggregations

PostgreSQL's shared buffer cache is finite. An analytical query that performs a sequential scan across millions of rows will evict hot OLTP data from the buffer cache. Subsequent OLTP reads that expect cache-resident data miss and go to disk. This is invisible in query plans: the interference shows up only as unexplained P99 latency spikes that correlate with report generation windows.

postgresqloltp vs olapbtree indexing

Cache Invalidation Exposure

Consistency2 rules
Moderate

Caching layers without explicit invalidation strategies introduce silent data staleness. The risk compounds when cache TTLs are long, write rates are high, or cache warm-up after a flush causes simultaneous database load spikes (cache stampede). Cache invalidation is consistently one of the hardest operational problems in distributed caching architectures.

Operational Risks

  • ·TTL expiry causes stale reads for up to TTL seconds after every database write
  • ·Cache stampede on flush or mass-expiry spikes database load suddenly
  • ·Missing invalidation on write path causes indefinitely stale cache entries

Mitigation

  • Use delete-on-write (cache-aside) rather than update-on-write to avoid race conditions
  • Add TTL jitter to prevent coordinated expiry of simultaneously-populated keys

Cache staleness is invisible by design: the application successfully serves data from cache without knowing whether that data reflects the current database state. Under TTL-based expiry, staleness window is bounded but non-zero. Under event-driven invalidation, missed invalidation events cause unbounded staleness. Either approach requires explicit operational discipline.

redispostgresqlcache invalidation

Excessive Synchronous Coupling

Coupling2 rules
High

Synchronous call chains that span more than 2-3 service boundaries create cascading latency exposure. When any downstream component degrades, the entire synchronous chain stalls. This is one of the most common contributors to unexpected P99 latency spikes and cascading failure in distributed systems.

Operational Risks

  • ·Latency compounds multiplicatively across synchronous chain depth
  • ·Any component timeout propagates immediately to all upstream callers
  • ·Circuit breakers must be tuned per-hop: missing one creates a blast radius gap

Mitigation

  • Introduce async boundaries for non-critical paths (event publication, audit logs)
  • Add bulkheads between high-priority and low-priority synchronous paths

A synchronous call chain of depth N means the total latency is the sum of all component latencies, not the max. At P99, this compounds severely. If each component has a 50ms P99 latency, a 5-hop chain has a theoretical P99 of 250ms : before accounting for retries, connection overhead, or any component degrading. As the chain grows, blast radius grows proportionally.

postgresqlrediscache invalidationreplication lag

Hot Partition Concentration Risk

Scalability2 rules
High

Partition key designs that concentrate traffic on a small number of partitions negate the horizontal scaling benefits of sharding or partitioned systems. A hot partition creates a throughput ceiling that cannot be solved by adding more nodes: the bottleneck is the key distribution, not the node count.

Operational Risks

  • ·Hot partition creates throughput ceiling regardless of how many nodes are added
  • ·Hot partition causes disproportionate resource utilization on specific nodes
  • ·Consumer lag concentrates on hot partition, causing uneven processing

Mitigation

  • Analyze actual access patterns before choosing partition key: use percentile distribution
  • Add random suffix (salting) to hot keys to distribute across multiple partitions

Partition hotspots emerge from natural data access patterns: user activity follows power-law distributions, popular events get more comments, recent time partitions receive all writes. A partition key based on user_id works until your top 1% of users generate 60% of requests. Identifying hotspots requires analysis of actual access patterns, not just schema review.

kafkapostgresqlpartition hotspotskafka consumer lag

Observability Coverage Gap

Observability2 rules
Moderate

Distributed architectures without instrumentation across all integration boundaries create blind spots during incidents. Each un-instrumented boundary adds mean time to diagnosis. Observability is not a post-launch concern : the integration points that are hardest to instrument are the same ones most likely to fail and hardest to debug.

Operational Risks

  • ·Integration boundary failures are invisible without per-boundary instrumentation
  • ·Latency attribution is impossible without distributed tracing across call chains
  • ·Queue consumer health requires explicit group lag monitoring: not just broker health

Mitigation

  • Instrument every integration boundary: DB connection pool, cache, event stream, service call
  • Define SLIs before launch: latency P50/P99, error rate, saturation per component

When an incident occurs, time to diagnosis is dominated by the number of unknown states in the system. An un-monitored Kafka consumer group means "consumer is alive" is an assumption, not a known fact. An un-traced cross-service call means latency attribution is guesswork. Observability gaps don't cause incidents: they extend them and prevent learning from them.

kafkaredispostgresqlkafka consumer lagreplication lag

Operational Maturity Mismatch

Team Maturity2 rules
High

Architectures that require senior or expert team maturity to operate safely create hidden operational risk when the team has not yet built that capability. Distributed systems, CQRS, event sourcing, and multi-region deployments each carry substantial operational burden that only becomes manageable with deep experience. Deploying them prematurely is a governance risk.

Operational Risks

  • ·Incident response in unfamiliar distributed systems is slower and less effective
  • ·Debugging distributed failures requires deep understanding of each component's behavior
  • ·Operational runbooks are harder to write and more likely to be incomplete

Mitigation

  • Audit team maturity level against architecture requirements before deployment
  • Run operational simulations and fire drills before relying on complex patterns in production

The operational burden of complex distributed architectures is not felt during initial deployment: it accumulates during incidents. A team that has not operated Kafka at scale will not know how to debug consumer lag or topic compaction behavior under incident conditions. Architecture should match the team's actual operational capabilities, not aspirational ones.

kafka consumer lagcqrs operationaleventual consistency

Replication Lag Consistency Exposure

Consistency2 rules
Moderate

Read replicas introduce replication lag that creates silent stale-read windows. Lagged replicas serve data that may be seconds or minutes behind the primary. Applications that read from replicas without awareness of lag constraints can make incorrect decisions based on outdated state. The risk is highest for post-write reads, inventory checks, and financial operations.

Operational Risks

  • ·Read-after-write violations: user reads own write and sees old data from lagged replica
  • ·Inventory or quota decisions made against stale replica data cause consistency violations
  • ·Lagged replica under load falls further behind: lag is self-compounding under pressure

Mitigation

  • Monitor replica lag as a primary alert: lag > 5s should trigger investigation
  • Route post-write reads to primary within the session (sticky read-after-write)

PostgreSQL streaming replication under normal conditions maintains sub-second lag. Under write-heavy load, network saturation, or primary CPU pressure, lag can grow to seconds or minutes. Without explicit lag monitoring, applications serve stale data silently. Read-after-write consistency violations: where a user reads their own write and gets old data: are particularly damaging to user trust.

postgresqlreplication lageventual consistency

Shared Database Ownership Risk

Data Ownership2 rules
Critical

Multiple services writing to the same database schema create an implicit distributed monolith. Schema changes require coordinating deployments across all consumers. Performance degradation is shared. A single service's query pattern can degrade all other services. This is the most common architectural decision that forecloses future migration options.

Operational Risks

  • ·Schema migration must coordinate deployment across all services using the shared database
  • ·One service's long-running query blocks or degrades all other services' connections
  • ·Database performance tuning is impossible to optimize for one service without degrading others

Mitigation

  • Establish logical ownership boundaries even within a shared database (schema-per-service)
  • Introduce read-only access boundaries for consumers that only need to read

A shared database is not a microservices architecture: it is a monolith with network overhead. The database becomes a coordination bottleneck for schema evolution, performance tuning, and deployment. Once established, this coupling is extraordinarily expensive to remove: data must be migrated, APIs established between services, and all cross-schema queries rewritten as API calls.

postgresqlcqrs operationaleventual consistency

Single-Region Resiliency Weakness

Resilience2 rules
Moderate

Architectures deployed entirely within a single cloud region have no protection against regional availability zone failures, regional network partitions, or full region outages. While these events are rare, their blast radius is total : every component fails simultaneously. The decision to remain single-region must be explicit and tied to acceptable downtime SLAs.

Operational Risks

  • ·Regional outage causes total system unavailability with no automatic failover
  • ·AZ failure without multi-AZ deployment causes partial or total service disruption
  • ·RTO during regional recovery is unpredictable: depends on cloud provider restoration

Mitigation

  • Define explicit RTO/RPO targets and validate them against single-region failure scenario
  • Deploy across minimum 2-3 AZs within the region for AZ-level fault tolerance

Cloud region availability zones provide partial blast radius isolation, but AZ failures do occur. A single-region deployment cannot tolerate regional-level network partitions. For many SaaS applications, a single-region deployment is an acceptable risk tradeoff given cost and operational complexity. The governance concern is ensuring this tradeoff is explicit, not inadvertent.

postgresql

Unbounded Queue Growth Risk

Reliability2 rules
High

Message queues or event streams that grow unboundedly under producer-consumer imbalance create memory pressure, increased recovery time, and operational ambiguity about whether the consumer is alive and processing. Backlog management must be designed in advance: retroactively adding it is operationally painful.

Operational Risks

  • ·Consumer falling behind causes unbounded memory growth on broker nodes
  • ·Backlog catchup during recovery window can exceed SLA for downstream systems
  • ·Dead consumer is invisible without explicit consumer group lag monitoring

Mitigation

  • Monitor consumer group lag as a primary operational alert: not just throughput
  • Define explicit dead letter queues for messages that exceed retry budget

A growing queue is an asynchronous time bomb. Consumer lag that doubles every hour will overflow within hours on a fixed-memory broker. Even elastic brokers face increased consumer recovery time: catching up on days of backlog can take hours, during which downstream systems serve stale data. Without explicit backlog monitoring and alerting, queue growth goes undetected until it's an incident.

kafkakafka consumer lagqueue backlog