Catalog Enrichment System, Distributed Job Scheduler

Difficulty: MEDIUMCategory: HLDFrequency: 1Asked On 2025-03-02

Problem Statement

You are tasked with designing a Catalog Enrichment System for an e-commerce platform. The system should ingest raw product data from multiple vendors, normalize it, enrich it with metadata (brand, category, tags, translations, images), and make it available for search, recommendations, and display.


Functional Requirements


•Ingestion: Support batch and streaming ingestion of vendor feeds (CSV, JSON, APIs).
•Normalization: Standardize attributes (e.g., color: "red", "rouge", "crimson" → "Red").
•Enrichment:
•Add product taxonomy (category, sub-category).
•Run ML models for tagging, image recognition, and text classification.
•Deduplicate & merge similar SKUs.
•Workflow Orchestration:
•Each product passes through an enrichment pipeline.
•Retry & dead-letter queue support for failed jobs.
•Publishing: Push enriched catalog to downstream systems (Search index, Recommendation engine, Inventory, Pricing).
•Monitoring & Auditing: Track pipeline health and maintain data lineage for enriched attributes.


Non-Functional Requirements


•Scalability to handle millions of SKUs daily.
•Low-latency enrichment for near-real-time updates.
•Extensibility for adding new enrichment modules.
•Fault tolerance with exactly-once or at-least-once processing.


Core Components


•Ingestion Layer (Kafka, Flink, Debezium).
•Enrichment Pipeline (Workers running ML models + rule-based transformers).
•Metadata Store (NoSQL / Graph DB for attributes & taxonomy).
•Orchestrator (Airflow, Dagster, or in-house scheduler).
•Output Publisher (Elasticsearch, Cassandra, or API gateway).


Distributed Job Scheduler


You need to design a Distributed Job Scheduler that allows scheduling, executing, and monitoring jobs (recurring & one-time) across a cluster of machines. Think of it like a simplified version of Airflow / Kubernetes CronJobs / Quartz Scheduler, but highly available and horizontally scalable.


Functional Requirements


•Job Scheduling:
•One-time jobs (run at 10 AM tomorrow).
•Recurring jobs (run every hour).
•Job Execution:
•Jobs can be tasks (HTTP calls, scripts, data pipelines).
•Should run on distributed worker nodes.
•Fault Tolerance:
•Retry failed jobs with exponential backoff.
•No duplicate executions.
•High Availability:
•No single point of failure (leader election for coordination).
•Observability:
•Track job history, status (pending, running, success, failed).
•Metrics & alerting for missed SLAs.
•APIs & UI:
•Admins can create, update, and delete jobs.
•Dashboard for monitoring job execution.


Non-Functional Requirements


•Scalability: Handle millions of scheduled jobs/day.
•Low latency in triggering jobs (< few seconds delay).
•Consistency in distributed scheduling (no duplicate execution).
•Pluggable storage backend (RDBMS, NoSQL, etc.).


Core Components


•Job Metadata Store (SQL/NoSQL for job definitions & schedules).
•Scheduler Service (Leader elected, assigns jobs to workers).
•Worker Nodes (Pull/Push model to execute jobs).
•Queue System (Kafka/RabbitMQ for job distribution).
•Coordinator (Zookeeper/etcd for leader election & distributed locks).
•Monitoring Dashboard (Track jobs & alert failures).


⚖️ Discussion Trade-offs (both systems):


•Batch vs Streaming enrichment in catalog.
•Centralized vs Decentralized scheduling in job scheduler.
•Exactly-once vs At-least-once guarantees.
•Extensibility: plugin-based enrichment vs fixed pipeline.


Solution

Comments