Layer 5 — AI Infrastructure · Chapter 6

Performance, Cost, and Scaling

Book chapterLayer 5

AI systems consume expensive computation unevenly. A short classification request and a long reasoning task may use the same model family but require radically different time and resources. Infrastructure turns these variable workloads into predictable service levels and sustainable economics.

The main performance measures

MeasureMeaningWhy it matters
Time to first outputHow long the user waits before the first token, frame, or partial result.Shapes the feeling of responsiveness.
End-to-end latencyTotal time until the task is complete.Determines whether the workflow is practical.
ThroughputAmount of work completed per unit of time.Affects capacity and cost at scale.
UtilizationHow fully expensive compute is kept busy.Low utilization wastes capital or cloud spending.
AvailabilityHow consistently the service can accept and complete work.Critical when AI becomes part of business operations.
Quality per dollarUseful output achieved for the total cost.Prevents optimization of speed or price at the expense of value.

Why batching matters

Accelerators are more efficient when they process several compatible requests together. Batching improves throughput and utilization, but waiting to form a batch can increase latency. Infrastructure must balance individual responsiveness against total efficiency.

Caching

Repeated work can sometimes be reused. Infrastructure may cache retrieved documents, prompt prefixes, model states, embeddings, tool results, or final outputs. Caching is powerful when requests share common material, but it requires careful invalidation, privacy isolation, and version awareness.

Model and numerical optimization

Scaling is not only adding machines

More hardware can increase capacity, but bottlenecks may move to memory, network communication, storage, retrieval, rate limits, or external tools. Effective scaling requires measuring the complete request path and designing for the dominant constraint.

The cost stack

The visible model fee may be only one part of total cost. A complete calculation can include:

Optimization should follow business value

The cheapest model is not economical if it creates more errors, human review, customer loss, or legal exposure. The strongest model is not economical if a smaller one can handle routine requests. Mature platforms use tiered models, confidence thresholds, escalation, and task-specific routing.

The objective is not minimum cost per token. It is minimum cost per acceptable outcome.