InterviewStack.io LogoInterviewStack.io

Performance Engineering and Cost Optimization Questions

Engineering practices and trade offs for meeting performance objectives while controlling operational cost. Topics include setting latency and throughput targets and latency budgets; benchmarking profiling and tuning across application database and infrastructure layers; memory compute serialization and batching optimizations; asynchronous processing and workload shaping; capacity estimation and right sizing for compute and storage to reduce cost; understanding cost drivers in cloud environments including network egress and storage tiering; trade offs between real time and batch processing; and monitoring to detect and prevent performance regressions. Candidates should describe measurement driven approaches to optimization and be able to justify trade offs between cost complexity and user experience.

HardTechnical
60 practiced
Implement a dynamic batching component (in Python pseudo-code) for an async inference server. The component should collect incoming requests into batches up to max_batch_size, respect per-request deadlines (max_wait_ms), and avoid starvation of older requests. Show how concurrency and timers are handled and describe complexity.
EasyTechnical
53 practiced
Implement a Python class LatencyTracker that supports add(latency_ms: float) and p95() -> float returning the 95th percentile of recorded latencies. You may assume at most 10,000 stored latency values and single-threaded access. Aim for reasonable efficiency for frequent adds and occasional p95() calls. Provide function signatures and a brief explanation of complexity.
HardTechnical
62 practiced
Production network egress costs spiked due to embedding lookups performed across regions. Propose architectural changes and quantify trade-offs between latency and cost for approaches such as regional replication, consistent hashing to route lookups locally, compression of embeddings over the wire, or using a proxy cache in each region.
EasyTechnical
54 practiced
List and explain the principal cloud cost drivers for serving machine learning models in production. Cover compute (instance type, on-demand vs reserved vs spot), storage (hot vs cold tiers), network (egress), disk I/O, and control-plane costs. For each driver, give one concrete optimization that often yields meaningful cost savings without major performance regression.
MediumTechnical
92 practiced
Implement an exponential backoff retry decorator in Python for a client that calls an external inference API. The decorator should accept max_retries, initial_delay_ms, max_delay_ms, and jitter options, and should stop retrying on 4xx client errors. Show code and explain how this helps avoid cascading failures and thundering-herd problems.

Unlock Full Question Bank

Get access to hundreds of Performance Engineering and Cost Optimization interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.