E-commerce infrastructure that scales without interruption during campaign periods
A monolithic application running on virtual machines was decomposed into domain-oriented microservices and moved to a GitOps-managed platform on Kubernetes with event-driven autoscaling.
Initial situation
The company's entire business workflow (catalog, search, cart, payment, orders, inventory and the campaign engine) ran in a single Java-based application backed by a single relational database. The application was deployed to virtual machines manually; scaling consisted of provisioning a new server and adding it to the load balancer.
On campaign days, slowness in the payment step affected the entire site and the database connection pool was exhausted. Because session data was held in server memory, adding servers caused session loss; releases required a maintenance page, were performed at night and could take place only a few times a month.
Issues identified
- There was no fault isolation: a load increase in a single component slowed down the entire system.
- The application was stateful (sessions were held in memory), so horizontal scaling was not safe.
- The database connection pool was exhausted during peak hours.
- Deployments were manual, required a maintenance window and had no defined rollback plan.
- There were no application-level metrics or distributed tracing; bottlenecks were located by guesswork.
Objectives
- Uninterrupted operation of the cart and payment flow within service level objectives under campaign traffic
- Independent scaling and independent release of each component
- Daily releases during business hours, without downtime and with automatic rollback
Approach and implementation
-
1
Observability and load model
Work began with measurement. An OpenTelemetry agent was added to the application so that every request could be traced end to end; request rate, error rate and response time (RED metrics), along with database query times, were brought onto Prometheus and Grafana dashboards. Scenarios reflecting real user behavior were derived from the access logs of past campaigns, and repeatable load tests were written with k6.
- The share of payment and inventory queries in total response time was measured with distributed traces.
- Service level objectives (SLOs) were defined in terms of p95 response time and error rate.
- Load tests were connected to the delivery pipeline so that they run after every major change.
- OpenTelemetry
- Prometheus
- Grafana
- Tempo
- k6
-
2
Domain-driven decomposition (strangler fig)
The monolith was not rewritten in a single pass. The catalog, cart, payment, order, inventory and notification services, whose boundaries were drawn using domain-driven design (DDD), were extracted gradually using the strangler fig approach. The routing of traffic to each service was managed through rules on the API gateway; at every step the monolith continued to run as a fallback path. Asynchronous flows between services (events such as order created or stock decremented) were built on a message queue with idempotent consumers.
- Each service was assigned its own database schema and owning team; services do not access each other's tables.
- Cart and session data were moved to Redis, making the services stateless.
- Timeouts, bounded retries and circuit breaker rules were added to calls to the payment provider.
- Kong Gateway
- RabbitMQ
- Redis
- PostgreSQL
-
3
Kubernetes platform
The entire infrastructure was defined as code with Terraform modules: an Amazon EKS cluster spread across three availability zones, node groups separated by workload type (general services, payment, batch jobs), private subnets and managed PostgreSQL. Node scaling is handled by Karpenter, and pod scaling by KEDA, which takes into account business metrics such as queue length and requests per second in addition to CPU.
- Resource requests and limits, readiness probes and liveness probes were defined for each service.
- PodDisruptionBudgets and topology spread constraints keep the service running through the loss of a zone or node.
- Database connections were pooled through PgBouncer, eliminating connection exhaustion.
- Terraform
- Amazon EKS
- Karpenter
- KEDA
- Helm
- PgBouncer
-
4
GitOps and canary releases
A delivery pipeline was set up on GitHub Actions for each service, consisting of build, unit and contract tests, image security scanning and image signing. Environment definitions are kept as Helm values in a separate Git repository; Argo CD continuously reconciles the cluster state with this repository and reverts manual drift. Promotion to production follows a canary strategy with Argo Rollouts: the new version is exposed to a small share of traffic and rolled out progressively if the error rate and response time analyses in Prometheus pass, or rolled back automatically if they do not.
- Who changed what and when can be traced through Git history; direct access to production is not required.
- Images are scanned with Trivy and signed with Cosign; only signed images are admitted to the cluster.
- Database schema changes are applied independently of releases using a backward-compatible (expand/contract) pattern.
- GitHub Actions
- Trivy
- Cosign
- Argo CD
- Argo Rollouts
-
5
Capacity drills and campaign readiness
Before the campaign, load tests above the expected peak load and chaos experiments (node loss, dependency latency, queue backlog) were run in a production-equivalent environment. Scaling thresholds and resource limits were tuned based on the results; alerting rules, an on-call plan and runbooks were prepared for campaign day.
- Alerting rules were written based on the SLO error budget burn rate, reducing unnecessary alert noise.
- Campaign day was monitored through live dashboards and a shared incident channel.
- k6
- Chaos Mesh
- Alertmanager
- Grafana OnCall
Outcome
- Campaign traffic was handled within service level objectives, without manual intervention in the infrastructure.
- Slowness on the payment side no longer affects the catalog and cart flow; failures are contained at the service boundary.
- Releases moved from a few batch releases per month to multiple small releases per day, each automatically verified and reversible.
- Capacity scales up and down automatically with demand; idle resources are not held outside campaign periods.