← Openai Interview Insights

Openai·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
May 2026

Summary

System design round at OpenAI for a software engineer role. The core problem was building an image-sharing service with deduplication, and it went pretty deep pretty fast.

Questions Asked (1)

Q1

Design an image-sharing service where users upload and retrieve images by their own user/image ID, but the system stores only one physical copy when two users upload byte-identical images.

System DesignTechnical Trade-offsData Modeling
Author's notes

This is a meaty one.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then propose a content-addressable storage design where images are hashed (e.g., SHA-256) to produce a unique content ID. Use a metadata database to map user/image IDs to content IDs, and store the actual bytes once in blob storage keyed by content ID. Discuss trade-offs like hash collisions, deduplication overhead, and deletion semantics.

Pro tip: Mention that deduplication should be transparent to users and that you'd handle hash collisions by verifying byte equality before deduping. Also, consider using a two-level mapping (user_id -> image_id -> content_id) to support user-specific metadata and access control.

1. Clarify Requirements and Scale

Ask about expected number of users, upload rate, image size, retrieval latency, and consistency needs. Confirm that deduplication is global and that users can only access their own images.

2. Design Content-Addressable Storage

Compute a cryptographic hash (e.g., SHA-256) of the image bytes to generate a content ID. Store the image bytes once in a blob store (e.g., S3) keyed by content ID. Handle hash collisions by comparing bytes and using a secondary hash or salt if needed.

3. Design Metadata and Mapping Layer

Use a relational or NoSQL database to store mappings: user_id + image_id -> content_id, along with metadata like upload time, filename, and permissions. Ensure atomic updates to avoid race conditions during concurrent uploads.

4. Handle Upload and Retrieval Flows

On upload: hash the image, check if content ID exists; if not, store bytes and create a new content record; then create a user-image mapping. On retrieval: look up content ID via user/image ID, then fetch bytes from blob store.

5. Address Deletion and Garbage Collection

When a user deletes an image, remove their mapping. If no other mappings reference the content ID, delete the blob. Use reference counting or a background GC process to avoid orphaned blobs.

Key Points to Mention

  • Content-addressable storage using cryptographic hashing (e.g., SHA-256) for deduplication.
  • Two-level mapping: user_id + image_id -> content_id -> physical blob.
  • Hash collision handling: verify byte equality before deduping, and consider using a stronger hash or salt.
  • Concurrency control: use transactions or distributed locks to handle simultaneous uploads of identical images.
  • Deletion semantics: reference counting or garbage collection to remove blobs only when no users reference them.
  • Scalability: use a distributed blob store (e.g., S3) and a scalable metadata database (e.g., DynamoDB or Cassandra).

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.