Level: Intern
Round: Online Assessment · Type: Coding · Difficulty: 7/10 · Duration: 60 min · Interviewer: Neutral
Topics: Load Balancing, Algorithm Design
Location: Toronto, ON, CA
Interview date: 2026-01-31
I completed an online assessment that involved implementing a load balancer simulation.
I had to implement a function that simulates how a load balancer routes websocket connections to multiple Jupyter servers. The function receives a sequence of textual requests and decides which target server each connection should go to while maintaining internal state. The output is a log of successful connection routings.
The problem was divided into progressive parts:
Part 1 – Basic Load Balancing: Handle only CONNECT. Route each new connection to the server with the fewest active connections. Break ties by smaller server index. Log every successful connect.
Part 2 – Disconnection: Add DISCONNECT. When a connection disconnects, decrease the load of the server it was using. Only CONNECT actions produce log entries.
Part 3 – Object Stickiness: Each connection has an objectId. If another active connection already uses the same objectId, the new one must go to the same server, even if it is not the least loaded. If no active connection exists for that object, use normal load balancing.
Part 4 – Server Capacity Limits: Each server has a maximum number of allowed active connections. A full server cannot accept new connections. If no eligible server is available, the connection is rejected (no log entry, no state change). If stickiness forces a full server, the request is also rejected.
Part 5 – Server Shutdown: Add SHUTDOWN. All active connections on that server are evicted. They must be re-routed one by one using the same routing rules as new connections. Successful re-routes are logged. The shut-down server immediately becomes available again after eviction.