Quick revision
The short answer
I would first find today's peak and the real bottleneck by load testing at increasing levels, paying special attention to the database, whose connections, CPU, I/O and locks are usually the limit. Then I would plan pod and pool scaling together, because every extra pod brings its own connection pool to the database, prepare graceful degradation by deciding which non-essential features to turn off, and finish with a test at the target load plus headroom before the sale.
What to remember
In this answer, we planned for a sale that triples traffic. We took today's peak as the baseline, added headroom to the target, and used stepped load tests to find the real bottleneck, usually the database's connections, CPU, I/O or locks. We scaled pods and connection pools together so the total connection count fits the database, prepared feature flags to turn off non-essential features, and finished with a rehearsal at the target load plus headroom.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would first find today's peak and the real bottleneck by load testing at increasing levels, paying special attention to the database, whose connections, CPU, I/O and locks are usually the limit. Then I would plan pod and pool scaling together, because every extra pod brings its own connection pool to the database, prepare graceful degradation by deciding which non-essential features to turn off, and finish with a test at the target load plus headroom before the sale.
Why this question is asked
A planned traffic spike is a gift compared with a surprise one: we know roughly when and how big it will be, and we have six weeks. Yet many sale-day outages happen to teams that simply tripled the pod count and hoped. Interviewers ask this scenario to see whether we can find the actual bottleneck, reason about shared resources such as the database, and prepare a fallback plan. In this answer, we will establish the baseline, find the bottleneck with load tests, look closely at the database, scale pods and pools together, plan graceful degradation, and run the final rehearsal.
1Establishing the Baseline and the Target
We start with numbers. From metrics, we find the current peak, not the average: for example, 1,200 requests per second to the storefront and 150 orders per minute at the busiest hour of last month. Tripling that gives a target of 3,600 requests per second and 450 orders per minute. I would add headroom on top, for example planning for 4 to 4.5 times today's peak, because marketing forecasts are uncertain and sale traffic is spiky in its first minutes.
I would also ask marketing how the traffic arrives. A sale that opens at 09:00 with an email to two million customers produces a sharp spike, while a week-long sale spreads the load. The shape matters as much as the total, because autoscaling takes minutes to react.
2Finding the Bottleneck With Load Tests
Every system has one resource that saturates first, and adding capacity anywhere else does nothing. Load tests at increasing levels find it. In a production-like environment, with realistic data volumes and a realistic mix of requests (browsing, search, cart, checkout), we step the load up: 1x, 1.5x, 2x, 3x, 4x of today's peak, holding each step for 10 to 15 minutes. At each step we watch latency percentiles, error rates and the saturation of every resource: CPU and heap of each service, thread and connection pools, and the database.
The step where p99 latency starts to rise sharply tells us the current capacity, and the resource that is saturated at that step is the bottleneck. After fixing it, we repeat, because the next bottleneck appears behind it.
- Run load at 1x, 1.5x, 2x, 3x, 4xRealistic request mix and data
- Did p99 or errors jump?YesFind the saturated resourceNoNext step up
- Fix or scale that resourcePool, query, pods, database
- Reached target plus headroom?YesFinal rehearsalNoRun the loop again
4 steps in order. Play them, or step through them one at a time.
Each pass removes one bottleneck and reveals the next.
3Checking the Database First
In most Java systems, the stateless services scale out easily, and the database does not. So I would check the database explicitly. Connections: the maximum the database allows, and how many the services open in total. CPU and I/O: how much headroom the primary has at today's peak, and which queries use the most time; tripling traffic triples their cost. Locks: hot rows that every order updates, such as a stock counter for a popular product, become a queue at higher rates, and no amount of hardware fixes that.
Typical fixes found this way are adding an index for a query that becomes expensive at scale, caching read-heavy data such as product details so the database is not asked 3,600 times a second, sending reads to replicas, or changing how a hot row is updated. Scaling the database vertically is possible too, but it should be planned and tested weeks ahead, not on the morning of the sale.
4Scaling Pods and Pools Together
Scaling the services and their pools must be planned together, because every pod brings its own connection pool. The arithmetic is simple and often forgotten.
Notice that tripling pods without changing pools would push the database past its connection limit exactly at peak, and a database with hundreds of busy connections also slows down from contention. We size each pod's pool from its measured need, set autoscaling limits so the maximum pod count times the pool size fits the database, and consider a connection pooler such as PgBouncer if many services share one database. Because autoscaling reacts in minutes, I would also scale up ahead of the sale start rather than relying on it to catch the first spike.
5Preparing Graceful Degradation
Even with good planning, the real traffic may exceed the forecast. Graceful degradation means deciding in advance what to switch off so the core flow keeps working. For a shop, the core is browse, cart and checkout; recommendations, recently viewed items, live stock counts on listing pages and some analytics are nice to have. Each of them gets a feature flag that can be turned off in seconds, and the runbook says in what order and at what signal, for example when database CPU stays above 80 percent.
Rate limiting at the edge and a queue or waiting room for the sale page protect the system from a burst it cannot absorb, which is better for customers than timeouts across the whole site.
6The Final Rehearsal
A week or two before the sale, we run a load test at the target load plus headroom, with the final configuration, the planned pod counts and the degradation switches. We confirm that p99 latency and error rates stay within targets, that the database has headroom, for example CPU below 60 to 70 percent, and that turning off non-essential features actually reduces load. We also rehearse the operational side: who is on call, which dashboards they watch, and the order of actions if things go wrong. On the day, we scale up in advance and freeze unrelated deployments.
7Follow-up questions
How realistic does the load test environment have to be?
Realistic enough that the bottleneck behaves the same way. That means similar data volumes, because a query on 10,000 rows behaves differently from one on 50 million, the same database instance class, and a realistic request mix. If a full copy of production is too expensive, testing against production at quiet hours with careful limits is an option some teams use, with proper safeguards.
What if the database cannot handle triple the load at all?
Then we reduce the load it has to carry: cache read-heavy data, move reads to replicas, make expensive queries cheaper, defer non-urgent writes through a queue, and turn off non-essential features during the sale. A vertical upgrade of the database instance can buy capacity if it is planned and tested early.
Why scale up before the sale instead of relying on autoscaling?
Because autoscaling reacts to load that is already there, and starting new Java pods takes time: scheduling, image pull, JVM startup and warm-up. A sale that jumps from normal to triple in a minute will overwhelm the existing pods before new ones are ready. Scaling up in advance avoids that, and autoscaling handles whatever goes beyond the plan.
8Conclusion
In this answer, we planned for a sale that triples traffic. We took today's peak as the baseline, added headroom to the target, and used stepped load tests to find the real bottleneck, usually the database's connections, CPU, I/O or locks. We scaled pods and connection pools together so the total connection count fits the database, prepared feature flags to turn off non-essential features, and finished with a rehearsal at the target load plus headroom.
Open with
I would start from the real numbers: the current peak, not the average, and a target of three times that plus headroom, say four times, since forecasts are uncertain and the first minutes of a sale are spiky.
Then, if they want more
I would also ask marketing about the shape of the traffic, for example a 9 a.m. email blast. Then I would run stepped load tests in a production-like environment, with realistic data and request mix, at 1x, 2x, 3x, 4x, and watch p99, errors and the saturation of every resource to find the first bottleneck, fix it and repeat.
I would look at the database first, because services scale out easily and the database usually does not: connection limits, CPU and I/O headroom, the most expensive queries, and hot rows that every order locks. Fixes might be indexes, caching product data, read replicas or a planned instance upgrade.
Then I plan pods and pools together, because tripling pods also triples connections, so I size pools from Little's law, cap autoscaling so max pods times pool size fits the database, and maybe add PgBouncer. I would prepare graceful degradation with feature flags for non-essential features like recommendations, plus rate limiting or a waiting room.
Finally, a week or two before, a full rehearsal at the target load, and on the day we scale up in advance rather than relying on autoscaling.
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.
- Official documentation
- Kubernetes documentation, Spring Boot reference
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 "Marketing expects traffic to triple during a sale in six weeks. How do you plan capacity...": https://scrivio-interview-library.netlify.app/spring-boot/production-operations/5e5686ab9d/