Bird
Raised Fist0

Design an E-Learning Platform - Course, Video, Progress, Certificate at Scale

HLDhardInterview freq: high
Choose your preparation mode4 modes available
🎯
Design an E-Learning Platform - Course, Video, Progress, Certificate at Scale
45 min · senior
senior

You are tasked with designing a scalable e-learning platform serving 50 million daily active users (DAU). The platform must support course content management, video streaming, real-time progress tracking, and certificate generation. Users expect P99 latency under 200ms for interactive operations. Videos must support offline playback with DRM encryption. User data must be encrypted at rest and in transit. The system should handle peak loads during course launches and exams without degradation.

  • P99 latency for interactive APIs under 200ms
  • Video content must support offline playback with DRM encryption
  • User progress and course state must be strongly consistent and durable
  • All user data encrypted at rest and in transit
  • System must handle 50M DAU with peak concurrency spikes
  • Certificate generation must be tamper-proof and verifiable
📋
Guided Steps
1/5
Step 1
Designing Course Content Storage and Delivery
How would you store and serve course metadata and video content to support 50M DAU with low latency?
💡 Hint
Consider separating metadata and video storage; think about CDN usage and database choice for metadata.
Use Amazon S3 for video storage with CloudFront CDN for low-latency global delivery; store course metadata in DynamoDB with partition key=course_id for scalable, low-latency access.
Mid-level: Names S3 + CloudFront and DynamoDB. Senior: Explains DynamoDB partition key choice for even data distribution and how CloudFront edge caching reduces latency globally.
⚠️Common Wrong Answer
Using a relational database like MySQL for video storage and metadata leads to scalability bottlenecks and high latency at 50M DAU.
Step 2
Ensuring Secure and Offline Video Playback
How would you enable offline video playback with DRM encryption while ensuring content protection?
💡 Hint
Think about DRM providers and offline license management; consider encryption at rest and in transit.
Integrate Widevine DRM for video encryption and license management; use encrypted HLS/DASH streams stored in S3; offline playback enabled via secure license caching on client devices.
Mid-level: Names DRM and encrypted streaming. Senior: Details Widevine integration, offline license caching mechanism, and encryption key rotation policies.
⚠️Common Wrong Answer
Serving unencrypted videos or relying on client-side obfuscation exposes content to piracy and violates security constraints.
Step 3
Designing Real-Time Progress Tracking
How would you track and store user progress in courses ensuring strong consistency and durability under high write throughput?
💡 Hint
Consider databases optimized for high write throughput and strong consistency; think about user_id and course_id as keys.
Use Apache Cassandra with partition key=user_id and clustering key=course_id to achieve linear write scalability and strong consistency with QUORUM consistency level.
Mid-level: Names Cassandra for writes. Senior: Explains partition key choice for data locality, consistency level trade-offs, and how Cassandra handles high write throughput.
⚠️Common Wrong Answer
Using eventual consistent stores like DynamoDB with eventual consistency leads to stale progress data and poor user experience.
Step 4
Certificate Generation and Verification
How would you design certificate issuance to be tamper-proof and verifiable by third parties?
💡 Hint
Consider cryptographic signing and decentralized verification methods.
Generate certificates as PDF documents signed with an RSA private key stored in AWS KMS; verification via public key published on a certificate registry service backed by DynamoDB.
Mid-level: Mentions digital signatures. Senior: Explains key management with AWS KMS, certificate revocation strategies, and public verification APIs.
⚠️Common Wrong Answer
Issuing unsigned certificates or storing certificates without cryptographic verification allows forgery and undermines trust.
Step 5
API Design for Core Platform Operations
Sketch three core RESTful API endpoints for course retrieval, progress update, and certificate issuance. What request/response patterns and data models would you use?
💡 Hint
Consider pagination for course content, idempotency for progress updates, and secure certificate retrieval.
Design GET /courses?course_id=&page= with DynamoDB pagination tokens; POST /progress with idempotency keys and Cassandra writes; GET /certificate/{user_id}/{course_id} returning signed PDF with verification metadata.
Mid-level: Defines basic endpoints. Senior: Details pagination tokens, idempotency handling, error codes, and security headers.
⚠️Common Wrong Answer
Designing progress update as GET or without idempotency leads to inconsistent state and duplicate writes.
🔌
API Design Challenge
Sketch 3 core RESTful API endpoints for the platform: course content retrieval, progress update, and certificate issuance.
  • How does the client request and paginate course content?
  • How does the client send progress updates and ensure durability?
  • How does the client request and verify certificate authenticity?
📊
Scoring Rubric
▼ Show
Must Have - 60%
  • Use of scalable object storage and CDN for video content
  • Strongly consistent, scalable database for user progress tracking
  • DRM-based video encryption supporting offline playback
  • Cryptographically signed certificates with key management
Good to Have - 30%
  • API design with pagination and idempotency
  • Public certificate verification service
  • Encryption at rest and in transit enforced system-wide
Bonus - 10%
  • Handling peak concurrency with autoscaling and backpressure
  • Certificate revocation and renewal mechanisms
Storing videos in relational databases causes scalability bottlenecks and high latency at 50M DAU, leading to poor user experience and system failures.
Using eventual consistency for progress tracking results in stale or lost updates, causing inaccurate user progress and frustration.
Serving unencrypted videos or ignoring DRM exposes content to piracy, violating licensing agreements and causing revenue loss.
Issuing unsigned certificates allows forgery and loss of trust, undermining the platform's credibility.
Polling-based progress sync at 50M DAU causes excessive load and latency spikes due to massive reconnects, collapsing under load.
Ignoring encryption in transit risks data interception and compliance violations, exposing sensitive user information.
✅
Model Answer
▼ Reveal

The platform uses Amazon S3 and CloudFront CDN for scalable video delivery with Widevine DRM for offline encrypted playback. Course metadata is stored in DynamoDB partitioned by course_id for low-latency access. User progress is tracked in Apache Cassandra with user_id partitioning ensuring strong consistency and high write throughput. Certificates are generated as RSA-signed PDFs using keys managed by AWS KMS, with public verification via a DynamoDB-backed registry service. All data is encrypted at rest and in transit using TLS.

  • Use S3 + CloudFront to handle 50M DAU video streaming with global edge caching
  • Partition DynamoDB by course_id to scale course metadata access with low latency
  • Integrate Widevine DRM with encrypted HLS/DASH streams and offline license caching
  • Use Cassandra with partition key=user_id and QUORUM consistency for strong, durable progress writes
  • Sign certificates with RSA keys stored in AWS KMS to ensure tamper-proof issuance
  • Expose public verification API backed by DynamoDB for certificate authenticity checks
  • Implement REST APIs with pagination tokens for course retrieval, idempotency keys for progress updates, and secure certificate retrieval
  • Enforce TLS everywhere to secure data in transit and encrypt all data at rest
  • Amazon S3 + CloudFront CDN for scalable, low-latency video delivery globally
  • DynamoDB with partition key=course_id for scalable course metadata storage
  • Widevine DRM integration for encrypted, offline-capable video playback
  • Apache Cassandra with partition key=user_id for strongly consistent, high-throughput progress writes
  • AWS KMS-managed RSA keys for cryptographically signing certificates
  • RESTful APIs with pagination, idempotency keys, and secure authentication
  • Certificate registry service backed by DynamoDB for public verification
  • Use of TLS everywhere to ensure encryption in transit

Practice

(1/5)
1. In a system trace, at step 4 the circuit breaker checks the failure count before forwarding a request. What happens if the failure count exceeds the threshold at this step?
easy
A. The circuit breaker opens and immediately returns an error without calling downstream
B. The request is forwarded but logged for monitoring
C. The circuit breaker retries the request twice before opening
D. The request is queued until the downstream service recovers

Solution

  1. Step 1: Trace circuit breaker decision at Step 4

    When failure count exceeds threshold, the circuit breaker transitions to OPEN state and stops forwarding requests.
  2. Step 2: Understand behavior on open circuit

    Requests are immediately failed (B), not forwarded (A), retried (C), or queued (D).
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    Open circuit returns error immediately without downstream call [check]
Hint: Open circuit returns error immediately, no downstream call [OK]
Common Mistakes:
2. You must design a distributed key-value store that tolerates network partitions and prioritizes availability over consistency. Which consensus approach fits best?
medium
A. Use Raft to enforce strong consistency with leader election
B. Use Paxos to guarantee consensus before any write is committed
C. Use eventual consistency with conflict resolution, avoiding strict consensus
D. Use a centralized lock service to serialize all writes

Solution

  1. Step 1: Analyze CAP trade-offs

    Prioritizing availability over consistency during partitions means relaxing strict consensus.
  2. Step 2: Evaluate options

    Raft and Paxos enforce strong consistency, sacrificing availability; centralized locks create single points of failure; eventual consistency allows availability with conflict resolution.
  3. Final Answer:

    Option C -> Option C
  4. Quick Check:

    Eventual consistency favors availability during partitions [check]
Hint: Availability over consistency -> eventual consistency with conflict resolution [check]
Common Mistakes:
3. For handling 10x traffic spikes in a flash sale, which architecture choice best balances consistency and availability under network partitions?
medium
A. Use an eventually consistent cache layer with asynchronous database writes
B. Use a distributed lock service to serialize all purchase requests
C. Use a single master database with read replicas for scaling reads
D. Use a strongly consistent distributed database with synchronous replication

Solution

  1. Step 1: Understand flash sale constraints

    Flash sales require high availability and low latency during spikes; strict consistency can cause blocking and failures.
  2. Step 2: Evaluate architectures

    Strong consistency with sync replication (A) causes high latency and availability loss under partitions. Single master (C) bottlenecks writes. Distributed locks (D) serialize requests, hurting throughput. Eventually consistent cache with async writes (B) allows high availability and scales under burst, tolerating slight delays.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    Async writes + eventual consistency -> high availability under spikes [check]
Hint: Eventual consistency favors availability during spikes [check]
Common Mistakes:
4. Without the message broker (e.g., Kafka) in a pub-sub system, what exactly breaks in the message delivery flow?
medium
A. Producers must synchronously send messages to each subscriber; if any subscriber is slow or down, the producer blocks or loses messages
B. Subscribers receive messages out of order due to lack of broker ordering guarantees
C. Messages are duplicated because the broker cannot deduplicate
D. Messages are encrypted incorrectly causing delivery failures

Solution

  1. Step 1: Role of the broker

    The broker decouples producers and subscribers, buffering messages and ensuring reliable delivery. Without it, producers must send directly to subscribers.
  2. Step 2: Consequences of no broker

    Direct synchronous sends cause producers to block if subscribers are slow or unavailable, risking message loss or backpressure. Duplication (Messages are duplicated because the broker cannot deduplicate) and ordering (Subscribers receive messages out of order due to lack of broker ordering guarantees) issues are secondary effects managed by the broker. Encryption (Messages are encrypted incorrectly causing delivery failures) is unrelated.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    No broker -> producer blocks or loses messages on slow subscribers [check]
Hint: No broker -> producer blocks on slow subscribers, losing messages [check]
Common Mistakes:
5. At 10x transaction volume, which component is most likely to become the first bottleneck in the payment system, and why?
hard
A. The client SDK, because it cannot handle increased retry logic under load
B. The Idempotency Store, because it is a centralized stateful component with limited horizontal scaling
C. The Settlement Service, due to batch processing delays and database write contention
D. The load balancer, as it cannot distribute traffic evenly at very high request rates

Solution

  1. Step 1: Identify stateful bottlenecks at scale

    The Idempotency Store holds global state and is hard to shard, limiting horizontal scaling.
  2. Step 2: Evaluate other components

    Settlement Service can be scaled with partitioned batches; client SDK is client-side and less critical; load balancer scales horizontally with modern tech.
  3. Final Answer:

    Option B -> Option B
  4. Quick Check:

    Centralized idempotency store -> scaling bottleneck at 10x load [check]
Hint: Centralized stateful store limits scaling first [check]
Common Mistakes:
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard