Skip to content

EC2 memory utilization

0

Hi All,

Our EC2 instances are using high cpu utilisation during pods bootup time on a EKS cluster but after it got stabilized cpu usage is very low. But due to high bootup cpu EKS ASG is scaling more nodes and causing the underutilization of EC2 instances . How to tackle this situation to make the EC2 instances utilise more cpu and memory? We are using General purpose t3 series instances and we have a HPA configured of our cluster

2 Answers
0

Warmup in ASG is the setting to address this. The instances CPU metrics aren't included in the ASG Aggregate metrics until the warmup time is over

How are the instances being launched? If its via a scaling policy, then set the warmup there. Otherwise, you can set a Default warmup on the ASG

However, instead of using scaling policies it might be better to use CAS (Cluster AutoScaler) to managed the size of the ASG, since it directly adds and removes instances based on the pods which are launched/pending in the cluster

Or, look into moving to Karpenter, which is newer and often the best cluster management option. It removes the need for an ASG entirely, and manages the cluster instances based on the pod requirements

AWS
EXPERT
answered a year ago
0

Analyze Pod Bootup Behavior

Use kubectl describe pod <pod-name>: Examine the pod's events for clues about the bootup process. Monitor container logs: Check for error messages or slow operations during startup. Profile container images: Identify potential bottlenecks in the image build process. Measure image pull latency: Use tools like kubectl top node to assess image pull performance.

. Tune Container Startup

Optimize application startup logic: Reduce initialization time. Consider using init containers: For tasks that don't require the application to be running. Leverage startup probes: Delay readiness probe until the application is fully initialized.

Fine-Tune HPA

Adjust metrics: Use custom metrics or average CPU utilization over a longer period. Increase target CPU utilization: Allow for higher CPU usage before scaling up. Implement cooldown periods: Prevent rapid scale-up and down cycles.

Optimize Kubelet Configuration

Increase Kubelet resource requests: Ensure the Kubelet has sufficient resources. Tune Kubelet parameters: Experiment with settings like imagePullPolicy and max-pod-start-retries.

Kubernetes documentation: https://kubernetes.io/docs/ AWS EKS documentation: https://docs.aws.amazon.com/eks/latest/userguide/

EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.