Building a Staleness Detection System for Job Postings
System DesignModel answerLast updated
Design a system to identify and handle outdated job listings through signal aggregation, graduated enforcement, and employer dispute resolution.
Context
Online job platforms face a persistent challenge: employers often forget to close job postings after hiring or canceling positions. These outdated listings frustrate job seekers, clutter search results, and reduce platform quality. Your task is to design a production system that automatically detects and manages stale postings while giving employers a fair chance to correct mistakes.
Your Task
Design an end-to-end staleness management system that:
Core Capabilities
- Collects diverse freshness indicators: Aggregate signals from multiple sources—job seeker complaints ("this role is filled"), recruiter engagement patterns (login frequency, application reviews), third-party applicant tracking system (ATS) feeds, and automated career page monitoring.
- Computes staleness with progressive action: Convert raw signals into a staleness metric that drives incremental consequences:
Active→Demoted in Rankings→Hidden from Search(but accessible via direct URL) →Archived. - Enables instant dispute resolution: When an employer claims "we're still hiring," immediately reverse the demotion with search visibility restored in seconds, not minutes.
- Maintains complete transparency: Log every decision with full reasoning—which signals triggered what action—so disputes can be investigated and models can be improved.
Scale Constraints
- Volume: 50 million live job postings; 2 billion in historical archives. Process 150 million daily events from users and systems.
- Performance: Employer disputes must restore search ranking within 2 seconds. Automated state changes should reach search infrastructure in under 5 minutes.
- Reliability: Avoid catastrophic false positives—if a monitoring pipeline fails, don't accidentally hide thousands of valid jobs.
What to Cover in Your Design
- System Architecture: How signals flow from sources through processing to enforcement. Choose between streaming and batch where appropriate.
- Data Structures and State Logic: Define the state transition rules, storage schemas for time-series signals versus current status, and audit trail format.
- Key Interfaces: Sketch the critical APIs for signal submission, employer appeals, and administrative review.
- Robustness Strategies: Explain how you'll detect and prevent mass false positives, handle contradictory signals, and keep search indexes synchronized.
Hints
Hint 1
Separate signal collection and scoring from enforcement decisions—this isolation lets you test new detection algorithms without accidentally demoting real jobs
Hint 2
Think carefully about what happens when data sources go offline; treating missing recruiter activity as proof of abandonment could cause cascading failures
Hint 3
Implement rate-limiting safeguards that pause bulk demotions when anomaly thresholds are exceeded, requiring human confirmation before proceeding
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Model Answer: Staleness Detection System Design
1. Requirements Analysis and Capacity Planning
Begin by establishing the risk profile. The asymmetry matters: incorrectly hiding a paying customer's active job posting causes immediate revenue and reputation damage, while leaving a stale posting visible for an extra week is a minor quality issue. This imbalance should inform every design choice—we optimize for precision over recall.
Capacity estimates:
- Event throughput: 150M events daily averages to ~1,750/sec, with peak loads around 8,750/sec (5x multiplier). A single Kafka cluster with appropriate partitioning handles this comfortably.
- Active state storage: 50M postings × ~1KB each = ~50GB of hot state, easily fitting in a partitioned key-value store like DynamoDB or Cassandra.
- Historical audit data: 2B postings × 5 lifecycle events × 500 bytes ≈ 5TB of append-only logs, suitable for columnar storage (Parquet on S3) or a specialized OLAP store.
- Scoring frequency: Evaluating 50M postings hourly means ~14K evaluations/sec. Event-driven evaluation combined with periodic time-decay sweeps is more efficient.
2. API Surface
POST /signals/ingest
Body: {posting_id, signal_source, signal_type, value, timestamp, dedup_key}
Response: 202 Accepted
POST /postings/{id}/dispute
Body: {employer_id, confirmation_token?, notes}
Response: 200 {current_state: "ACTIVE", previous_state: "HIDDEN", immunity_expires: "2025-04-15"}
GET /postings/{id}/freshness
Response: {state, confidence_score, primary_indicators: [...], last_updated}
GET /admin/postings/{id}/history?start_date=&end_date=
Response: {events: [{timestamp, state_transition, trigger_reason, signal_breakdown}]}
POST /admin/circuit-breakers/{scope}/override
Body: {action: "APPROVE" | "REJECT", affected_count, justification}
Design rationale:
- Deduplication: Crawlers and ATS integrations retry, so signal ingestion uses idempotency keys to prevent duplicate processing.
- Synchronous disputes: The dispute endpoint returns immediately after updating state and cache, triggering async index propagation. Email-based disputes use time-limited signed tokens for authentication.
3. Data Models and State Transitions
Signal storage (time-series):
Ingest raw signals to Kafka, then persist in a time-partitioned analytics store (Apache Pinot or TimescaleDB) keyed by (posting_id, source, timestamp). The stream processor maintains materialized aggregates per posting:
- Last recruiter login timestamp
- Application review count (7-day window)
- "Position filled" report count (weighted by reporter credibility)
- Most recent career page crawl result
Current state (strongly consistent per posting):
posting_status {
posting_id (PK),
current_state ENUM(ACTIVE, DEMOTED, HIDDEN, ARCHIVED),
previous_state,
freshness_score FLOAT,
model_version INT,
state_entered_at TIMESTAMP,
immunity_until TIMESTAMP,
dispute_count INT,
optimistic_lock_version INT
}
Audit log (append-only, immutable):
state_change_event {
event_id UUID,
posting_id,
sequence_num INT,
timestamp,
from_state,
to_state,
trigger_type ENUM(AUTOMATED_SCORE, EMPLOYER_DISPUTE, MANUAL_OVERRIDE, SAFETY_RELEASE),
freshness_score FLOAT,
model_version,
policy_version,
signal_contributions [{source, type, value, influence_weight}],
actor_id (for disputes/overrides)
}
State machine rules:
- Forward progression:
ACTIVE → DEMOTED → HIDDEN → ARCHIVED. Each transition requires minimum dwell time (e.g., 72 hours) to allow employer reaction. - Dispute reversion: Any state →
ACTIVEon successful dispute. Setsimmunity_until(e.g., 30 days forward) preventing automated demotion unless authoritative signals (ATS closure) arrive. - Direct archival: Jump to
ARCHIVEDonly for definitive signals like ATS status "requisition closed" or explicit employer closure.
State updates use optimistic locking (compare-and-swap on version). Audit events and state changes write atomically via transactional outbox or distributed transaction.
4. Architecture Components
Signal Ingestion Pipeline:
Multiple producers (job seeker reports, messaging analytics, recruiter activity trackers, ATS webhooks, web crawlers) publish to Kafka topics partitioned by posting_id. An ingestion validator handles deduplication, attaches source health metadata, and applies rate limits (e.g., max 3 reports per user per posting per day to prevent abuse).
Stream Aggregation (Flink/Kafka Streams):
Maintains per-posting feature vectors and computes freshness scores. Emits ScoreComputed(posting_id, score, feature_snapshot, model_version) events but takes no enforcement action. This separation enables shadow deployment of new models and safe replay after outages.
Batch Recalculation (Spark): Daily jobs handle three concerns:
- Apply time-decay to postings without recent events
- Train/calibrate scoring models using ground truth (confirmed hires, dispute outcomes as false-positive labels)
- Backfill after pipeline outages or model updates
Policy Enforcement Service:
Consumes score events, applies business rules (score thresholds, minimum dwell times, immunity periods), and proposes state transitions. All proposals route through the circuit breaker before committing. On approval, writes state change plus audit log atomically and publishes PostingStateChanged events.
Search Index Sync:
Search infrastructure (Elasticsearch/OpenSearch) and recommendation feature stores consume PostingStateChanged with 5-minute propagation SLA. Disputes trigger priority updates via a fast path.
Employer Notification: Before each demotion step, emails employer with one-click confirmation link: "Is this position still open?" Reduces disputes by catching mistakes proactively.
5. Critical Design Details
Scoring Approach: Model staleness as P(position_closed | observed_signals). Use a survival model baseline calibrated by occupation, seniority level, location, and employer historical time-to-fill. Layer evidence adjustments:
- Recruiter inactivity (weighted by role)
- Unreviewed application backlog growth
- "Filled" reports (weighted by reporter reputation score)
- Career page status and ATS feed data
Crucial principle: Treat missing data as unknown, never as negative evidence. If recruiter activity telemetry stops flowing due to upstream failure, mask that feature entirely rather than interpreting absence as inactivity.
Handling Conflicting Evidence: Establish source authority hierarchy:
- Definitive: Direct employer action, ATS status changes
- Strong: Recent recruiter engagement with applications
- Weak: Career page crawls, job seeker reports (require corroboration)
Example: A 404 crawl result paired with yesterday's application review activity → no action taken.
Circuit Breakers (Preventing Cascading Failures): Monitor proposed demotions across multiple dimensions (global rate, per-employer rate, per-signal-source rate, per-crawler-domain rate) in sliding time windows. Compare against historical baselines with seasonal adjustment. If any scope exceeds 3 standard deviations or hard limits (e.g., >15% of one employer's postings in one hour):
- Trip circuit breaker
- Queue proposed transitions for review
- Alert on-call engineers
- Require manual approval or wait for automated source health recovery
Additional safeguards:
- Per-source health monitoring (crawler success rate, telemetry volume versus baseline) gates whether that source's signals are used
- Job seeker reports weighted by account age/history, capped per posting to mitigate coordinated manipulation
Sub-2-Second Dispute Resolution: Dispute requests bypass async queues:
- Authenticate and validate request
- Update posting state with optimistic lock (single DB write)
- Invalidate CDN and application cache (via cache tags)
- Trigger priority index update (out-of-band fast path)
- Return success to employer
Search index propagation happens asynchronously but on priority queue. Most users see restoration immediately via cache invalidation; search visibility follows within seconds.
Index Synchronization Strategy: Maintain eventual consistency between operational database and search indexes via event sourcing. Search consumers track last-processed event offset. On lag spikes:
- Priority queue for disputes and employer-initiated changes
- Batch processing for automated bulk transitions
- Periodic reconciliation job compares database snapshots to index state and repairs drift
6. Key Trade-offs
Precision vs. Recall: System heavily favors precision (avoiding false positives) over recall (catching every stale posting). Better to leave some stale postings visible than incorrectly hide active ones.
Real-time vs. Batch: Hybrid approach uses streaming for immediate signal processing and near-real-time scores, with batch layer for time-decay, model training, and recovery. Streaming handles latency-sensitive paths; batch provides consistency and global optimization.
State Storage: Chose strongly consistent KV store over eventually consistent options because disputes require immediate, authoritative state reads. Accept slightly higher latency for state updates to guarantee correctness.
Graduated Enforcement: Multi-step demotion (vs. binary visible/hidden) gives employers multiple warning signals and chances to respond before severe action, reducing dispute volume and improving trust.
This design scales to billions of historical postings while keeping critical paths (disputes, scoring) responsive, and provides comprehensive auditability for continuous improvement and dispute resolution.