Infrastructure

Ecommerce scalability on Kubernetes: absorb spikes without overspending

Published Jul 29, 2025Updated Mar 11, 2026By Valendra

How to scale an ecommerce platform on Kubernetes and AWS to handle demand spikes without inflating baseline cost or operational risk.

Ecommerce scalability on Kubernetes: absorb spikes without overspending

The worst scalability failure is not technical. It is paying for acquisition, driving traffic to the platform, and discovering the system cannot absorb demand with margin. When that happens, the issue stops being an isolated technical choice and becomes a cost, risk, and delivery problem.

This guide frames using autoscaling, database design, and cache strategy with criteria that protect conversion and cost with criteria that can survive production, audit, and growth. The point is not to accumulate tooling. It is to recover control and reduce uncertainty with a system the team can govern without unnecessary dependency.

Predictable behavior under campaign load is the real requirement

During campaigns we saw two classes of bottlenecks, and only one was obvious at first.

Compute saturation was visible. Pods hit CPU or memory pressure, request queues grew, and latency climbed. The business impact showed up immediately in slower pages, more abandoned carts, and a support spike. Most teams stop here and conclude they need autoscaling.

The less obvious bottleneck was the database. In production we repeatedly see teams “scale” by adding nodes and pods, only to push the failure downstream into database connection pools, storage IOPS ceilings, lock contention, or replica lag. At that point Kubernetes can keep scaling the application and customer experience still degrades through timeouts and retries. Worse, the larger app fleet increases concurrent pressure on the database, so the act of scaling becomes an outage amplifier.

So the real problem was not “we need autoscaling.” It was “we need predictable behavior under stress with a cost model that makes sense the other 95 percent of the year.”

Autoscaling only works when scheduling is truthful and intentional

We used Karpenter to provision nodes based on real demand and remove them when demand dropped. Cluster Autoscaler can solve similar problems, but Karpenter tends to win during sudden spikes for two reasons that matter in ecommerce campaigns. It provisions quickly and it is flexible about instance selection. When traffic jumps, minutes matter. If capacity arrives late, you can miss the revenue window before stability is restored.

What the documentation does not tell you is that autoscaling often fails for reasons that look like “random instability” but are actually scheduling lies. A common anti-pattern is setting pod requests too low so you can pack more pods per node. It looks efficient in dashboards. Under real load, the JVM or Node process crosses a memory cliff, the kernel starts reclaiming aggressively, GC gets worse, tail latency spikes, and pods restart. From Kubernetes’ perspective the cluster is still “green” because it had enough requested capacity. From the customer’s perspective checkout is broken.

A pattern that works well is designing node scaling and workload placement together so the scheduler has accurate inputs and you have predictable failure modes. In practice that meant:

  • We right-sized pod requests and limits so the scheduler could make reliable placement decisions. When requests are wrong, you do not get “slightly worse efficiency.” You get non-deterministic behavior under peak load and it is almost impossible to debug in the middle of a campaign.
  • We used multiple node pools with intent, such as general workloads versus latency-sensitive workloads. This reduces noisy-neighbor risk and gives you clean cost and performance knobs. If everything shares one pool, your critical path competes with background jobs precisely when you need it most.
  • We kept scale-down conservative during campaigns. Aggressive scale-down saves a little money and then repays it with failed orders when the next burst arrives and nodes are still coming up. The business does not care that you saved a few dollars if you drop conversions.

If you skip this discipline, the failure mode is usually a feedback loop. Burst traffic causes CPU saturation, latency increases, retries rise, concurrency increases further, database load increases, and the system enters a self-amplifying spiral. Past a certain point, adding more nodes is no longer a clean fix because you are amplifying downstream pressure faster than you are adding stable capacity.

The database has a different elasticity curve than compute

We treated the database as a scaling component, not a fixed dependency. This sounds obvious, but many teams implicitly treat the database as “someone else’s problem” once they have Kubernetes autoscaling.

Compute can be elastic in seconds to minutes. Databases scale differently because they have hard constraints and time constants, such as connection limits, throughput ceilings, cache warm-up behavior, replication lag, and consistency semantics. You cannot “Kubernetes” your way out of those.

We used a combination of read replicas and planned capacity changes to absorb spikes without breaking consistency. The word planned matters. Purely reactive database scaling is risky because the time between “alarm fired” and “database is stable at higher capacity” is often longer than the spike itself. If you wait for alarms during a campaign, you are already late.

In ecommerce, a pragmatic approach is to lean on replicas where it is safe, then reserve vertical scaling or capacity adjustments for known events. The nuance is that you need to audit the true read/write split first. Many teams assume they are read-heavy until they measure and realize that checkout workflows, inventory updates, and promotions are write-bound or contention-bound.

Connection storms are the other quiet killer. When Karpenter scales the application quickly, each new pod can open fresh database connections. Without per-pod caps and sane pooling, scaling compute can overwhelm the database in seconds. The operational symptom looks like “database is down,” but the root cause is an ungoverned fan-out pattern from the app layer. This is one of those problems you only learn the hard way once you have watched a campaign go sideways.

If you ignore database elasticity, you end up with an expensive illusion of scalability. The cluster grows, costs increase, and customer experience still degrades because the database is saturated. The larger fleet then increases contention and retry traffic, turning a performance issue into a full incident.

Observability should be tied to revenue impact, not vanity metrics

We anchored observability to business outcomes, specifically latency, error rate, and conversion. Infrastructure metrics are necessary, but they are not sufficient during revenue events.

CPU can be at 40 percent while tail latency is terrible due to GC pauses, downstream retries, lock contention, or replica lag. If you alert on CPU, you learn nothing until customers are already leaving. In production, teams that run campaigns safely tend to do two things consistently. They alert on symptoms customers feel, and they can correlate performance degradation with the revenue funnel quickly. During a campaign you do not have time for multi-hour war room archaeology.

Tying alerts to latency, error rate, and conversion forces engineering and the business to share a single view of reality. It also improves ROI because the team spends time fixing bottlenecks that move revenue, not optimizing dashboards.

What changed operationally and why it matters to ROI

Under peak load, response times stayed stable. The practical win was not just “it stayed up.” Predictability reduces operational risk and reduces the number of senior engineers you need on standby during critical events.

Outside campaigns, costs dropped because elastic node scaling meant paying for the workload actually running, not for the fear of what might happen. Persistent over-capacity is a hidden tax on every roadmap item. It reduces optionality and forces trade-offs that are usually worse than investing in real elasticity.

Manual intervention during critical events also dropped. This is an underrated ROI driver. When teams have to babysit infrastructure during revenue events, you pay twice. You pay in incident risk and you pay in opportunity cost because your best engineers are not building product.

The failure modes you need to design against, not just hope you avoid

If you want this to work consistently, there are a few lessons that are worth making explicit.

The database is often the hidden bottleneck. Scaling compute without validating database headroom usually accelerates failure rather than preventing it.

Autoscaling must be tested with realistic traffic, not synthetic single-endpoint tests. Campaign load is about concurrency patterns, cache behavior, hot keys, and a request mix that includes the database-heavy flows. A load test that never stresses checkout is not a campaign simulation.

Business metrics matter most during campaigns. If you cannot see conversion impact within minutes, you will make the wrong trade-offs under pressure, either overreacting with costly changes or underreacting while revenue leaks.

Campaign pre-flight validation that actually prevents incidents

Use this as a short operational pre-flight before a known traffic event.

  • Autoscaling is validated with load tests that reflect real request mix and concurrency, including cache warm-up and database-heavy flows.
  • Limits and quotas per service are reviewed, including per-pod database connections and any external API rate limits.
  • Database replicas are ready, and planned scaling actions are scheduled and rehearsed with rollback steps.
  • Incident communications are agreed in advance, including who can make the call to degrade non-critical features to protect checkout.

FAQ

Do we need to scale the whole stack?

No. Find the true bottleneck and start there. For small teams, the best ROI usually comes from fixing one or two constraints that trigger cascades, such as database connection limits, a hot table, a slow external dependency, or an overloaded cache. Scaling everything uniformly is expensive and often makes failure modes worse.

How long does implementation take?

Roughly 4 to 8 weeks depending on automation maturity and how far the system is from being truthful. The time driver is rarely installing tools. It is right-sizing requests, defining safe scaling policies, validating failure modes, and rehearsing the campaign path end-to-end so behavior under stress is predictable.

How do we avoid cost overruns?

You need guardrails that prevent failure from turning into runaway horizontal scaling. In practice, the two biggest causes of cost surprises are retry storms that drive autoscalers into exponential growth, and node pools that are too broad and default into expensive instance types. Shutdown policies, per-service limits, and conservative scaling behavior during known events keep costs bounded while still protecting revenue.

A pre-spike gate separates real elasticity from decorative elasticity

Autoscaling does not help much if the system only demonstrates elasticity on calm dashboards. Before a major campaign, it is worth passing a validation gate that proves the platform absorbs load with business flows, data, and quotas aligned.

ControlQuestion it must answerNo-go signal
Time-to-serveHow long does a new replica take to serve useful trafficScaling slower than the spike ramp
DatabaseCan the writer, replicas, and pools sustain expected pressureLocks, lag, or exhausted connections
Cache and CDNDoes hit rate hold when the access pattern shiftsStampede or sharp cache-hit collapse
Quotas and capacityDo subnets, instances, and cloud services have real headroomHidden limits blocking cluster growth
Degraded modeDo revenue routes survive if the system nears its limitNo clear plan to protect checkout

This gate changes the economics of the spike. It forces you to validate the system as a chain, not as isolated components. When it fails, you learn where to invest before the event. When it passes, the team stops depending on heroics and autoscaling finally buys control instead of hope.

When it is time to act

If this decision is already affecting availability, cost, or change windows, the next sensible move is to review architecture, limits, and the operating model before adding more infrastructure.

Newsletter

Get the next technical briefing before the problem gets expensive

A short selection on cloud, data, AI, and software for teams operating production systems.

Low frequency. High signal.

By subscribing, you agree to receive Valendra's technical newsletter. You can unsubscribe at any time.

More technical articles