All Questions
Api Gateway hard

Scaling WebSocket connections at the Gateway layer is challenging because a TCP connection is 'Stateful' (bound to a specific server instance). How do you route a message to a user who is connected to Gateway A from a service that talks to Gateway B?

  1. A By using IP Broadcast to send the message to every Gateway instance in the VPC.
  2. B Through a Pub/Sub Backplane (e.g., Redis or Kafka): All Gateways subscribe to a message bus. When a message for 'User 1' arrives at any Gateway, it is published to the bus, and only the instance holding User 1's socket picks it up.
  3. C By forcing the user's browser to connect to every Gateway instance simultaneously for redundancy.
  4. D By moving the physical TCP socket from Gateway A to Gateway B using the 'BGP Hijacking' technique.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions