0

I have an AWS Elastic Beanstalk worker environment which processes some data in Node.js based on SQS messages or Cron-Jobs.

One of the Cron-Jobs is running a main process (currently taking 20~ minutes) which launches 0-N async "child-processes". The child processes have a worst case runtime of one hour with regularly sleeps of 1 minute in it.

In the logs I found some those child processes never finishing, in a FIFO manner, so it seems like this is caused by the Load Balancer shutting down instances where those processes are still running. Those processes are also not taking up a lot of CPU because of the sleeps, which may contribute to the issue, since the load balance measurement works with the CPU metric.

Is there a simple, if possible "on-instance" way to prevent the Load Balancer shutting the instance down during the process runtime?

1 Answer 1

0

First a bit of terminology clarification. The load balancer does not handle instance scaling. It just distributes traffic to your instances. The Auto-Scaling Group is what handles instance scaling, and adding or removing instances from the load balancer's target group.

AWS Auto-Scaling groups have the ability to notify your EC2 instances when they are scheduled for termination due to scale-in events. Your EC2 instances can use Termination lifecycle hooks to postpone the termination event until they have completed their current task.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.