Recent Posts
Archives

Posts Tagged ‘ECS’

PostHeaderIcon [DevoxxUK2026] From Fleeticide To Recovery: When Your Auto-Scaling Policy Becomes Your Worst Enemy

Lecturer

Stephen Galbraith is a Staff Engineer at Capital One with a focus on Site Reliability Engineering. With over two decades of experience in software development, including Java, financial systems, and cloud-native architectures, he brings practical insights from production environments into resilient system design.

Abstract

Stephen Galbraith examines the precarious dynamics of auto-scaling in containerized environments, particularly when policies intended to enhance availability inadvertently trigger cascading failures. Through a real-world case study involving Spring Boot services on AWS ECS Fargate, the presentation dissects observability shortcomings, introduces software bottleneck monitoring, and advocates for architectural patterns that ensure graceful elasticity.

The Perils of Auto-Scaling and the Phenomenon of Fleeticide

Horizontal scaling promises seamless adaptation to demand, yet in practice, misconfigurations can precipitate “fleeticide”—the rapid termination of an entire task fleet due to cascading overload. In one documented incident, a service experienced sudden latency spikes despite stable CPU and memory metrics. Health checks began failing under load, prompting AWS to remove tasks from service. Remaining instances absorbed redirected traffic, exceeding their capacity and perpetuating the cycle until traffic subsided.

This failure stemmed not from fundamental infrastructure limitations but from unmonitored software constraints within the application. Tomcat thread pools saturated, preventing timely health check responses. The auto-scaling policy, calibrated solely on CPU and memory, failed to detect these internal bottlenecks, transforming a protective mechanism into the primary cause of outage.

Observability Beyond CPU and Memory: Identifying Software Bottlenecks

Traditional monitoring overlooks critical internal resources. Stephen emphasizes the necessity of tracking thread pools, HTTP connection pools, JDBC connections, and other library-level constraints. These “hidden” metrics often govern actual capacity more directly than aggregate CPU utilization.

In the Spring Boot demonstration, default configurations for ForkJoinPool and Apache HttpClient pools imposed strict limits. Under increasing load, these pools saturated independently of CPU or memory, causing queueing and degraded performance. By exposing utilization percentages for each bottleneck via JMX and Micrometer, teams gain visibility into true headroom.

A composite “combined utilization” metric, dimensioned by service name, aggregates these signals. Exported to CloudWatch, it enables alarms and scaling policies responsive to application-specific constraints rather than generic infrastructure signals. This approach reveals anomalies, such as regional database slowdowns impacting one availability zone disproportionately, allowing proactive scaling before customer impact.

Architectural Patterns for Resilient Elasticity and Recovery

Effective scaling requires distinguishing between healthy but resource-constrained services and genuinely unhealthy ones. Health checks merit elevated priority, potentially isolated on separate servlets to avoid contention with customer traffic. Configuration should favor rapid recovery while preventing premature termination during transient saturation.

Little’s Law and Kingman’s approximation provide theoretical foundations for pool sizing, yet production demands empirical validation and conservative buffers. Rather than maximizing individual resources, teams should scale out preemptively, leveraging compute abundance to maintain service levels.

The presentation advocates baking scaling awareness into development workflows. Developers must identify potential bottlenecks during design, instrument them proactively, and incorporate scaling considerations into code reviews. This cultural shift prevents “works on my machine” scenarios from escalating into fleet-wide incidents.

Shadow testing, canary deployments, and comprehensive chaos engineering further validate policies under realistic conditions. When failures occur, post-incident analysis extends beyond root cause to evaluate whether monitoring captured the precipitating constraints.

Conclusion

Stephen Galbraith demonstrates that auto-scaling success hinges on comprehensive observability encompassing software-level bottlenecks alongside traditional metrics. By treating internal resource pools with the same rigor as CPU and memory, organizations can prevent fleeticide and achieve genuine elasticity. The battle-tested checklist includes instrumenting key constraints, implementing composite utilization metrics, configuring intelligent health checks, and fostering scaling-aware development practices. Ultimately, resilient systems emerge not from perfect prediction but from robust detection and graceful response to the inevitable variability of production environments.

Links:

PostHeaderIcon [DevoxxFR 2018] Deploying Microservices on AWS: Compute Options Explored at Devoxx France 2018

At Devoxx France 2018, Arun Gupta and Tiffany Jernigan, both from Amazon Web Services (AWS), delivered a three-hour deep-dive session titled Compute options for Microservices on AWS. This hands-on tutorial explored deploying a microservices-based application using various AWS compute options: EC2, Amazon Elastic Container Service (ECS), AWS Fargate, Elastic Kubernetes Service (EKS), and AWS Lambda. Through a sample application with web app, greeting, and name microservices, they demonstrated local testing, deployment pipelines, service discovery, monitoring, and canary deployments. The session, rich with code demos, is available on YouTube, with code and slides on GitHub.

Microservices: Solving Business Problems

Arun Gupta opened by addressing the monolith vs. microservices debate, emphasizing that the choice depends on business needs. Microservices enable agility, frequent releases, and polyglot environments but introduce complexity. AWS simplifies this with managed services, allowing developers to focus on business logic. The demo application featured three microservices: a public-facing web app, and internal greeting and name services, communicating via REST endpoints. Built with WildFly Swarm, a Java EE-compliant server, the application produced a portable fat JAR, deployable as a container or Lambda function. The presenters highlighted service discovery, ensuring the web app could locate stateless instances of greeting and name services.

EC2: Full Control for Traditional Deployments

Amazon EC2 offers developers complete control over virtual machines, ideal for those needing to manage the full stack. The presenters deployed the microservices on EC2 instances, running WildFly Swarm JARs. Using Maven and a Docker profile, they generated container images, pushed to Docker Hub, and tested locally with Docker Compose. A docker stack deploy command spun up the services, accessible via curl localhost:8080, returning responses like “hello Sheldon.” EC2 requires manual scaling and cluster management, but its flexibility suits custom stacks. The GitHub repo includes configurations for EC2 deployments, showcasing integration with AWS services like CloudWatch for logging.

Amazon ECS: Orchestrating Containers

Amazon ECS simplifies container orchestration, managing scheduling and scaling. The presenters created an ECS cluster in the AWS Management Console, defining task definitions for the three microservices. Task definitions specified container images, CPU, and memory, with an Application Load Balancer (ALB) enabling path-based routing (e.g., /resources/greeting). Using the ECS CLI, they deployed services, ensuring high availability across multiple availability zones. CloudWatch integration provided metrics and logs, with alarms for monitoring. ECS reduces operational overhead compared to EC2, balancing control and automation. The session highlighted ECS’s deep integration with AWS services, streamlining production workloads.

AWS Fargate: Serverless Containers

Introduced at re:Invent 2017, AWS Fargate abstracts server management, allowing developers to focus on containers. The presenters deployed the same microservices using Fargate, specifying task definitions with AWS VPC networking for fine-grained security. The Fargate CLI, a GitHub project by AWS’s John Pignata, simplified setup, creating ALBs and task definitions automatically. A curl to the load balancer URL returned responses like “howdy Penny.” Fargate’s per-second billing and task-level resource allocation optimize costs. Available initially in US East (N. Virginia), Fargate suits developers prioritizing simplicity. The session emphasized its role in reducing infrastructure management.

Elastic Kubernetes Service (EKS): Kubernetes on AWS

EKS, in preview during the session, brings managed Kubernetes to AWS. The presenters deployed the microservices on an EKS cluster, using kubectl to manage pods and services. They introduced Istio, a service mesh, to handle traffic routing and observability. Istio’s sidecar containers enabled 50/50 traffic splits between “hello” and “howdy” versions of the greeting service, configured via YAML manifests. Chaos engineering was demonstrated by injecting 5-second delays in 10% of requests, testing resilience. AWS X-Ray, integrated via a daemon set, provided service maps and traces, identifying bottlenecks. EKS, later supporting Fargate, offers flexibility for Kubernetes users. The GitHub repo includes EKS manifests and Istio configurations.

AWS Lambda: Serverless Microservices

AWS Lambda enables serverless deployments, eliminating server management. The presenters repurposed the WildFly Swarm application for Lambda, using the Serverless Application Model (SAM). Each microservice became a Lambda function, fronted by API Gateway endpoints (e.g., /greeting). SAM templates defined functions, APIs, and DynamoDB tables, with sam local start-api testing endpoints locally via Dockerized Lambda runtimes. Responses like “howdy Sheldon” were verified with curl localhost:3000. SAM’s package and deploy commands uploaded functions to S3, while canary deployments shifted traffic (e.g., 10% to new versions) with CloudWatch alarms. Lambda’s per-second billing and 300-second execution limit suit event-driven workloads. The session showcased SAM’s integration with AWS services and the Serverless Application Repository.

Deployment Pipelines: Automating with AWS CodePipeline

The presenters built a deployment pipeline using AWS CodePipeline, a managed service inspired by Amazon’s internal tooling. A GitHub push triggered the pipeline, which used CodeCommit to build Docker images, pushed them to Amazon Elastic Container Registry (ECR), and deployed to an ECS cluster. For Lambda, SAM templates were packaged and deployed. CloudFormation templates automated resource creation, including VPCs, subnets, and ALBs. The pipeline ensured immutable deployments with commit-based image tags, maintaining production stability. The GitHub repo provides CloudFormation scripts, enabling reproducible environments. This approach minimizes manual intervention, supporting rapid iteration.

Monitoring and Logging: AWS X-Ray and CloudWatch

Monitoring was a key focus, with AWS X-Ray providing end-to-end tracing. In ECS and EKS, X-Ray daemons collected traces, generating service maps showing web app, greeting, and name interactions. For Lambda, X-Ray was enabled natively via SAM templates. CloudWatch offered metrics (e.g., CPU usage) and logs, with alarms for thresholds. In EKS, Kubernetes tools like Prometheus and Grafana were mentioned, but X-Ray’s integration with AWS services was emphasized. The presenters demonstrated debugging Lambda functions locally using SAM CLI and IntelliJ, enhancing developer agility. These tools ensure observability, critical for distributed microservices.

Choosing the Right Compute Option

The session concluded by comparing compute options. EC2 offers maximum control but requires managing scaling and updates. ECS balances automation and flexibility, ideal for containerized workloads. Fargate eliminates server management, suiting simple deployments. EKS caters to Kubernetes users, with Istio enhancing observability. Lambda, best for event-driven microservices, minimizes operational overhead but has execution limits. Factors like team expertise, application requirements, and cost influence the choice. The presenters encouraged feedback via GitHub issues to shape AWS’s roadmap. Visit aws.amazon.com/containers for more.

Links:

Hashtags: #AWS #Microservices #ECS #Fargate #EKS #Lambda #DevoxxFR2018 #ArunGupta #TiffanyJernigan #CloudComputing