Andres Videla

Home / Portfolio

Keeping quote calculation fast at quarter end

Why CPQ calculation degrades under peak load, and the design changes that keep it stable.

Composite case. October 2026.

Calculation time versus quote size, illustrative Calculation time grows faster than quote size, and quarter-end load adds contention and retries on top. Quarter-end load Rules and lookups multiply per line Retries add load Quote size: lines, bundle depth, rules Calculation time
Illustrative shape of the problem, not measured data.

The pattern

A quoting system that feels fine for eleven weeks of the quarter becomes slow in the twelfth. Reps edit the same large quotes many times, deal desk reprices in parallel, and finance waits for approvals. Calculation takes longer, users click again, and the system receives more work exactly when it has the least capacity to give.

Nothing is broken in the ordinary sense. Each piece works in isolation. The failure comes from how the pieces interact under concurrency.

Why it gets worse faster than the load grows

Three effects compound.

Design moves, in the order I apply them

1. Measure the calculation path before changing it

Find out which price rules, lookups and custom calculator code run for each line, and how often. Most of the time is spent in a small number of places. Optimizing without this map usually moves cost around instead of removing it.

2. Remove redundant evaluation

Overlapping price rules, repeated lookups for the same value and conditions that are always true are common after years of incremental changes. Consolidate rules, cache values used by many lines, and move static data into the product model so it is configured once instead of computed every time.

3. Move non-blocking work out of the user's wait

The user needs a price. They do not need enrichment, notifications or downstream updates to finish before the screen responds. Run those through asynchronous jobs or events, and make them idempotent so that a retry cannot duplicate work.

4. Make the code bulk-safe and lock-aware

5. Bound the problem size

Set a practical ceiling for lines per quote and split oversized bundles. A limit that the product model enforces is cheaper than a performance fix that has to keep chasing growth.

6. Test with the profile that hurts

Replay a realistic quarter-end pattern: the biggest quotes, many users editing at once, approvals running in parallel. Run it before each release. Average-day tests will not show the failure.

What stable looks like

Quote editing stays responsive at peak. Lock errors still happen occasionally, but they are rare, retried safely and visible in monitoring. The team has a repeatable performance test that runs before changes ship, so a regression is found in a test environment and not in the last week of the quarter.

The failure to watch for afterwards

Moving work to asynchronous jobs removes pressure from the user's screen, and it also creates a new way to fail silently. If a job stops running, nobody sees an error. Monitor for the absence of expected outcomes, and alert on silence.

This is a composite case. It generalizes a pattern that recurs across organizations and does not describe any single company or engagement.

Back to portfolio

Back to home