Problem framing and constraints
How Problem framing and constraints (understanding) informs File Sharing in Chat architecture and interviewer depth.
Problem framing and constraints
This section covers problem framing and constraints for global file sharing in chat products. The interviewer expects explicit constraints, numerical assumptions, and operationally realistic failure handling. I therefore present decisions using three lenses: user experience, systems reliability, and platform cost.
Constraints
- Millions of concurrent sessions
- Bursty uploads during live events
- Strict permission checks before every download
- Malware and policy scanning requirements
- Geo-distributed latency expectations
Design Choices
- Keep metadata transactional in control-plane services.
- Keep raw file transfer on object storage and CDN path.
- Emit deterministic events for downstream indexing and previews.
- Apply idempotent APIs for initiate and completion lifecycle.
- Add queue-based workers for scanning and preview generation.
Java
1 public final class CompleteUploadUseCase { 2 public String execute(String sessionId, String idempotencyKey) { 3 if (sessionId == null || idempotencyKey == null) { 4 throw new IllegalArgumentException("required"); 5 } 6 return sessionId + "::" + idempotencyKey; 7 } 8 }
Python
1 from dataclasses import dataclass 2 3 @dataclass 4 class CompletionInput: 5 session_id: str 6 idempotency_key: str 7 8 def complete_upload(inp: CompletionInput) -> str: 9 """Returns deterministic completion token for safe retries.""" 10 if not inp.session_id or not inp.idempotency_key: 11 raise ValueError("required") 12 return f"{inp.session_id}::{inp.idempotency_key}"
TypeScript
1 export interface CompletionInput { 2 sessionId: string; 3 idempotencyKey: string; 4 } 5 6 export function completeUpload(input: CompletionInput): string { 7 if (!input.sessionId || !input.idempotencyKey) throw new Error('required'); 8 return input.sessionId + '::' + input.idempotencyKey; 9 }
Operational Validation
- Alert when complete-upload error rate breaches 1%.
- Alert when scanner lag exceeds SLA for 10 minutes.
- Alert when signed URL denial spikes by tenant.
- Track p50/p95/p99 for initiate, complete, and download auth paths.
Interview Delivery
In phase understanding, I present assumptions first, then architecture, then failure containment, and finally trade-offs with measurable impact.
Why interviewers care
File Sharing in Chat interviews reward crisp scope, explicit trade-offs, and failure stories—not generic microservice diagrams.
The failure that defines the design
The outage to narrate is the half-uploaded large file. A user pushes a 5GB file, the connection drops at 90 percent, and without resumable chunked upload they start over from zero — unusable on real networks. Its twin is the orphaned blob: the bytes land in object storage but the metadata commit never happens, so you pay to store a file no one can see, and storage leaks silently. Both come from treating upload as one atomic act. The fix is structural: split the file into content-addressed chunks uploaded independently and resumably, and commit metadata only after every chunk has landed and the scan passes — a two-phase commit where the blob exists before the file record does.
Key Highlights
- •Lead with constraints
- •Defend trade-offs with numbers
- •Cover failures and recovery
Section Rescue Kit
Buzzwords to use:
Safe statements:
- "For Problem framing and constraints, I optimize user-visible latency while preserving safety invariants."
- "I keep control plane strongly consistent and shift heavy processing asynchronous."
- "I validate this choice with SLOs, failure drills, and operational cost impact."