Idempotency Keys for a GPU Virtual Machine Create API
Last updated: November 29, 2026
Quick Overview
Implement the server-side handling of an idempotency key on a create-VM endpoint so that client retries never launch duplicate GPU instances, including concurrent retries, key reuse with a different body, and transient backend failures.
Nebius
November 29, 20260
0
0 solved
Implement the server-side handling of an idempotency key on a create-VM endpoint so that client retries never launch duplicate GPU instances, including concurrent retries, key reuse with a different body, and transient backend failures.
Nebius exposes its compute through gRPC and Terraform-driven APIs, and a duplicated create call on an 8x H200 VM costs the customer real money. The interviewer checks that you understand at-most-once semantics over an unreliable network and which outcomes are safe to cache.
What the Interviewer Expects
- Scopes keys per tenant and stores a fingerprint of the request body
- Marks the key in-progress before calling the backend to block concurrent duplicates
- Returns the cached response for completed requests
- Rejects reuse of a key with a different body
- Caches deterministic client errors but not transient failures
- Discusses TTL and durable storage for the records
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- The process crashes after the VM is created but before the record is marked done; how do you recover?
- How would you store these records across many API replicas?
- Should a 409 for in-progress requests be retried by the SDK automatically?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Clients send Idempotency-Key with each create. Same tenant, same key, same body within the TTL returns the original result. Same key with a different body is a client bug (422). A retry arriving whi...
High-Level Design
A record per (tenant, key) with states in_progress and done, plus the body fingerprint and the stored response. The check-and-insert of in_progress happens atomically (a lock here, a condition...