Design problem related to Nutanix team

Difficulty: MEDIUMCategory: LLDFrequency: 1Asked On 2020-06-26

Problem Statement

Design a Cluster Resource Management System that manages compute, storage, and network resources across multiple nodes in a Nutanix-style hyperconverged infrastructure (HCI).


The system should efficiently allocate, track, and balance workloads across the cluster.


🧩 Context


Nutanix clusters contain multiple nodes (servers), each with finite CPU, memory, and disk resources.


Virtual machines (VMs) or workloads need to be scheduled and balanced across nodes, ensuring:


β€’No node is overloaded.
β€’Failover is possible in case of node failure.
β€’Resource usage is tracked accurately.


You need to design a set of classes that simulate this cluster and resource management system.


βœ… Functional Requirements


1.The system consists of multiple nodes, each with specific:
β€’CPU cores
β€’Memory capacity
β€’Storage capacity
2.Support adding/removing nodes from the cluster.
3.Allow creating a VM with specific resource requirements (CPU, memory, storage).
4.Assign VMs to appropriate nodes based on available capacity.
5.Support migrating a VM from one node to another (for load balancing).
6.If a node fails, its VMs should be redistributed automatically.
7.Provide APIs to:
β€’View node resource usage.
β€’List all VMs and their assigned nodes.


βš™οΈ Non-Functional Requirements


AspectRequirement


Scalability

Support clusters with dozens of nodes and hundreds of VMs.


Reliability

Should handle node failure gracefully.


Extensibility

Should allow addition of scheduling algorithms (e.g., round-robin, least-load).


Maintainability

Clean class boundaries for Nodes, VMs, and Cluster logic.


🧱 Core Classes


ClassResponsibility


ClusterManager

Manages all nodes and coordinates VM placement and failover.


Node

Represents a single compute node with resources and a list of VMs.


VM

Represents a virtual machine with defined resource needs.


Scheduler

Determines which node a VM should be assigned to based on policy.


HealthMonitor

Detects node failures and triggers failover logic.


🧾 Example Class Diagram (Text Representation)

1 2β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” 3β”‚ VM β”‚ 4│────────────────────────│ 5β”‚ + id: String β”‚ 6β”‚ + cpu: int β”‚ 7β”‚ + memory: int β”‚ 8β”‚ + storage: int β”‚ 9β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ 10 11β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” 12β”‚ Node β”‚ 13│────────────────────────│ 14β”‚ + id: String β”‚ 15β”‚ + totalCpu: int β”‚ 16β”‚ + totalMemory: int β”‚ 17β”‚ + totalStorage: int β”‚ 18β”‚ + usedCpu: int β”‚ 19β”‚ + usedMemory: int β”‚ 20β”‚ + usedStorage: int β”‚ 21β”‚ + vms: List<VM> β”‚ 22│────────────────────────│ 23β”‚ + canHost(vm): boolean β”‚ 24β”‚ + addVM(vm): void β”‚ 25β”‚ + removeVM(vm): void β”‚ 26β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ 27 28β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” 29β”‚ ClusterManager β”‚ 30│────────────────────────│ 31β”‚ + nodes: List<Node> β”‚ 32│────────────────────────│ 33β”‚ + addNode(node): void β”‚ 34β”‚ + removeNode(id): void β”‚ 35β”‚ + createVM(vm): void β”‚ 36β”‚ + migrateVM(vmId, targetNode): void β”‚ 37β”‚ + rebalance(): void β”‚ 38β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ 39 40β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” 41β”‚ Scheduler β”‚ 42│────────────────────────│ 43β”‚ + selectNode(vm, nodes): Node β”‚ 44β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


πŸ”„ Workflow Example


1.Add 3 nodes to the cluster.
2.Create a new VM that requires 2 CPUs, 4GB RAM, and 100GB disk.
3.ClusterManager calls Scheduler to find a node with sufficient resources.
4.Node.addVM() updates its used resources.
5.If a node fails, HealthMonitor detects it and calls ClusterManager.rebalance() to redistribute VMs.


🧠 Design Discussion Points


β€’How would you handle node failure detection?
β€’How can you extend it to support different scheduling algorithms?
β€’How would you persist the cluster state?
β€’How can the system evolve to support container orchestration or autoscaling?


🧩 Design Patterns Used


PatternPurpose


Strategy

For different scheduling algorithms (LeastLoadScheduler, RoundRobinScheduler).


Observer

For node health updates triggering failover.


Factory Method

For creating different VM types.


Singleton

ClusterManager can be globally accessible.


βœ… Summary

LLD Problem Statement:
Design a Cluster Resource Manager that can add/remove nodes, allocate virtual machines based on available resources, handle node failures, and rebalance the cluster dynamically.


πŸ”§ Other Nutanix-Themed LLD Problem Ideas


Here are additional LLD problems aligned with Nutanix’s domains (Virtualization, Storage, Cluster Management):


DomainLLD Problem Statement


Storage Systems

Design a Distributed File Storage System that replicates and manages files across multiple nodes.


Backup & Recovery

Design a Snapshot and Backup Manager for VMs with incremental snapshot support.


Networking

Design a Virtual Network Manager that assigns private IPs to VMs and supports routing tables.


Monitoring

Design a Cluster Health Monitoring System to track node CPU, memory, and disk usage, raising alerts.


Caching

Design a Distributed Cache with LRU eviction and node-level sharding.


Logging

Design a Centralized Log Aggregation Service for nodes and VMs.


Replication

Design a Replication Controller that maintains N copies of critical data across nodes.


🧭 Recommended for Nutanix LLD Prep


If you want one go-to Nutanix-style question to prepare deeply:

β€œDesign a Cluster Resource Management System that can allocate workloads (VMs) across nodes based on available resources, detect failures, and rebalance the cluster dynamically.”


That’s 100% Nutanix-relevant, and it tests:


β€’Object-oriented design
β€’Fault tolerance
β€’Resource allocation algorithms
β€’Extensible architectur


Solution

Comments