This was basically ten questions duct-taped into one.
Start by clarifying requirements and scale (e.g., number of users, submissions per day, languages supported, contest spikes), then sketch a high-level architecture with clear separation of concerns: API gateway, submission service, message queue, distributed workers, and storage. Dive into the critical path of code execution and grading, emphasizing sandboxing, async processing, fault tolerance, and data consistency, while touching on all requested aspects.
Pro tip: Emphasize idempotency and exactly-once processing in the grading pipeline: use unique submission IDs, deduplicate results, and design workers to be stateless so they can be safely retried after crashes. This shows you understand real-world distributed systems pitfalls.
Ask about expected user base, submission volume, supported languages, contest frequency, and latency requirements. Establish functional and non-functional goals to guide design decisions.
Outline core components: API gateway, user service, problem service, submission service, message queue (e.g., Kafka), worker fleet, result store, and databases. Explain data flow from submission to result.
Detail sandboxed execution (e.g., containers, seccomp, cgroups), async grading with distributed workers, queue redelivery and idempotency, test-data versioning, and re-judging. Discuss trade-offs (e.g., latency vs. isolation).
Cover rate limiting, caching (e.g., problem statements, leaderboards), plagiarism detection (e.g., token-based similarity), observability (metrics, logging, tracing), and security (sandbox escapes, DDoS).
Explain how to scale to contest spikes (auto-scaling workers, queue buffering), handle worker crashes (retries, dead-letter queues), and ensure data consistency (transactions, eventual consistency).
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.