Autoscaling Web Servers with Fargate

1

ECS Task

├Apache Container

└Gogs Container

We are considering autoscaling with the above Fargate configuration.

In terms of autoscaling

・CPU utilization

・Memory usage

・Client concurrent connections

We think that these should be monitored, but is there anything else we should consider?

Also, is there a good way to monitor the number of concurrent client connections?

User4
질문됨 2년 전265회 조회
1개 답변
2
수락된 답변

How and when to scale in/out really depends on your workload. Is your application primarily CPU bound? Auto scale on CPU utilization. Is it memory bound? Auto scale on memory utilization. Do you have a predictable time-based usage profile, such as busy times during work days and quiet times during evenings/weekends? Auto scale using scheduled scaling.

Based on my experience, concurrent client connections may not be the best metric to use for auto scaling. You probably care most about user experience and cost - you want to provide the best possible user experience (e.g. fastest performance) for the lowest cost. Concurrent connections is probably correlated to CPU, memory, and response time: the more connections, the higher the CPU and memory usage, and the lower the response time. Instead, measure and scale based on response time.

ALBs publish a TargetResponseTime metric, but this isn't actually very useful. As noted in the ALB docs, this metric measures "the total time elapsed (in seconds, with millisecond precision) from the time the load balancer sent the request to a target until the target started to send the response headers. That may be what you want, but more likely you want the total processing time - the time elapsed between receiving a request and sending a complete response. The ALB cannot help with that, so instead you can publish a custom metric and scale based on that.

For auto scaling on CPU and memory utilization, use target tracking scaling. For auto scaling on response time, use step scaling with the custom CloudWatch metric published by your application.

Hope this info helps.

profile picture
전문가
bwhaley
답변함 2년 전
profile picture
지원 엔지니어
검토됨 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠