Place Extent Group Replicas Across Distinct Rack Fault Domains

Last updated: November 29, 2026

Quick Overview

Given nodes as (node_id, rack_id, free_bytes), choose rf nodes on pairwise distinct racks that each have room for a new extent group of a given size, preferring nodes with the most free space. Then place a sequence of extent groups, updating free space after each placement.

Nutanix
Coding & Algorithms
Software Engineer
Nutanix
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given nodes as (node_id, rack_id, free_bytes), choose rf nodes on pairwise distinct racks that each have room for a new extent group of a given size, preferring nodes with the most free space. Then place a sequence of extent groups, updating free space after each placement.

With rack awareness enabled, the storage fabric must keep every replica of a piece of data in a different rack so a single rack failure never loses all copies under RF2 or RF3. The interviewer checks that you reduce the constraint correctly (best node per rack, then top rf racks) and think about balance and capacity exhaustion.

What the Interviewer Expects
  • Observes that only the best candidate per rack can matter
  • Uses a heap or sort to pick the top rf racks
  • Filters nodes without enough free space before grouping
  • Returns a clear failure when fewer than rf racks qualify
  • Updates free space for sequential placements and discusses imbalance
Key Topics to Cover
greedy selection
heaps
fault domains
replication factor
capacity planning
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • The local node should hold one replica for data locality. How does the selection change?
  • How would you avoid every new write landing on the same emptiest node?
  • Racks have different numbers of nodes. Can greedy placement strand capacity?
  • How would you re-place replicas after a rack is lost?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Each replica needs free >= size. No two replicas may share a rack. Among valid choices, maximize free space (a simple balancing heuristic). Return the chosen node ids or None. A second function pl...

High-Level Design

Key observation: if a rack contributes a replica, it should contribute its node with the most free space, since swapping in any other node from that rack only lowers free space. So: filter by capacity...


Submit Your Answer
Markdown supported

Related Questions