Scrivio Interview library
LeadershipPrincipal7 min read · updated 12 November 2026

At company level, how do you decide when to invest engineering time in performance work versus buying more hardware, and how do you keep that decision sound over years?

We compare the engineering cost of the work with the infrastructure it saves over the service's expected lifetime, using cost per request or per customer so the numbers are comparable across services. User-facing latency has business value beyond hardware, so we measure its effect on conversion or retention where we can. Platform-level improvements such as JDK upgrades, GC choice and right-sizing multiply across the fleet and are usually the best first investment, and we protect gains with performance budgets and regression tests and revisit the decision as prices, hardware and the JDK change.

Why this question is asked

Every engineering organisation eventually faces a version of this choice: a service is slow or expensive, and we can either spend engineers' time making it better or spend money on more machines. Both answers are sometimes right, and the costly failure is deciding by habit, whether that habit is "hardware is cheap" or "we always optimise". Interviewers ask this at the director or principal level to see how we reason about money, user value and fleet-wide leverage. In this answer, we will build the basic cost comparison, add the value of latency, look at why platform work usually comes first, and then see how to keep the decision sound over years.

1The Basic Comparison: Engineering Time Versus Infrastructure

The core of the decision is a simple calculation that is surprisingly often skipped. On one side is the cost of the engineering work: the people, the time, and the ongoing cost of maintaining more complex code. On the other side is the infrastructure it would save, over the period the service will actually exist in its current form.

To compare services fairly, we normalise to a unit the business understands, such as cost per thousand requests or infrastructure cost per active customer per month. That turns "the search cluster is expensive" into "search costs 4 cents per thousand queries, twice as much as last year", which is something we can track and set goals for.

Java
// Illustrative numbers
// Service A: infrastructure 40,000 USD/month
// Optimisation: 2 engineers x 1 month, fully loaded about 35,000 USD
// Expected saving: 30% -> 12,000 USD/month -> payback in about 3 months
// Over 2 remaining years: about 288,000 USD saved -> do it
//
// Service B: infrastructure 2,000 USD/month
// Same optimisation effort: 35,000 USD
// Expected saving: 30% -> 600 USD/month -> payback in about 5 years
// Service to be replaced next year -> buy hardware, do not optimise

The same engineering effort is an excellent investment for one service and a waste for another. Notice the lifetime term: savings on a service that will be rewritten next year are worth much less. We should also count the long-term cost of complexity. A clever optimisation that only one person understands has a maintenance cost that can eat its savings.

2Latency Has Value Beyond Hardware

The hardware comparison only covers efficiency. For user-facing paths, speed itself has business value. Slower pages and checkouts tend to lower conversion and engagement, and slow internal tools cost employees' time. More hardware does not always fix latency either: if a request is slow because of sequential calls or a slow algorithm, adding machines raises capacity but leaves each request just as slow.

So for user-facing work, we try to measure what latency is worth in our own product rather than quoting someone else's study. The most direct way is an experiment that adds a small, controlled delay for a fraction of users and measures conversion or retention, if the business accepts that. A softer way is to correlate latency percentiles with conversion across regions or time. Even a rough estimate, such as each 100 ms of checkout latency costing a fraction of a percent of conversions, turns latency work from a matter of taste into a line in the business case.

3Platform Improvements Come First

Some performance work happens once and benefits every service. Upgrading from an old JDK to a current LTS often brings measurable CPU and memory improvements from better JIT compilation, collectors and libraries, without changing application code. Choosing the right collector per workload, for example generational ZGC for latency-sensitive services, and right-sizing containers, so CPU and memory requests match what services actually use, often save more than any single service optimisation.

The reason is multiplication. A 10 percent CPU saving on one service is small; a 10 percent saving across 400 services is a large share of the infrastructure bill, delivered by one platform team. So the usual order is: platform work first, because it has the highest leverage, then targeted optimisation of the few services where the cost or latency numbers justify it, then hardware for the rest.

Step throughDeciding between performance work and more hardware
  1. Measure cost per request and latencyper service, against its SLO
  2. Is there an untaken platform lever?
    YesJDK upgrade, GC choice, right-sizing firstNoLook at the service itself
  3. Does saving x lifetime exceed engineering + upkeep?
    YesInvest in optimisationNoCheck latency value
  4. Does latency hurt users or revenue measurably?
    YesInvest in latency workNoBuy capacity
  5. Lock in the resultbudgets and regression tests

5 steps in order. Play them, or step through them one at a time.

Hardware is the right answer when neither cost nor latency justifies engineering time.

4Keeping Gains From Eroding

Performance gains are fragile. A service optimised this quarter can lose it all to a few innocent-looking changes next quarter, such as an extra query or a new logging line, and nobody notices until the bill or the latency graph moves. So every investment should end with protection: a performance budget for the service, such as a p99 target and a cost per request target, and automated regression tests in CI or staging that fail when they are broken.

Without this, the organisation pays for the same optimisation repeatedly. With it, performance becomes part of the definition of done rather than a periodic rescue project.

5Keeping the Decision Sound Over Years

The inputs to this decision change. Cloud prices fall or rise, new instance types such as ARM-based machines change the cost per request, every JDK release improves the runtime, and salaries change the cost of engineering time. A decision that was right three years ago may be wrong today in either direction.

So we make the decision repeatable rather than one-off. A small dashboard shows cost per request and latency per service over time. Once or twice a year, a review looks at the services with the biggest bills or the worst latency, re-runs the comparison with current prices, and checks whether platform levers such as a new LTS or a new instance family have become available. That rhythm keeps both mistakes in check: optimising things that no longer matter, and paying for hardware that a cheap platform change would remove.

6Follow-up questions

Isn't hardware always cheaper than engineers?

For a single small service, often yes, and saying so is perfectly reasonable. It stops being true at scale, when the same inefficiency repeats across hundreds of instances or services, and it is never true for latency problems that more hardware cannot fix, such as a slow algorithm or a chain of sequential calls.

How do you account for the cost of complexity?

By including maintenance in the engineering cost, for example a percentage of a team's time for as long as the optimisation exists, and by preferring optimisations that make code simpler, such as removing redundant work, over ones that add clever machinery. If an optimisation needs a specialist to maintain it, that is a real cost.

Who should own these decisions?

Service teams own their cost and latency targets, a platform team owns fleet-wide levers such as JDK versions, collectors and instance types, and a periodic review with finance or engineering leadership looks across the portfolio. Shared visibility of cost per request is what makes this ownership work.

7Conclusion

In this answer, we framed the choice as engineering cost against infrastructure saved over the service's lifetime, normalised to cost per request or per customer, with the cost of maintaining complex code included. We added the business value of user-facing latency, measured in our own product where possible, and saw that platform work such as JDK upgrades, collector choice and right-sizing usually comes first because it multiplies across the fleet. Budgets and regression tests protect gains, and a regular review with current prices, hardware and JDK versions keeps the decision sound over years.

What to say in the interviewAbout 90 seconds aloud

Open with

I treat it as an investment decision with numbers, not a habit. First I compare the engineering cost, including the ongoing cost of maintaining more complex code, with the infrastructure it saves over the time the service will actually exist.

Then, if they want more

To make services comparable, I normalise to cost per request or per customer. The same two engineer-months can pay back in three months on a large service and never on a small one that is being replaced next year.

Second, for user-facing paths, latency has value beyond hardware, and more machines often do not fix latency anyway, so I try to measure its effect on conversion or retention in our own product, for example with a controlled delay experiment or a correlation across regions.

Third, I look at platform levers before individual services: upgrading to a current JDK, choosing the right collector and right-sizing containers multiply across the whole fleet, so they are usually the best first investment and are owned by a platform team. Whatever we optimise, we lock in with performance budgets and regression tests, otherwise the gains erode.

And to keep the decision sound over years, I keep a cost-per-request dashboard and review the biggest and slowest services once or twice a year with current prices, hardware such as ARM instances, and JDK versions, because the right answer changes as those inputs change.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "At company level, how do you decide when to invest engineering time in performance work...": https://scrivio-interview-library.netlify.app/java/java-performance/8a805d8fc5/