Design a long-running query service with durable jobs, asynchronous status and results, resource limits, and clear retry, cancellation, and failure behavior.
Design a system for long-running queries.
Start by clarifying what a query does, how long it may run, how large its result can be, and what clients need while waiting. Propose an architecture for accepting work, executing it, exposing progress or status, and making completed results available. Explain how it behaves when clients disconnect or execution fails.
State your workload and consistency assumptions. No particular query engine, API, traffic volume, or completion-time target is prescribed.
### What a Strong Answer Covers
- A client interaction model that does not depend on keeping one request open for the entire execution.
- Durable job identity, state transitions, execution ownership, and result publication.
- Scheduling and resource controls that keep long queries from overwhelming shared capacity.
- Clear retry, cancellation, and result-consistency behavior, including ambiguous failure outcomes.
### Follow-up Questions
- How would you prevent a retried submission from creating duplicate work?
- What happens when an execution worker loses contact with the coordinator but its query is still running?
Overview: Design a long-running query service with durable jobs, asynchronous status and results, resource limits, and clear retry, cancellation, and failure behavior.
Start by clarifying what a query does, how long it may run, how large its result can be, and what clients need while waiting. Propose an architecture for accepting work, executing it, exposing progress or status, and making completed results available. Explain how it behaves when clients disconnect or execution fails.
State your workload and consistency assumptions. No particular query engine, API, traffic volume, or completion-time target is prescribed.
What a Strong Answer Covers Guidance
A client interaction model that does not depend on keeping one request open for the entire execution.
Durable job identity, state transitions, execution ownership, and result publication.
Scheduling and resource controls that keep long queries from overwhelming shared capacity.
Clear retry, cancellation, and result-consistency behavior, including ambiguous failure outcomes.
Follow-up Questions Guidance
How would you prevent a retried submission from creating duplicate work?
What happens when an execution worker loses contact with the coordinator but its query is still running?