Google Python Developer Interview Questions & Answers

google icon

Questions with Detailed ExplanationsWith Detailed Explanations

(Last Updated: August 28, 2026)

31. Design an API for scheduling and managing calendar events.API DesignHardGoogle

Question Details

Define APIs for event creation, recurrence, attendee responses, free-busy lookup, updates, cancellation, pagination, authorization, and versioning.

Short Interview Answer (30-60 seconds)

At a high level, I would expose one versioned calendar API over HTTPS. The client signs in through OAuth2, receives a JWT, and sends it as a Bearer token. The API layer validates the token before routing requests. The API supports creating, updating, cancelling, listing, free-busy lookup, and attendee responses. Separate services own events, recurrence, RSVP data, availability, and notifications. Free-busy uses a cache with a fallback data source. Notifications run asynchronously. This adds operational work, but it keeps ownership clear and the main API path responsive.

Detailed Explanation

The goal is to provide one secure API for scheduling and managing calendar events. The main challenge is separating event logic, security, availability, and notifications. I would explain the design by following the request from the client to each service.

Useful Questions to Ask the Interviewer
  1. Which clients and core use cases must the API support?
  2. What authentication, authorization, and data-validation rules should I assume?
  3. What scale, error handling, idempotency, and versioning requirements matter?
Design an API for scheduling and managing calendar events. diagram
How to Explain It in an Interview
1. Begin with the client and identity flow

I would start with the user signing in through the Auth or Identity Provider.

The design uses OAuth2 with the authorization code flow or PKCE. OAuth2 is a standard way to grant application access. The identity provider returns an access token in JWT form, with an ID token also shown.

JWT means JSON Web Token. It contains identity and permission claims. The User or Client App sends the JWT as a Bearer token with each HTTPS request.

The client is outside the trusted internal system. HTTPS protects the request and JSON payload while they travel over the network. The HTTPS JSON response returns from the API layer to the client.

2. Explain the API gateway and token checks

The Calendar API Gateway or REST API is the system entry point. It receives the client request over HTTPS.

The Authorization and JWT Validation component checks the token. It verifies the signature, expiry, scopes, and claims. Authentication proves the caller's identity. Authorization checks whether that caller may perform the requested action.

The request continues only after a successful validation result. If validation fails, the request must stop before reaching a domain service. The diagram does not define a specific failure status code, so I would keep that response generic.

The API uses version /v1. Versioning allows future API changes without immediately breaking existing clients.

3. Describe the versioned API surface

The API surface contains six visible routes.

POST /v1/events creates an event. The Event Service returns 201 with the created event.

PATCH /v1/events/{id} updates an event. The response returns 200 with the updated event.

DELETE /v1/events/{id} cancels an event. The response returns 200 with the cancelled event.

POST /v1/events/{id}/responses records an attendee response. The response returns 200 with the recorded RSVP.

GET /v1/free-busy requests availability. The Free-Busy Service returns 200 with the free-busy data.

GET /v1/events?pageToken=...&pageSize=... lists events in pages. The response contains the items and a nextPageToken.

Recurrence is handled as part of event creation or updates. The Recurrence Service expands and validates recurrence rules shown in the event flow.

4. Separate service ownership and stored data

The Event Service owns creating, updating, cancelling, and reading events. It reads and writes the Calendar DB or Event Store.

The Recurrence Service expands and validates recurrence rules. It reads and writes Recurrence Data.

The Attendee Response Service records and reads attendee responses. It stores them in Response Storage.

Each service receives a request from the API layer. It performs its owned operation and returns a separate response. This keeps request and response directions clear.

The benefit is focused ownership. A change to recurrence logic does not need to change attendee-response storage.

5. Explain free-busy caching and fallback

The Free-Busy Service computes availability for the requested users and time range.

It first reads the Availability Cache or Index. A cache stores commonly used data for faster access. On a cache hit, the data returns directly to the service.

If the cache misses, the service follows the shown fallback path. It reads the Event Data or Index backup source. The data result then returns to the Free-Busy Service and back through the API.

The benefit is lower response time for common lookups. The downside is that the cache and fallback source must remain coordinated.

6. Keep notifications outside the main response path

Event changes can enqueue notification work. The Notification Worker processes jobs and sends reminders, updates, or cancellation messages.

The Job Queue or Outbound Notifier holds the work. Outbound Channels deliver messages through email, push, or SMS.

This work is asynchronous. The event API response does not wait for final message delivery. This keeps event operations responsive, but notification delivery may happen later.

7. Finish with observability and trade-offs

The design sends audit logs, metrics, traces, and alerts to Audit Log, Monitoring, and Observability. These signals help the SRE team investigate errors and performance issues.

The main trade-off is operational complexity. Separate services, data stores, caching, and queued work require more deployment and monitoring. We accept this because the design keeps security checks, ownership, and scaling boundaries clear.

Practical Complexity & Trade-offs

The benefit of this design is clear ownership. The Event Service owns normal event operations. Other services own recurrence, attendee responses, availability, and notifications. This makes each part easier to test and scale. The downside is that more services need more monitoring and deployment work. JWT validation protects every API call, but clients must obtain and send a valid token. Version /v1 protects current clients, but future versions may need parallel support. Pagination prevents very large event responses. The availability cache makes free-busy requests faster, but cache misses require the backup Event Data or Index. Asynchronous notifications keep the main API fast, but delivery happens later. We accept these costs because the design keeps the request path clear and separates important responsibilities.

Why Interviewers Ask This

Interviewers use this question to test engineering judgment, not endpoint memorization. They want clear API boundaries, correct HTTP methods, and correct request and response directions. They also check whether authentication and authorization are separated properly. Strong answers explain versioning, pagination, service ownership, caching, fallback behavior, asynchronous notifications, and observability. The candidate should explain why each choice helps and what operational cost it adds.

Interviewer may ask next
How would this design handle a large increase in free-busy lookup traffic?

I would keep GET /v1/free-busy and scale the Free-Busy Service independently. The request would still pass through the Calendar API Gateway and JWT validation. The Free-Busy Service would first read the Availability Cache or Index. More service instances could share that fast lookup layer. A cache hit would return the free-busy data without reading the backup source. On a cache miss, the existing fallback path would read the Event Data or Index. The data result would return to the Free-Busy Service and then through the API layer. The Event Service, Recurrence Service, and attendee-response flow would remain unchanged. Audit logs, metrics, traces, and alerts should track request latency, cache hits, cache misses, and failures. The main downside is cache coordination. The cache may briefly differ from the underlying event data. This design accepts that complexity because most free-busy requests can use the faster path.

How would you stop notification delivery from slowing event creation or updates?

I would keep notification delivery outside the synchronous event response path. After the Event Service creates, updates, or cancels an event, notification work is enqueued. The Notification Worker later processes that job. It sends reminders, updates, or cancellation messages through the Outbound Channels for email, push, or SMS. The original POST, PATCH, or DELETE request can return after the event operation succeeds. It does not wait for final message delivery. JWT validation and authorization remain unchanged at the API layer. The Event Service still owns the event state, while the Notification Worker owns message processing. Logs, metrics, traces, and alerts go to the observability component. The main downside is delayed delivery. The API may return success before a recipient receives the message. The queue and worker also add operational work. We accept this because event writes remain responsive and outbound delivery failures do not block the main request.

32. Design an API for a global translation service.API DesignHardGoogle

Question Details

Define synchronous and batch translation APIs, language detection, glossary selection, quotas, request validation, error contracts, and versioning.

Short Interview Answer (30-60 seconds)

At a high level, I would separate fast translations from long-running batch jobs. Clients send HTTPS requests with a JWT through an API Gateway. The gateway authenticates callers, validates requests, checks quotas, and routes /v1 or /v2 traffic. POST /v1/translate returns translated text synchronously. POST /v1/detect-language returns the detected language. Batch creation returns 202 Accepted with a job ID, while workers process queued items in the background. The main trade-off is a simple synchronous experience versus the extra queue, worker, storage, and polling complexity needed for large jobs.

Detailed Explanation

The goal is to provide one translation platform for quick requests and large jobs. The main challenge is keeping the client API simple while supporting validation, quotas, glossaries, and background processing. I would explain the design by following each request and response path in the diagram.

Useful Questions to Ask the Interviewer
  1. Which clients and core use cases must the API support?
  2. What authentication, authorization, and data-validation rules should I assume?
  3. What scale, error handling, idempotency, and versioning requirements matter?
Design an API for a global translation service. diagram
How to Explain It in an Interview
1. Define the API boundary

I would start by placing an API Gateway in front of every endpoint. The client is an API Client or Developer App. It sends requests over HTTPS and includes a JWT. HTTPS protects data while it travels across the network. A JWT is a signed token used to identify the caller.

The API Gateway handles authentication and version routing. It supports paths such as /v1 and /v2. Version routing lets newer APIs evolve without immediately breaking older clients.

Before routing a request, the gateway calls Request Validation. That service checks the request schema and content. An invalid request returns the 400 Bad Request validation error contract.

The gateway also calls the Quota and Rate Limit Service. That service applies per-client request limits. A client that exceeds its quota receives 429 Too Many Requests. Unexpected platform failures return the shown 5xx Server Error contract. Each response returns through the gateway to the client.

2. Handle synchronous translation

For immediate translation, the client sends POST /v1/translate. The request reaches the gateway using HTTPS and JWT. After validation and quota checks, the gateway routes it to the Synchronous Translate API.

The Synchronous Translate API calls the Translation Orchestrator. The orchestrator coordinates the services needed for one translation.

If the source language is missing, it calls the Language Detection API. That API returns the detected source language.

The orchestrator then calls the Glossary Selection Service. A glossary contains approved translations for important business terms. The service reads the chosen glossary from the Glossary Store. It returns the selected glossary to the orchestrator.

The orchestrator sends the text and glossary to the Translation Engine. The engine returns the translated text to the orchestrator. The result then returns through the Synchronous Translate API and gateway. The client receives 200 OK with the translated text.

3. Provide language detection separately

The client may only need to identify the source language. For that case, it sends POST /v1/detect-language.

The request passes through the same gateway checks. The gateway then routes it to the Language Detection API. The API examines the supplied text and returns the detected language. The response returns through the gateway. The client receives 200 OK with the detected language.

This endpoint avoids running the complete translation flow. It also lets clients inspect text before requesting translation.

4. Create a batch translation job

For large workloads, the client sends POST /v1/batch-translations. The gateway validates the request and checks the client quota. It then routes the valid request to the Batch Translate API.

The Batch Translate API writes job metadata to the Batch Job Store. This store keeps the job identifier and current status. The API also places the work in the Job Queue.

The API does not wait for every translation to finish. It returns 202 Accepted with a job ID through the gateway. The job ID lets the client check the work later.

The Job Queue delivers queued work to Batch Workers. Workers can run in parallel when batch demand increases. Each worker invokes the Translation Orchestrator for its assigned items. The orchestrator uses language detection when needed. It also uses glossary selection and the Translation Engine.

5. Store results and support polling

Batch Workers write completed output to the Result Store. They also update job status in the Batch Job Store.

The client checks progress with GET /v1/batch-translations/{jobId}. This polling request passes through the API Gateway. The gateway routes it to the Batch Translate API.

The Batch Translate API reads the job status from the Batch Job Store. It reads result information from the Result Store when output is ready. The response then returns through the gateway to the client. The client receives 200 OK with job status, a result, or a download URL.

The request and response remain separate flows. The batch workers never send a direct business response to the client.

6. Explain monitoring and trade-offs

The gateway and translation services send operational data to Logging and Monitoring. The diagram also sends worker activity through this observability path. These one-way flows contain logs, metrics, and traces. They help operators find failures and measure system performance. They are not part of the client response path.

The synchronous API is simple and fast for small requests. The batch API prevents large jobs from blocking client connections. The downside is more operational complexity. The system must manage a queue, workers, job state, result storage, and polling.

Practical Complexity & Trade-offs

The design separates quick work from long-running work. The synchronous endpoint is simple because it returns translated text in one request. The batch endpoint is better for large jobs because it returns a job ID and processes work later. The benefit is better responsiveness and easier worker scaling. The downside is extra infrastructure, including a queue, workers, job storage, result storage, and polling. Request validation stops malformed input early. Quotas protect capacity from one heavy client. Version routing allows /v2 changes while /v1 clients continue working. Glossaries improve translation consistency for special terms, but they add a storage lookup. Logging, metrics, and traces improve operations, but they also require monitoring systems. We accept these costs because global workloads can vary greatly in size.

Why Interviewers Ask This

Interviewers use this question to test API boundaries and engineering judgment. They want correct separation between synchronous requests and asynchronous batch work. They also check HTTP methods, status codes, versioning, validation, quotas, and error contracts. A strong answer traces requests and responses in the correct direction. It assigns responsibilities clearly across the gateway, APIs, orchestrator, workers, queues, and stores. The trade-off discussion shows whether the candidate understands scale, reliability, and operational complexity.

Interviewer may ask next
How would this design handle a sudden increase in batch translation jobs?

I would keep the public API contracts unchanged and scale the asynchronous path. Clients would still call POST /v1/batch-translations and receive 202 Accepted with a job ID. The Batch Translate API would continue writing metadata to the Batch Job Store and placing work in the Job Queue.

The main change would be running more Batch Workers. More workers let the platform process several queued items at the same time. The queue absorbs a sudden traffic spike when requests arrive faster than workers can finish them.

Correctness remains tied to the existing stores. Workers update progress in the Batch Job Store and write completed output to the Result Store. Clients continue polling GET /v1/batch-translations/{jobId} through the gateway. Authentication, validation, quota checks, and version routing remain unchanged.

The main downside is cost and queue delay. Too many workers waste capacity. Too few workers increase completion time. Logging and Monitoring should track queue depth, worker load, failure counts, and job duration so operators can choose suitable capacity.

How would you keep customer-specific glossary terms consistent across both translation paths?

I would keep glossary selection inside the shared Translation Orchestrator flow. Both the Synchronous Translate API and Batch Workers already call that orchestrator. This means synchronous and batch translations use the same glossary-selection behavior.

For each translation, the orchestrator calls the Glossary Selection Service. That service reads the chosen glossary from the Glossary Store and returns it. The orchestrator then sends the text and selected glossary to the Translation Engine. The public endpoints and response contracts do not change.

Correctness depends on choosing the glossary that belongs to the intended client or translation context. The diagram does not define a glossary-management endpoint, so I would not add one to this design. Gateway authentication, request validation, quotas, and version routing remain unchanged.

The benefit is consistent translation for product names and special terms. The downside is an extra lookup on each translation flow. A missing or incorrect glossary may reduce quality. Logging and Monitoring should record glossary-selection failures so operators can investigate them.

33. Design an API for managing cloud virtual-machine instances.API DesignHardGoogle

Question Details

Define create, start, stop, resize, list, inspect, and delete operations, including long-running operations, authorization, validation, errors, and compatibility.

Short Interview Answer (30-60 seconds)

At a high level, I would separate quick reads from slow VM lifecycle changes. The client authenticates with OAuth2 or OIDC, receives a JWT, and sends HTTPS requests through the API Gateway. The authorization layer checks identity, permissions, request data, current state, and API compatibility. List and inspect return 200 responses from the instance state store. Create, start, stop, resize, and delete return 202 with an operationId. A workflow executes the command, while the client polls GET /operations/{opId}. The downside is more components, but operations stay responsive, traceable, and reliable.

Detailed Explanation

The API manages cloud virtual-machine instances through one controlled entry point. The main challenge is that reads finish quickly, while lifecycle changes take longer. I will follow the diagram from authentication through execution, status tracking, and errors.

Useful Questions to Ask the Interviewer
  1. Which clients and core use cases must the API support?
  2. What authentication, authorization, and data-validation rules should I assume?
  3. What scale, error handling, idempotency, and versioning requirements matter?
Design an API for managing cloud virtual-machine instances. diagram
How to Explain It in an Interview
1. Define the API boundary and operations

I would start by saying that the client manages VM instances through the API Gateway.

The supported operations are create, start, stop, resize, list, inspect, and delete. The client can also poll the status of a long-running operation.

The API Gateway is the public entry point. It terminates TLS, routes requests, applies rate limits, and assigns a request ID. TLS protects data while it moves across the network.

The gateway separates the external client from the internal cloud-provider services. It also gives the platform one place to control traffic.

2. Authenticate and authorize the caller

The client first authenticates with the Identity Provider using OAuth2 or OIDC. The Identity Provider returns a JWT access token. A JWT is a signed token that carries the caller's identity and claims.

The client sends an HTTPS REST request with the JWT to the API Gateway. The gateway forwards the request and token to the Authorization, Validation, and Compatibility layer.

This layer validates the JWT. It then applies RBAC or IAM authorization. Authentication proves who the caller is. Authorization decides whether that caller may perform the requested action.

The same layer validates the request structure. It checks policy limits, current VM state, and API compatibility. For example, it can reject a start request when the VM is already running.

After all checks pass, the layer sends an authorized request to the VM Instance API Service.

3. Handle list and inspect as synchronous reads

List and inspect are quick read operations, so I would keep them synchronous.

The VM Instance API Service asks the Instance Metadata and State Store for the current instance data. This store holds details such as configuration, state, network information, and other instance metadata.

The store returns the state data to the API service. The service returns a 200 response to the API Gateway. The gateway then returns the instance list or instance details to the client.

This path does not involve the workflow or compute control plane because it does not change the VM.

4. Accept lifecycle changes as long-running operations

Create, start, stop, resize, and delete can take several seconds or minutes. I would therefore process them asynchronously. Asynchronous means the work continues after the first API response.

The VM Instance API Service first creates a pending record in the Operation Store. The record tracks the operationId, operation type, target, status, progress, result, error, and timestamps.

The service then submits a long-running task to the Workflow, Task Queue, or Orchestrator.

The service returns 202 Accepted with an operationId through the API Gateway. A 202 response means the request was accepted, but the action is not complete.

This keeps the client connection short and gives the client a stable identifier for tracking progress.

5. Execute the command and persist the result

The Workflow or Orchestrator sends the create, start, stop, resize, or delete command to the Compute Control Plane, Hypervisor, or Instance Agent.

That compute component owns the real VM lifecycle action. It returns execution status and heartbeats to the workflow.

The workflow sends progress and completion updates to the Long-Running Operations API or Operation Manager.

The Operation Manager updates the operation status in the Operation Store. After the lifecycle action succeeds or fails, it persists the current instance state in the Instance Metadata and State Store.

This separation keeps operation history apart from the latest VM state.

6. Poll status and return consistent errors

The client polls GET /operations/{opId} through the API Gateway. The gateway routes the request to the Long-Running Operations API or Operation Manager.

The Operation Manager returns a 200 operation status or result. The response travels back through the API Gateway to the client.

Errors use a separate path. Authorization failures, validation failures, and execution errors go to the Error Mapper. The Error Mapper converts internal failures into consistent API errors.

The diagram includes 400 for invalid requests, 401 for invalid authentication, 403 for denied access, 404 for missing resources, 409 for state conflicts, 422 for invalid operation details, 429 for rate limits, and 5xx for server failures.

The gateway, API service, workflow, operation manager, compute control plane, and error mapper send audit events, logs, and metrics to the monitoring system. These records support debugging, alerts, tracing, and security reviews.

Practical Complexity & Trade-offs

The benefit of this design is that simple reads return quickly, while slow VM changes run in the background. Returning 202 with an operationId prevents long client connections. The downside is extra operational work because the system needs a workflow, operation manager, operation store, and polling flow. JWT validation and RBAC protect the API, but they add processing to every request. State validation prevents invalid actions, such as resizing a deleted VM. Idempotent request handling reduces duplicate work when clients retry, but it requires careful operation tracking. Compatibility checks reduce client breakage, but they increase testing effort. Central error mapping makes responses consistent. Rate limiting protects the platform, but quotas must remain fair. We accept these costs because VM lifecycle actions are slow and must be traceable.

Why Interviewers Ask This

Interviewers use this question to test whether you can separate synchronous reads from asynchronous state changes. They also evaluate API boundaries, request and response direction, authentication, authorization, validation, compatibility, and error handling. A strong answer explains why 202 and operation polling are needed. It also shows clear ownership between the API service, workflow, compute control plane, operation store, state store, and monitoring system. The interviewer wants engineering judgment, not memorized endpoint names.

Interviewer may ask next
How would you handle a sudden increase in create, start, and resize requests?

I would keep the public API contract unchanged and scale the asynchronous processing path. Clients would still receive 202 Accepted with an operationId, and they would still poll GET /operations/{opId}.

The main changes would affect the Workflow, Task Queue, Orchestrator, Operation Store, and Compute Control Plane. I would add more workflow workers so independent operations can run in parallel. The task queue would absorb traffic spikes instead of sending every command directly to the compute layer.

The VM Instance API Service would still create the operation record before submitting the task. That keeps every accepted request traceable. Idempotent handling would prevent a repeated task from changing the same VM twice.

Authorization, validation, compatibility checks, and error mapping would remain unchanged. Monitoring would track queue depth, execution time, failures, and operation age.

The main downside is queue delay. The API may accept a request quickly, but execution may start later. The operation status must clearly show that the request is still pending.

How would you prevent two conflicting operations from changing the same VM?

I would reject conflicting operations before execution and check again inside the workflow. The VM Instance API Service would examine the current instance state and active operation records before creating a new operation.

For example, a resize request should not begin while a delete operation is already running. The service can return 409 because the requested action conflicts with the current resource state.

The Operation Store would show whether another lifecycle operation is active for that instance. The Instance Metadata and State Store would provide the latest VM state. The service would use both sources before accepting the request.

The workflow would repeat the state check before sending the command to the Compute Control Plane. This protects correctness when the state changes after the original request.

Authentication, authorization, polling, and observability would remain unchanged. The main downside is added coordination between the API service, operation store, and state store. This adds latency and more failure cases, but it prevents unclear or unsafe VM states.

34. Design an API for publishing and consuming event streams.API DesignHardGoogle

Question Details

Define topic, subscription, publish, pull, acknowledge, retention, filtering, and access-control APIs, including pagination, errors, and versioning.

Short Interview Answer (30-60 seconds)

At a high level, I would build one versioned API for managing topics, subscriptions, publishing, pulling, and acknowledgements. Clients send JSON over HTTPS with a bearer JWT to the API Gateway. The gateway asks Auth and Access Control to validate the token and check permissions. The Event Stream Service then updates topic metadata, appends events, reads retained events, or advances a subscription cursor. Responses return through the gateway with clear status codes and pagination tokens. The trade-off is more state and security checks, but the API becomes safer and easier to operate.

Detailed Explanation

The goal is to let publishers send events and consumers read them safely. The main challenge is managing access, retained data, filters, and consumer progress. I would follow the diagram from the clients through the gateway and service.

Useful Questions to Ask the Interviewer
  1. Which clients and core use cases must the API support?
  2. What authentication, authorization, and data-validation rules should I assume?
  3. What scale, error handling, idempotency, and versioning requirements matter?
Design an API for publishing and consuming event streams. diagram
How to Explain It in an Interview
1. Define the API boundary and resources

I would start with three client types. The Admin Client manages topics, subscriptions, retention, filters, and access policies. The Publisher Client sends events to topics. The Consumer Client pulls events and acknowledges completed work.

All public requests enter through the API Gateway / REST API. Every route uses version v1. The topic routes are POST /v1/topics and GET /v1/topics?pageSize&pageToken. The subscription routes are POST /v1/subscriptions and GET /v1/subscriptions?pageSize&pageToken. Event delivery uses POST /v1/publish, POST /v1/pull, and POST /v1/acknowledge. Administration also uses PATCH /v1/topics/{id}/retention, PATCH /v1/subscriptions/{id}/filter, and PUT /v1/access-policies.

2. Authenticate and authorize each request

The request first reaches the gateway as JSON over HTTPS. The caller includes a bearer JWT. A JWT is a signed token that identifies the caller.

The gateway sends a JWT validation and authorization request to Auth and Access Control. That component validates the token and evaluates access policies. It returns an allow or deny decision to the gateway. A missing or invalid token returns 401. A valid caller without permission returns 403. This keeps identity checking separate from permission checking.

3. Route work to the Event Stream Service

After approval, the gateway sends a validated, versioned request to the Event Stream Service. The service owns the domain logic. It contains the Topics API, Subscriptions API, Publish API, Pull API, Acknowledge API, and Retention and Filtering.

The service returns a separate response to the gateway. The gateway then returns it to the original client. Successful operations use 200, 201, or 204, as shown. Errors may use 400, 401, 403, 404, 409, 429, or 500.

4. Manage topics and subscriptions

The Topics API creates and lists topics. It reads and writes the Topic Metadata Store. This store keeps topic configuration, retention settings, and access policies. List responses may return nextPageToken.

The Subscriptions API creates and lists subscriptions. It also manages each subscription filter. The Subscription State Store keeps subscription configuration, filters, cursors, and acknowledgement state. A cursor is the current reading position for that subscription.

5. Publish and pull events

The Publisher Client calls POST /v1/publish. The Publish API validates the event and appends it to the Event Store / Retained Topic Log. That store is an append-only event log for each topic. It returns a stored result with a message identifier. The client receives 201 Created on success.

The Consumer Client calls POST /v1/pull. The Pull API loads the subscription filter and cursor from the Subscription State Store. It then reads retained events from the event store. Filters are evaluated for that subscription during the pull. The response returns an events page and may include nextPageToken.

6. Acknowledge events and enforce retention

After processing, the consumer calls POST /v1/acknowledge. The Acknowledge API commits the acknowledgement and advances the cursor. The Subscription State Store saves the new state. A successful acknowledgement returns 204 No Content.

Retention is enforced in the Event Store / Retained Topic Log. Expired events are removed there. This keeps retention ownership close to the stored events.

7. Record logs and explain the trade-off

The Event Stream Service sends audit and delivery logs asynchronously. Asynchronous means this logging does not block the business response. Audit / Access Logs stores access, delivery, and error records.

The benefit is clear ownership and strong access control. The downside is more state and more components. We accept that cost because durable event delivery needs stored events, subscription progress, and visible audit history.

Practical Complexity & Trade-offs

The benefit of this design is clear separation. The gateway owns routing and common request handling. Auth and Access Control owns token checks and permission decisions. The Event Stream Service owns topic, subscription, publish, pull, acknowledge, retention, and filtering behavior. Versioning with /v1 protects current clients when the API changes. Pagination keeps list and pull responses small. The downside is more moving parts. The system must manage topic metadata, an append-only event log, and subscription cursors. Retention saves storage, but expired events are removed. Filters reduce unwanted events, but they add work during pull. Asynchronous audit logging improves visibility without blocking responses, but it adds storage and operational cost. We accept this because the design is safer and easier to debug.

Why Interviewers Ask This

Interviewers want to see whether you can define clear API resources and request flows. They check whether publishing, pulling, acknowledgements, pagination, filtering, and errors are modeled correctly. They also evaluate whether authentication and authorization have clear ownership. A strong answer explains durable event storage, subscription state, retention, and audit logging without inventing guarantees. The main skill is sound engineering judgment and clear trade-off communication.

Interviewer may ask next
How would this design support many independent consumer groups?

I would keep the same topic and publish flow, but create a separate subscription for each consumer group. The affected APIs are POST /v1/subscriptions, POST /v1/pull, and POST /v1/acknowledge. Each subscription keeps its own filter, cursor, and acknowledgement state in the Subscription State Store. The Pull API loads the selected subscription state before reading retained events from the Event Store / Retained Topic Log. The Acknowledge API advances only that subscription’s cursor. This preserves correctness because one consumer group cannot move another group’s position. Security remains unchanged. The gateway still sends the bearer JWT to Auth and Access Control, which checks permission for the requested subscription. Pagination still uses pageSize, pageToken, and nextPageToken. The shared event log remains unchanged because many subscriptions can read the same retained events. The main downside is more subscription state and more pull traffic. The rest of the platform, including retention and asynchronous audit logging, stays the same.

How does the API behave when authentication or authorization fails?

The request stops at the API Gateway and Auth and Access Control flow. The gateway sends the bearer JWT and request context for validation and policy evaluation. If the token is missing or invalid, the response is 401 Unauthorized. If the token is valid but the caller lacks permission, the response is 403 Forbidden. The request is not sent to the Event Stream Service, so no topic metadata, event log, or subscription state is changed. This maintains security because business operations run only after an allow decision. The same rule applies to topic, subscription, publish, pull, acknowledge, retention, filter, and access-policy operations. The gateway returns the error response to the original Admin, Publisher, or Consumer Client. Audit and access information can still be written asynchronously to Audit / Access Logs, as shown in the design. The main downside is an extra authorization step on each request. We accept that cost because access checks are central to the API’s safety.

35. Design a globally distributed web crawler.System DesignHardGoogle

Question Details

Explain URL discovery, frontier management, politeness, duplicate detection, content storage, recrawling, failure recovery, and global scaling.

Short Interview Answer (30-60 seconds)

At a high level, this system discovers web pages and crawls them safely across many regions. The main challenge is scaling the crawl without overloading websites, repeating work, or losing failed tasks. I would explain it in three flows: URL discovery and scheduling, page fetching and storage, and recrawling with failure recovery. The frontier assigns polite crawl work to regional workers. Metadata later schedules another crawl. The main trade-off is that global shard coordination adds complexity.

Detailed Explanation

The goal is to discover web pages, fetch them safely, and store useful content. The difficult part is doing this across many regions without crawling the same page repeatedly. The system must also respect each website, retry failed work, and decide when a page needs another crawl. The diagram separates these concerns into discovery, frontier management, page processing, recrawling, and failure recovery.

Useful Questions to Ask the Interviewer
  1. Which user flows and system capabilities are required for the first version?
  2. What traffic, data volume, latency, and availability targets should I design for?
  3. Which consistency, security, geographic, and cost constraints matter most?
Design a globally distributed web crawler. diagram
How to Explain It in an Interview
1. Explain URL discovery and filtering

I would begin with how URLs enter the crawler.

"Seed URLs" provide the first known pages. They move into "URL Discovery", which collects URLs that may need crawling.

Before scheduling a URL, "Duplicate URL Filter" checks whether it was already seen. This reduces repeated work before the URL enters "URL Frontier".

After a page is fetched, "Parser + Link Extractor" finds links inside it. Its "Discovered links" path sends those links back to "URL Discovery". This loop lets the crawler continue finding new pages.

2. Explain frontier management and politeness

"Frontier Management" decides which URL should be crawled next.

"URL Frontier" holds URLs waiting for work. "Politeness Scheduler" controls when each host may receive another request. Politeness means the crawler avoids sending too many requests to one website.

"Robots.txt / Host Rules" provides the per-host rules used by the scheduler. These rules help the crawler respect each website's crawl instructions.

"Global Shard Coordinator" sends shard ownership to "URL Frontier". A shard is one part of the URL workload. Clear ownership lets regions divide the work without scheduling the same shard independently.

3. Explain fetching and content processing

The scheduler sends ready work to "Regional Crawl Workers". These workers process crawl tasks in different regions.

A worker sends the page request to "Fetcher". The fetcher downloads the page and passes it to "Parser + Link Extractor".

The parser extracts links and sends fetch metadata to "Crawl Metadata Store". The page then moves to "Content Duplicate Detection".

This check is different from URL filtering. Different URLs may return identical content. Only content that should be kept moves into "Content Storage".

"Content Storage" sends stored content references to "Crawl Metadata Store". This connects each crawl record with its saved content.

4. Explain recrawling

Pages change over time, so the crawler must visit them again.

"Crawl Metadata Store" sends freshness and status information to "Recrawl Scheduler". Freshness means how recently a page was checked and whether another crawl is needed.

"Recrawl Scheduler" sends selected URLs back to "URL Frontier" through the "Re-enqueue for recrawl" path. The URL then follows the normal polite scheduling flow again.

This design keeps first-time crawling and later recrawling on the same controlled path.

5. Explain failures, monitoring, and global scale

"Regional Crawl Workers" may have dispatch failures. "Fetcher" may see timeouts or fetch errors. Both paths enter "Failure Recovery".

Failed work enters "Retry Queue" first. If retries are exhausted, the task moves to "Dead Letter Queue". Retryable work returns to "URL Frontier" through the "Retry later" path.

"Observability & Monitoring" receives signals from "URL Frontier", "Regional Crawl Workers", "Fetcher", and "Content Storage". These signals help operators find growing queues, fetch errors, worker problems, and storage issues.

Global shards and regional workers improve scale. The downside is extra coordination around shard ownership, retries, and crawl state.

Engineering Considerations / Design Trade-offs

The benefit is that each part has a clear job. URL filtering prevents repeated scheduling. Content duplicate detection prevents repeated storage. Politeness protects external websites. Regional workers spread crawl work across locations. Recrawling keeps stored pages fresh. Failure Recovery keeps temporary errors from losing work. The downside is more coordination. The Global Shard Coordinator must keep shard ownership clear. Metadata must stay useful for future recrawls. Retries can also increase work when a website remains unavailable. We accept this complexity because a global crawler must scale while remaining careful and reliable.

Why Interviewers Ask This

Interviewers use this question to test how you divide a large system into simple flows. They want to see whether you understand scheduling, polite crawling, duplicate control, storage, and retries. They also check whether you can separate URL duplicates from content duplicates. A strong candidate explains how regions share work, how failed tasks return safely, and what extra complexity global coordination creates.

Interviewer may ask next
How would the design change if one region became overloaded with crawl work?

I would keep the same architecture, but I would change shard ownership through "Global Shard Coordinator". It would assign some URL shards to other regions with available "Regional Crawl Workers".

"URL Frontier" would use the new ownership when scheduling future work. A shard should have one clear owner during the move. This prevents two regions from independently scheduling the same shard.

"Duplicate URL Filter" still provides protection against repeated URLs. However, it should not replace correct shard ownership. Clear ownership prevents duplicate scheduling earlier in the flow.

"Observability & Monitoring" would show that one region has growing work or slower processing. It would also help confirm that the new regions are accepting work successfully.

The main downside is temporary coordination work. Scheduling may slow while ownership changes. Moving shards too often can also make the system unstable, so the coordinator should only move them when the imbalance is meaningful.

How would you handle a website that repeatedly times out?

I would keep the same failure path, but I would delay retries for that website. The affected components are "Fetcher", "Failure Recovery", "Retry Queue", and "Politeness Scheduler".

When "Fetcher" reports a timeout, the task enters "Failure Recovery". "Retry Queue" keeps the task for another attempt instead of returning it immediately. This prevents the crawler from repeatedly hitting a slow website.

"Politeness Scheduler" should continue applying the site's per-host rules. The retry should return to "URL Frontier" only when it is safe to try again. This keeps the retry on the normal scheduling path.

If the task keeps failing until its retries are exhausted, it moves to "Dead Letter Queue". The URL is not silently lost, and normal crawl work can continue.

The main downside is freshness. Content from that website may remain old for longer. However, delaying retries protects both the crawler and the external website.

36. Design a planet-scale distributed file storage service.System DesignHardGoogle

Question Details

Explain metadata, chunk placement, replication, consistency, hot files, rebalancing, failure detection, repair, and capacity growth.

Short Interview Answer (30-60 seconds)

At a high level, the goal is to store files safely across many regions. The main challenge is keeping file metadata correct while moving large chunks quickly. I would explain three parts: the request and control path, the global storage layer, and background operations. The Metadata Service manages locations and versions. Chunk servers hold the file data. Replication, repair, rebalancing, and capacity growth keep copies healthy. The trade-off is extra storage, network traffic, and control work.

Detailed Explanation

The goal is to store large files across many regions and keep them available during failures. The difficult part is keeping small metadata correct while moving large file chunks efficiently. The diagram solves this by separating the request and control path, the global storage layer, and background operations.

Useful Questions to Ask the Interviewer
  1. Which user flows and system capabilities are required for the first version?
  2. What traffic, data volume, latency, and availability targets should I design for?
  3. Which consistency, security, geographic, and cost constraints matter most?
Design a planet-scale distributed file storage service. diagram
How to Explain It in an Interview
1. Explain the main split

I would start by separating file metadata from file content. The Metadata Service manages the namespace, chunk map, and versions. The namespace connects a file name to its stored chunks. The chunk map records where each chunk has copies.

The Metadata Store saves this control information. The Storage Regions hold the actual file chunks. This split keeps large data transfers away from the metadata path.

2. Explain reads and writes

Clients send a read or write request to the File Service API. The API asks the Metadata Service for locations and write intent. Write intent means the client plans to change the file.

The Metadata Service checks the current namespace, chunk map, and versions. It sends lease and version rules to the Consistency Coordinator. A lease gives temporary write control to one writer. Version checks stop an older write from replacing newer data.

After the API receives the chunk locations, it reads or writes chunks in Storage Regions. The file data does not pass through the Metadata Service.

3. Explain placement, replication, and hot files

For a new chunk, the Metadata Service asks the Chunk Placement Manager to choose storage locations. The manager places chunk copies across the available regions.

The Metadata Service also directs the Replication Manager. The Replication Manager copies chunks across Region A, Region B, and Region C. These extra copies allow another region to serve the file when one copy fails.

For popular files, the Metadata Service checks the Hot File Cache. A cache hit returns the saved hot-file information quickly. This reduces repeated metadata work for heavily requested files.

4. Explain failure detection and repair

Storage Regions send heartbeats and failure signals to the Failure Detector. A heartbeat is a small message showing that a server is alive. Missing heartbeats can indicate a failed server or region.

The Failure Detector sends confirmed failures to Repair Workers. The workers copy missing chunks to healthy servers. They then update the replica map in the Metadata Service. This keeps later reads and placement choices accurate.

5. Explain rebalancing and growth

The Rebalancer moves chunks when storage becomes uneven. This prevents one server or region from carrying too much data.

Capacity Growth adds new nodes and regions. It sends the new capacity to the Rebalancer and Replication Manager. The system can then spread existing chunks and use the added space for more copies.

The main trade-off is extra cost. Replication uses more storage and network traffic. Repair and rebalancing also compete with normal file requests. We accept this cost because it improves durability and availability.

Engineering Considerations / Design Trade-offs

The benefit is that file chunks have copies in several regions. Reads can continue when one server or region fails. The Hot File Cache also makes popular file lookups faster. The downside is higher cost. Every replica uses more storage and network traffic. Repair and rebalancing move large chunks in the background. That work can slow normal reads and writes. Leases and version checks protect updates, but they add more control work. We accept these costs because keeping files safe is more important than using the least possible capacity.

Why Interviewers Ask This

Interviewers use this question to test how you divide a large storage problem into clear parts. They want to see whether you separate metadata from file data. They also check how you place replicas, control writes, handle hot files, repair failures, rebalance storage, and add capacity. A strong candidate explains the normal flow first, then discusses failures and trade-offs without promising perfect availability.

Interviewer may ask next
What would change if users must always read their newest file version immediately after a write?

I would keep the same architecture, but I would make version checks stricter. The Consistency Coordinator would confirm the current version before the File Service API reads any chunks. The Metadata Service would return only locations that belong to that version.

The write path would still begin with write intent. A lease would give one writer temporary control. After the chunk data is stored, the Metadata Store must record the new chunk map and version before the write is reported as complete.

The Hot File Cache must also include the file version in its saved entry. The Metadata Service should ignore a cached entry when its version is old. It would then use the Metadata Store and refresh the cache.

This keeps a read from returning an older file after a completed write. The downside is more metadata checks. Reads may become slower, especially when regions are far apart or the cache contains an older version.

How would the system respond if an entire storage region became unavailable?

The system would read from chunk replicas in the remaining Storage Regions. The Failure Detector would notice missing heartbeats from the unavailable region. It would then report the failure to Repair Workers.

The Metadata Service would use its replica map to find healthy copies in other regions. The File Service API could read those copies instead. The Chunk Placement Manager should avoid the failed region when placing new chunks.

Repair Workers would create replacement copies on healthy chunk servers. After each copy is ready, they would update the replica map in the Metadata Service. The Replication Manager would help restore the needed copies across regions. The Rebalancer could later spread the extra load more evenly.

When the failed region returns, version checks should confirm that its old chunks are still current. The downside is temporary pressure on healthy regions. Repair traffic also uses network capacity that normal file requests need.

37. Design a real-time multiplayer game backend.System DesignHardGoogle

Question Details

Explain matchmaking, authoritative game state, low-latency communication, regional placement, cheating prevention, persistence, and failure recovery.

Short Interview Answer (30-60 seconds)

At a high level, this system matches players and runs one shared game near them. The main challenge is keeping the game correct while sending updates with very little delay. I would explain three flows: matchmaking and regional placement, live gameplay, and recovery from saved state. The Realtime Gateway carries player traffic. Anti-Cheat + Validation checks actions before the Authoritative Game Server applies them. The trade-off is extra complexity across regions, storage, monitoring, and recovery.

Detailed Explanation

The system must place matched players in a suitable region and run their game with low delay. The difficult part is keeping one correct game state while many clients send actions quickly. The diagram solves this through matchmaking, regional placement, a server-controlled gameplay path, saved state, and recovery.

Useful Questions to Ask the Interviewer
  1. Which user flows and system capabilities are required for the first version?
  2. What traffic, data volume, latency, and availability targets should I design for?
  3. Which consistency, security, geographic, and cost constraints matter most?
Design a real-time multiplayer game backend. diagram
How to Explain It in an Interview
1. Explain the main idea

I would start by saying the game server controls the final result. The Player Client sends actions, but it cannot directly change the game state. This keeps all players on the same version of the match.

Low delay is also important. Regional Placement sends the session to a suitable regional cluster. The Player Client then communicates with that cluster during the match.

2. Explain matchmaking and placement

The Player Client first reaches the Global Edge Router. The request then passes through the Auth + Session Service. This confirms the player session before matchmaking starts.

The Matchmaking Service groups players for a match. It sends skill, party, and player profile information to the Player Data Store. It also asks Regional Placement to find the best region.

Regional Placement compares Region A, Region B, and Region C. The diagram highlights Region B. It assigns that region and the game session to the Realtime Gateway.

3. Explain the live gameplay path

After placement, the Player Client joins the selected region. The Realtime Gateway manages the live connection.

Player actions move from the gateway to Anti-Cheat + Validation. This component checks whether each action is allowed. Valid actions then reach the Authoritative Game Server.

The Authoritative Game Server owns the official game state. It decides movement, damage, scores, and other results. It sends the updated state back to the Realtime Gateway.

The gateway then sends low-latency updates to the Player Client. This keeps gameplay fast without trusting the client to decide outcomes.

4. Explain persistence and recovery

The Authoritative Game Server saves checkpoints in the State Snapshot Store. A checkpoint is a saved copy of the current match state.

The server also saves match results and progress in the Player Data Store. This keeps long-term player data outside the live game process.

If the game server fails, Session Recovery reads the latest session snapshot. It then restores the session on the Authoritative Game Server. Actions after the latest snapshot may need to be repeated or may be lost.

5. Explain monitoring and trade-offs

Observability & Monitoring receives signals from the Global Edge Router, Player Data Store, Session Recovery, and State Snapshot Store. This helps the team find routing, storage, and recovery problems.

The benefit is fast gameplay with strong server control. The downside is more complexity. Placement, snapshots, storage, and recovery must work together correctly.

Engineering Considerations / Design Trade-offs

The benefit is fast gameplay and one clear owner for game state. Anti-Cheat + Validation checks actions before the server accepts them. Regional Placement also reduces network delay for many players. Snapshots help restore a failed session. The downside is extra complexity. Several services and stores must stay connected. A recovered match may restart from an older snapshot, so a few recent actions could be missing. Monitoring helps teams find problems, but it does not remove failures. We accept these costs because trusting each client would make cheating and inconsistent game state much harder to control.

Why Interviewers Ask This

Interviewers use this question to test how you divide a fast, stateful system into clear flows. They want to see whether you understand server-controlled game state, regional placement, cheating checks, saved progress, and failure recovery. They also look for good judgment. A strong candidate explains what must stay fast, what must stay correct, and which trade-offs are acceptable.

Interviewer may ask next
How would the design change if players from different continents must join the same match?

I would keep the same architecture, but Regional Placement would use a different rule. It could not choose the closest region for every player. Instead, it would choose the fairest region for the whole group.

The Matchmaking Service would consider each player’s location before creating the session. Regional Placement would compare Region A, Region B, and Region C. It would select the region with the best shared delay across all players.

The Player Client would still join through the Realtime Gateway. Anti-Cheat + Validation and the Authoritative Game Server would stay unchanged. One server would still own the official game state.

Correctness remains the same because every player sends actions to one regional game cluster. The main downside is higher delay for some players. Matchmaking may also take longer because it must balance skill, party needs, and network location.

What happens if the Authoritative Game Server fails during an active match?

I would recover the match from the latest saved checkpoint. The State Snapshot Store already keeps copies of the session state.

When the server fails, Session Recovery reads the latest session snapshot. It then restores the session on an Authoritative Game Server. The Realtime Gateway can continue the live connection after the recovered server is ready.

Anti-Cheat + Validation still checks new actions before sending them to the server. Match results and progress still go to the Player Data Store. This keeps the recovered match consistent with the original design.

Only one restored server should control the official game state. Players must not continue sending actions to the failed server.

The main downside is a short pause during recovery. Some actions after the latest snapshot may also be lost.

38. Design a large-scale email service.System DesignHardGoogle

Question Details

Explain message acceptance, mailbox storage, spam filtering, search, attachment handling, delivery retries, synchronization, and reliability.

Short Interview Answer (30-60 seconds)

At a high level, this service must accept email, store it safely, and deliver it reliably. The main challenge is keeping user actions fast while search indexing, delivery, and retries run in the background. I would explain three flows: accepting and storing messages, reading and searching mailboxes, and delivering mail to external servers. The Mailbox Service connects these flows. Separate attachment storage and background workers keep the main path focused. The downside is more services to operate and monitor.

Detailed Explanation

The goal is to accept incoming and outgoing email, store each mailbox safely, and keep messages easy to read and search. The difficult part is that one message starts several kinds of work. The system may filter spam, store attachments, update search, synchronize clients, and deliver mail to another server. The diagram separates these jobs into the acceptance path, the user access paths, and the background delivery and reliability paths.

Useful Questions to Ask the Interviewer
  1. Which user flows and system capabilities are required for the first version?
  2. What traffic, data volume, latency, and availability targets should I design for?
  3. Which consistency, security, geographic, and cost constraints matter most?
Design a large-scale email service. diagram
How to Explain It in an Interview
1. Explain the entry path

I would begin with how users enter the service. Mail Clients send requests through the Load Balancer. It spreads requests across the available service instances.

Auth + Rate Limits checks access and controls heavy use. The Mail API + Sync Gateway then handles send, read, search, and synchronization requests. This front path protects the services behind it.

2. Explain message acceptance and storage

For the send path, the Mail API + Sync Gateway sends the message to Message Acceptance. External Mail Servers also send inbound mail into Message Acceptance.

The Spam Filter checks the message before mailbox storage. The message then passes through the Attachment Service. That service places attachment data in the Attachment Store.

After acceptance, the Mailbox Service stores mailbox data in Mailbox Storage. This separates normal mailbox records from larger attachment files. The separation keeps common mailbox work easier to manage.

3. Explain mailbox reads, search, and synchronization

For mailbox reads, the Mail API + Sync Gateway calls the Mailbox Service. The Mailbox Service reads the stored mailbox data and serves the requested content.

Search follows a separate path. The gateway sends the query to the Search Service. The Search Service queries the Search Index and returns matching messages.

The Search Indexer updates the Search Index from mailbox content. This indexing work runs outside the main acceptance path. A newly accepted message may therefore need a short time before appearing in search.

The Mailbox Service also sends changes to the Sync Service. The Sync Service returns sync updates to Mail Clients. This keeps different client devices aligned with the mailbox.

4. Explain outbound delivery and retries

For outbound delivery, the Mailbox Service creates an outbound delivery job. The Delivery Queue holds that job until a worker is ready.

Delivery Workers take queued jobs and send messages to External Mail Servers. If delivery fails, the job moves to Retry with Backoff. Backoff means the system waits before trying again.

The retry path sends the job back to the Delivery Queue. If the maximum retry limit is reached, the job moves to Failed Deliveries. This stops one unreachable server from blocking other delivery work.

5. Explain reliability and monitoring

Mailbox Storage, Attachment Store, and Search Index connect to Replication + Backup. Replication keeps extra copies. Backups help restore data after damage or loss.

Observability + Alerts receives signals from the Load Balancer, Mailbox Service, Delivery Workers, and Sync Service. This helps the team find slow requests, delivery failures, and synchronization problems.

The benefit is that slow background work does not block normal user requests. The downside is that queues, indexes, retries, backups, and monitoring add more operational work.

Engineering Considerations / Design Trade-offs

The benefit is that each part has one clear job. Search indexing does not slow message acceptance. Delivery retries do not block mailbox reads. Separate attachment storage also keeps large files away from normal mailbox records. Replication and backups make stored data safer. The downside is more moving parts. The Delivery Queue can grow when workers are slow. Search can be slightly behind because the Search Indexer runs in the background. Retry with Backoff can delay a failed message for longer. Observability helps find these problems, but the team must maintain every service and background path.

Why Interviewers Ask This

Interviewers ask this question to see how you divide a large product into clear flows. They want to test your understanding of storage, search indexing, queues, retries, synchronization, backups, and monitoring. They also want to know whether you can keep user requests separate from slower background work. Most importantly, they check whether you can explain technical choices and trade-offs in simple language.

Interviewer may ask next
How would the design handle an external mail server outage lasting several hours?

I would keep the same design and let the delivery path absorb the outage. The Mailbox Service would still create an outbound delivery job after accepting and storing the message. The Delivery Queue would keep that job until a Delivery Worker could process it.

When the worker cannot reach the External Mail Servers, the job would move to Retry with Backoff. The waiting time should grow after repeated failures. This prevents the workers from sending constant requests to a server that is still unavailable.

The job would then return to the Delivery Queue for another attempt. Observability + Alerts should track queue growth, failed attempts, and worker health. The original message remains stored through the Mailbox Service and Mailbox Storage, so the user does not lose it.

After the retry limit is reached, the job moves to Failed Deliveries. The main downside is delayed delivery. A long outage can also create a large queue that takes time to clear after recovery.

How would you handle a very large increase in mailbox search traffic?

I would keep search separate from normal mailbox reads. Search requests would still enter through the Mail API + Sync Gateway and go to the Search Service. The Search Service would query the Search Index instead of scanning Mailbox Storage for every request.

The Search Indexer would continue updating the index from mailbox content in the background. This protects the Mailbox Service from heavy search work. Replication + Backup would keep recoverable copies or support rebuilding the Search Index after a failure.

Observability + Alerts should track search response time and indexing delays. The mailbox read path would remain available even when search traffic becomes heavy.

Correctness comes from building the index from mailbox content. A newly accepted message may not appear in search immediately, but it can still appear through the normal mailbox read path. The main downside is that search results may be slightly behind the mailbox because indexing runs separately.

39. Design a global feature-flag platform.System DesignHardGoogle

Question Details

Explain configuration writes, low-latency reads, targeting rules, staged rollout, audit history, consistency, caching, and safe rollback.

Short Interview Answer (30-60 seconds)

At a high level, this platform lets teams change application behavior without deploying new code. The main challenge is making flag updates safe while keeping reads very fast worldwide. I would explain it in three flows: writing a configuration, distributing it globally, and evaluating flags inside applications. The Feature-Flag Service records each change and controls staged rollouts. Regional and local caches make reads fast. The trade-off is that cached data may briefly be older than the latest configuration.

Detailed Explanation

The goal is to manage feature flags safely across many regions. Teams must be able to update flags, release changes in stages, and quickly undo a bad rollout. Applications may check flags on every request, so the read path must stay very fast. The diagram solves this with a controlled write path, global configuration distribution, a cached read path, and a clear rollback flow.

Useful Questions to Ask the Interviewer
  1. Which user flows and system capabilities are required for the first version?
  2. What traffic, data volume, latency, and availability targets should I design for?
  3. Which consistency, security, geographic, and cost constraints matter most?
Design a global feature-flag platform. diagram
How to Explain It in an Interview
1. Explain the main design idea

I would begin by separating safe writes from fast reads. Flag changes happen less often, but each change must be checked and recorded. Flag evaluations happen much more often, so they should use nearby cached data.

The Configuration Store keeps the main flag configuration. Audit History records each change and keeps previous versions. The caches improve speed, but they are not the main source of configuration.

2. Explain the configuration write path

For the write path, an administrator starts in the Admin Console. The request goes through the API Gateway and then Auth + Validation. This step checks access and confirms that the new configuration is valid.

The request then reaches the Feature-Flag Service. It writes or updates flags in the Configuration Store. It also records the change in Audit History.

For a gradual release, the Feature-Flag Service defines a staged rollout through the Rollout Manager. The Rollout Manager publishes that rollout plan to Global Replication. This lets the platform release a feature in controlled steps.

3. Explain global distribution and consistency

The diagram shows consistent, versioned configuration moving from the Configuration Store through Audit History to Global Replication. A version gives each configuration change a clear identity and order.

Global Replication sends the configuration to Regional Flag Cache. These regional caches place flag data closer to applications. This reduces read time and keeps heavy read traffic away from the write path.

A new version may need a short time to reach every region. During that time, one region may still use an older version. The system accepts this small delay to keep reads fast and available.

4. Explain the low-latency read path

For the read path, Application Clients ask the SDK / Read API to evaluate a feature flag. The SDK uses its Local Cache first. This is the fastest path because the flag data is already close to the application.

The Local Cache sends cached flag data to Targeting Rules. These rules choose the correct flag result for the current request or user. The SDK / Read API then returns the resolved flag to Application Clients.

Regional Flag Cache supplies low-latency configuration data to the SDK / Read API. This gives applications fresh regional data without contacting the Configuration Store for every evaluation.

5. Explain rollback and monitoring

Audit History sends previous versions to the Rollback Controller. If a rollout causes problems, the controller sends a safe rollback request to the Feature-Flag Service. The service can restore an earlier version through the normal write and distribution path.

Observability & Monitoring receives signals from the API Gateway, Feature-Flag Service, Global Replication, and SDK / Read API. This helps operators detect errors, slow distribution, and bad rollouts.

The main trade-off is clear. Caching makes reads very fast, but some applications may briefly use an older configuration while a new version is being distributed.

Engineering Considerations / Design Trade-offs

The benefit is fast flag evaluation. Regional and local caches keep most reads close to the application. Staged rollout also lowers risk because a feature can reach users slowly. Audit History and the Rollback Controller make recovery easier. The downside is that cached data may briefly be older than the latest version. Global distribution also adds more parts to operate and monitor. We accept this because flag checks happen very often. Versioned configuration helps the team understand which update each region is using.

Why Interviewers Ask This

Interviewers use this question to test whether you can separate safe writes from fast reads. They want to see how you handle caching, global distribution, targeting rules, staged rollout, audit history, and rollback. They also check whether you can explain small consistency delays and choose clear responsibilities for each component. The main goal is to test judgment and trade-off thinking.

Interviewer may ask next
How would the design change if every application had to see a new flag version as soon as possible?

I would keep the same components, but I would make the read path refresh cached data more aggressively. After the Feature-Flag Service saves a new configuration, Global Replication would send it to Regional Flag Cache immediately.

The SDK / Read API would refresh its Local Cache from the regional cache before evaluating flags when a new configuration is expected. Targeting Rules would still use the same flag data and return the resolved result to Application Clients.

The Configuration Store would remain the main source of configuration. Audit History would still record every change, and rollback would still use the existing Rollback Controller and Feature-Flag Service path.

This makes new settings visible faster. The downside is more traffic between the SDK / Read API and Regional Flag Cache. Reads may also become slower during large updates because fewer requests can use older local data.

What should happen if a staged rollout causes errors in one region?

I would stop the staged rollout before it reaches more users. Observability & Monitoring would help the team connect the errors to the current flag version or rollout step.

Audit History keeps the previous configurations. The Rollback Controller can select the last safe version and send a safe rollback request to the Feature-Flag Service. The service writes that older version through the normal configuration path.

Global Replication then sends the restored configuration to Regional Flag Cache. The SDK / Read API receives the corrected data and updates its Local Cache. Targeting Rules continue evaluating flags with the available configuration during this process.

This keeps the recovery path controlled and easy to trace. The main downside is that some applications may use the bad cached version for a short time. Faster refresh reduces that delay, but it creates more work during the incident.

40. Tell me about a time you stopped or cancelled work after learning it would not create enough value.BehavioralMediumGoogle

Interview tip:

Use STAR to structure your answer: briefly explain the Situation and Task, make Action the most detailed part, and finish with the Result. For example, describe a project where new evidence showed that planned work would provide little user value, how you evaluated the evidence, discussed the decision with stakeholders, stopped the work responsibly, redirected effort, and protected the team from unnecessary development.

Situation

In my last role, our team planned to build a Python service that would generate a custom daily report for internal users. The request had been approved because several people said the existing reporting process was slow. After we started the technical design, I reviewed the actual usage data and spoke with the people who had requested the feature. I learned that most users needed the report only during a rare review process, and the existing dashboard already contained nearly all the required information.

Task

I was responsible for designing the service and estimating the development work. I needed to decide whether the feature was still worth building and make sure the team did not spend time on work that would provide little value.

Action

I first confirmed the problem instead of relying only on the original request. I reviewed report access patterns, compared the requested fields with the existing dashboard, and asked users to show me the steps that caused difficulty. This showed that the main issue was not missing data. The real issue was that users did not know how to save and reuse dashboard filters. I documented what I found and compared two options. The first option was a new Python service with scheduled jobs, data storage, monitoring, and ongoing support. The second option was a small dashboard update with saved filters and clear instructions. I explained the cost, maintenance needs, and expected value of each option to the product owner and engineering team. I recommended cancelling the new service because it would duplicate existing capabilities and create a new system to maintain. Some team members were concerned because design work had already started, so I made it clear that stopping early was a useful outcome, not wasted effort. I also proposed a simple replacement plan. We added saved filter presets, improved the dashboard labels, and created a short guide for the review process. I then closed the service tasks and recorded the decision so the same request would not restart without new evidence.

Result

The team agreed to cancel the Python service and used the available time for work with clearer user value. The smaller dashboard change solved the actual problem without adding another service to operate. I learned that ownership includes stopping work when the evidence changes. It is better to make that decision early, explain it clearly, and offer a simpler solution than to continue only because work has already begun.

Why Interviewers Ask This

Interviewers ask this question to evaluate whether a candidate can challenge planned work, use evidence to judge value, and avoid unnecessary engineering. A strong answer shows practical judgment, responsible communication, comfort with changing direction, and the ability to protect team time without ignoring the user problem.

Interviewer may ask next
How did you handle team members who felt the design work would be wasted?

I acknowledged that concern and explained that the design work helped us understand the real cost before implementation began. I focused the discussion on future value rather than past effort. I also preserved the useful findings in the decision record, so the work could support a later review if user needs changed.

What would you do differently in a similar situation now?

I would validate the frequency and impact of the user problem before starting the technical design. I would ask users to demonstrate the current process, review available usage data, and define what success would look like. That would help the team identify a smaller solution even earlier.

More questions load as you scroll

Disclaimer: This interview guide is for educational and informational purposes only. It is designed to help readers prepare, but it does not guarantee any interview result, hiring decision, offer, or outcome. Interview questions, hiring criteria, and preferred answers can vary by employer, interviewer, industry, location, and time. The examples and explanations reflect the authors' research and judgment, are provided without warranties of any kind, and should not be treated as the only correct approach. Diagrams are simplified illustrations intended to highlight the main components and their interactions; actual systems and implementations may be more complex. Alternative approaches may be equally valid or better suited to a particular question, context, or interviewer. To the fullest extent permitted by applicable law, the author, contributors, and publisher are not liable for decisions made, actions taken, or losses incurred based on this guide.

Company Notice: This guide is an independent educational resource and is not affiliated with, endorsed by, sponsored by, or approved by the company named in this guide. Company names are used only to identify interview experiences commonly reported by candidates. Interview practices can change without notice, and inclusion of company-specific content does not mean these questions are official, complete, or guaranteed to be asked. To the fullest extent permitted by law, the author, contributors, and publisher are not responsible for outcomes related to use of this material.