API Gateway and Service Mesh interview questions

28 questions from the API Gateway and Service Mesh course, each with the correct answer and an explanation. Try to answer before you open the answer.

Gateways and Meshes: the Big Picture

1. What does "east-west" traffic mean?

  1. Traffic between two data centres only
  2. Requests from the internet to the edge
  3. Service-to-service calls inside the system
  4. Email traffic
Show answer

Answer: Service-to-service calls inside the system

East-west is internal; north-south enters from outside.

Lesson: Why Gateways and Meshes Exist

2. Which belongs in an API gateway?

  1. Authentication, rate limiting and routing
  2. Order pricing business rules
  3. Database migrations
  4. UI design
Show answer

Answer: Authentication, rate limiting and routing

Cross-cutting policy fits the gateway; business rules belong in services.

Lesson: What an API Gateway Does

3. What is the data plane in a service mesh?

  1. The Git repository
  2. The dashboard
  3. The database
  4. The proxies that carry and police service traffic
Show answer

Answer: The proxies that carry and police service traffic

Data plane = traffic path; control plane = configuration brain.

Lesson: What a Service Mesh Does

4. Which is mainly about service-to-service traffic inside a cluster?

  1. CDN
  2. Service mesh
  3. DNS registrar
  4. Email gateway
Show answer

Answer: Service mesh

A mesh governs east-west calls; gateways and ingress handle the edge.

Lesson: Gateway vs Mesh vs Load Balancer vs Ingress

Routing, Rewriting and Traffic Splitting

5. Why were fake upstream services used for the demos?

  1. Real services cannot be proxied
  2. They let the gateway behaviour be shown repeatably, including failures and slowness
  3. Gateways only work with Node.js
  4. To avoid learning HTTP
Show answer

Answer: They let the gateway behaviour be shown repeatably, including failures and slowness

Controllable upstreams make failures, slowness and versions easy to reproduce.

Lesson: The Demo Environment

6. What is a risk of header-based routing?

  1. It removes the need for auth
  2. Headers cannot be read
  3. It makes TLS impossible
  4. Public clients may forge the header to reach unintended backends
Show answer

Answer: Public clients may forge the header to reach unintended backends

Treat routing headers as untrusted unless the edge sets or validates them.

Lesson: Routing by Path and Header

7. Why generate a request ID at the gateway?

  1. To trace one request across logs and services
  2. To encrypt the body
  3. To limit the rate
  4. To rewrite the path
Show answer

Answer: To trace one request across logs and services

A shared ID ties together every log line produced for one request.

Lesson: Prefix Stripping and Header Injection

8. What is the main benefit of a canary release?

  1. It makes servers faster
  2. It removes the need for tests
  3. A bad release affects only a small share of users and can be reverted quickly
  4. It hides errors
Show answer

Answer: A bad release affects only a small share of users and can be reverted quickly

Gradual exposure limits blast radius and gives real-world evidence.

Lesson: Weighted Traffic Splitting for Canaries

Security at the Edge

9. Which status should the gateway return for a request with no credentials?

  1. 204 No Content
  2. 403 Forbidden
  3. 401 Unauthorized
  4. 302 Found
Show answer

Answer: 401 Unauthorized

401 means the caller is not authenticated; 403 means authenticated but not allowed.

Lesson: Authentication at the Gateway

10. What does the burst setting control?

  1. How many requests above the steady rate can be accepted instantly
  2. The size of response bodies
  3. The TLS version
  4. The log format
Show answer

Answer: How many requests above the steady rate can be accepted instantly

Burst absorbs short spikes while the rate limits the long-run average.

Lesson: Rate Limiting at the Gateway

11. Why avoid `Access-Control-Allow-Origin: *` for credentialed APIs?

  1. It disables caching only
  2. It slows TLS
  3. It is not valid HTTP
  4. It would let any website call the API from a user's browser
Show answer

Answer: It would let any website call the API from a user's browser

Wildcard origins weaken the browser protection that CORS provides.

Lesson: TLS Termination, WAF and CORS

Resilience: Timeouts, Retries, Breakers, Balancing

12. Why should inner timeouts be shorter than outer ones?

  1. Shorter is always more accurate
  2. Inner calls give up and report before the outer caller times out
  3. It saves bandwidth only
  4. It is required by HTTP
Show answer

Answer: Inner calls give up and report before the outer caller times out

Otherwise outer layers time out while inner work continues uselessly.

Lesson: Timeouts and Latency Budgets

13. Why is retrying at every layer dangerous?

  1. Retries are not allowed in HTTP
  2. Retries multiply, turning one request into many and overloading the failing service
  3. Retries make responses smaller
  4. It only affects logging
Show answer

Answer: Retries multiply, turning one request into many and overloading the failing service

Layered retries amplify load exponentially during an outage.

Lesson: Retries, Idempotency and Retry Storms

14. What does an open circuit breaker do?

  1. Encrypts the call
  2. Sends all traffic faster
  3. Deletes the service
  4. Rejects calls immediately to protect the failing service and callers
Show answer

Answer: Rejects calls immediately to protect the failing service and callers

Fast failure gives the dependency time to recover and keeps callers responsive.

Lesson: Circuit Breakers and Outlier Detection

15. Why use consistent hashing for a cache cluster?

  1. Adding or removing a node moves only a small share of keys
  2. It makes every key unique
  3. It removes the need for hashing
  4. It encrypts keys
Show answer

Answer: Adding or removing a node moves only a small share of keys

Limited key movement avoids mass cache misses when the cluster changes.

Lesson: Load Balancing Algorithms and Consistent Hashing

Service Mesh in Practice

16. What does mTLS add compared with ordinary TLS?

  1. It makes traffic public
  2. It removes encryption
  3. The client also proves its identity with a certificate
  4. It replaces DNS
Show answer

Answer: The client also proves its identity with a certificate

Both ends are authenticated, enabling identity-based policy.

Lesson: Mutual TLS and Workload Identity

17. What is an advantage of declaring traffic policy as resources?

  1. It removes the need for services
  2. It prevents all outages
  3. It is reviewable in Git and changes without redeploying applications
  4. It makes YAML optional
Show answer

Answer: It is reviewable in Git and changes without redeploying applications

Policy-as-config is versioned, auditable and decoupled from application releases.

Lesson: Traffic Management as Configuration

18. What does "default deny" between services mean?

  1. Calls are blocked unless a policy explicitly allows them
  2. All calls are always allowed
  3. Calls are logged only
  4. Only HTTP/1.0 works
Show answer

Answer: Calls are blocked unless a policy explicitly allows them

Explicit allow-lists reduce what a compromised service can reach.

Lesson: Service-to-Service Authorisation

19. Why must applications propagate trace headers?

  1. Tracing needs no headers
  2. Headers make requests faster
  3. It is only for HTTPS
  4. Proxies cannot link incoming and outgoing calls into one trace on their own
Show answer

Answer: Proxies cannot link incoming and outgoing calls into one trace on their own

Only the application knows which outgoing call belongs to which incoming request.

Lesson: Observability: Golden Signals and Tracing

Choosing and Operating

20. When is a service mesh probably unnecessary?

  1. With hundreds of services in many languages
  2. With a handful of services owned by one team
  3. When mTLS everywhere is mandated
  4. When teams need uniform retries and telemetry
Show answer

Answer: With a handful of services owned by one team

A mesh adds complexity that pays off at larger scale and with polyglot teams.

Lesson: Choosing a Gateway or Mesh

21. Why validate gateway configuration before applying it?

  1. Validation makes traffic faster
  2. One bad rule can break every API behind the gateway
  3. Gateways cannot be configured otherwise
  4. It replaces monitoring
Show answer

Answer: One bad rule can break every API behind the gateway

The gateway is shared by many services, so mistakes have a wide blast radius.

Lesson: Running It: Availability, Config and Upgrades

22. Which is a typical gateway anti-pattern?

  1. Rate limiting
  2. Terminating TLS there
  3. Adding request IDs
  4. Putting business logic in the gateway
Show answer

Answer: Putting business logic in the gateway

Gateways should hold thin policy, not application rules.

Lesson: Common Pitfalls and Failure Drills

Gateway Patterns and Progressive Delivery

23. What is the aim of the BFF pattern?

  1. Give each client type an API shaped to its needs, with fewer round trips
  2. Replace all microservices
  3. Remove the gateway
  4. Encrypt databases
Show answer

Answer: Give each client type an API shaped to its needs, with fewer round trips

A tailored aggregation layer reduces chattiness and client complexity.

Lesson: Backend for Frontend and Aggregation

24. What is traffic mirroring used for?

  1. Encrypting traffic
  2. Doubling user-visible responses
  3. Testing a new version with real traffic copies without affecting users
  4. Caching static files
Show answer

Answer: Testing a new version with real traffic copies without affecting users

Mirrored responses are discarded, so only the test target is exercised.

Lesson: Shadowing, Blue-Green and Progressive Delivery

Putting It Together

25. In the design, where are retries performed and why?

  1. Nowhere
  2. At every layer for maximum safety
  3. At one layer, only for idempotent calls, to avoid amplification
  4. Only in the browser
Show answer

Answer: At one layer, only for idempotent calls, to avoid amplification

Single-layer, idempotent-only retries avoid retry storms and duplicate side effects.

Lesson: Case Study: Designing the Edge for an Orders Platform

26. A downstream service is failing. Calls pile up and the gateway runs out of connections. Which combination helps most?

  1. Timeouts plus a circuit breaker with a fallback
  2. Longer timeouts and more retries
  3. Disable health checks
  4. Remove rate limits
Show answer

Answer: Timeouts plus a circuit breaker with a fallback

Fail fast and stop calling the broken dependency so resources are freed.

Lesson: Revision: Cheat Sheet and Self-Check

27. Why is `hash(key) % N` a poor way to pick a cache server when N changes?

  1. It makes keys longer
  2. It is too slow to compute
  3. It is illegal
  4. Most keys map to a different server, causing mass cache misses
Show answer

Answer: Most keys map to a different server, causing mass cache misses

Consistent hashing moves only about 1/N of keys when a node is added.

Lesson: Revision: Cheat Sheet and Self-Check

28. What does a mesh need so that services can trust the identity of callers?

  1. Shared passwords in code
  2. mTLS with workload certificates issued by the mesh CA
  3. IP address allow-lists only
  4. Longer DNS names
Show answer

Answer: mTLS with workload certificates issued by the mesh CA

Cryptographic identities allow policies that do not depend on network location.

Lesson: Revision: Cheat Sheet and Self-Check

← Back to the course