How to secure an API

Difficulty: EASYCategory: DSAFrequency: 1Asked On 2020-10-12

Problem Statement


Design a high-level architecture for a remote test execution and orchestration system that allows Nutanix engineers (or automation systems) to submit test suites/binaries from user machines (or CI pipelines) which are then executed across a pool of distributed worker machines or cloud instances. The system should handle scheduling, resource allocation, execution, result aggregation, and failure handling.


🔹 Context

In the context of Nutanix (storage, cloud infrastructure, HCI), engineers often need to run large sets of functional, integration or system-level tests against clusters, workload simulators or VMs. A centralized platform that automates these test executions across multiple worker nodes ensures consistency, scalability, and faster feedback.


✅ Functional Requirements


1.Job Submission – A user (developer/CI system) uploads a test binary or suite with metadata (version, priority, environment parameters).
2.Worker Pool Management – The platform maintains a set of worker machines (on-prem or cloud) that can execute tests, with available capacity tracked.
3.Scheduling & Execution – Submitted jobs are queued, scheduled to an available worker based on priority, capacity and environment compatibility.
4.Result Collection & Reporting – Execution logs, exit status, test metrics (pass/fail/time) are collected and available for user query.
5.Failure Handling & Retry – If a worker fails, the job should be retried (on another worker or the same) or marked failed with reason.
6.Resource Environment Selection – Jobs may require specific environment configurations (OS version, storage topology, virtual cluster) and the system should match accordingly.
7.Monitoring & Dashboard – A UI/dashboard shows pending jobs, running jobs, worker status, historical results, and usage metrics.


⚙️ Non-Functional Requirements



AttributeDescription


Scalability


Should support hundreds of concurrent test executions.


Availability

System should tolerate worker node failures and keep scheduling.


Performance

Time from submission to job start should be minimized.


Extensibility

Easy to add new test environments, new worker types.


Resource Efficiency

Optimize use of worker nodes (avoid idle/unused capacity).


Security

Secure upload/download of binaries & logs; isolate environments.


🧩 Key Components (High-Level)


•Job Submission API – Accepts job payloads, metadata, validation.
•Job Queue / Scheduler – Maintains a priority queue of jobs, assigns jobs to workers.
•Worker Manager / Registry – Tracks live worker nodes, their environment capabilities (OS, version, hardware), current load.
•Execution Engine (on Worker) – Responsible for pulling job, running tests, streaming logs & metrics, reporting status.
•Result Store & Analytics – Stores logs, metrics, results for retrieval, dashboards, history.
•Dashboard / UI – Visual interface for engineers to submit jobs, monitor status, view logs/results.
•Monitoring & Alerting – Monitors worker health, queue backlog, job failures; alerts on abnormal conditions.


🏗️ High-Level Architecture Overview

1 2[ User / CI ] 3 │ submit job 4 ▼ 5[ Job Submission API ] ──► [ Job Queue / Scheduler ] ──► [ Worker Manager ] ──► [ Worker Nodes ] 6 │ (execute job) 7 ▼ 8 [ Result Store & Analytics ] ─► [ Dashboard / UI ] 9 ▲ 10 │ 11 [ Monitoring & Alerting ]


🧠 Design Discussion Points


•How to choose the right worker for a given job (environment match + capacity)?
•How to handle worker node failures mid-execution?
•How to scale the system when job submission spikes (e.g., nightly regression tests)?
•How to manage resource isolation so that one job doesn’t affect another?
•How would you handle versioning of test binaries and environments?
•What metrics would you collect for worker utilization, job latency, failure rate?


✅ Summary

Design a scalable remote test-execution orchestration system for Nutanix that allows engineers to submit test jobs from their machines or CI pipelines, manages a distributed pool of worker machines, schedules and executes jobs, collects and presents results, and ensures robustness and scalability.


Solution

Comments