how does AWS batch works, how or when does it scale?

0

I have been reading about AWS batch but I cant seem to figure out how it scales, I cant see any settings in AWS Batch console on the trigger of when it should scale or launch a new EC2 instance or something.. So please help me understand how it works, say if i created my job queue, job definitions, compute environment, etc. All what is needed to make AWS batch in the dashboard,

When i submit a job from an application say a python script, i create a job definition, with job queue name in boto3 and submit. What will happen next? when AWS received the job, it will insert in the queue and launch a single EC2 instance right? Say if I have 2 compute environment setup in my queue, so i Assume it launch a single instance from that compute environment correct?

The job queue decides on which of the two compute instance will execute the job? so if I have 2 compute instance in my queue does that mean only these two are used on every job?

so what happen if I submit say 100 jobs altogether, is it queued and executed one at a time by either the two EC2 instance until the resources of that instance runs out? How or when does it decide to scale and launch another instance?

I need help understanding it please.

asked a year ago1475 views
2 Answers
1

AWS Batch is a fully managed service that lets you run batch computing workloads on the AWS Cloud. It automatically provisions the required compute resources, including EC2 instances, and provides you with a simple way to execute batch jobs on those resources.

When you submit a job to AWS Batch, the job is placed in a job queue. The job queue determines the order in which the jobs are executed, and can be configured to use either a First In, First Out (FIFO) or a Round Robin scheduling algorithm.

The compute resources that are used to execute the jobs are managed in a separate compute environment. A compute environment is a logical grouping of EC2 instances that are used to execute the jobs in a job queue. You can create multiple compute environments and associate them with different job queues, depending on your needs.

When you submit a job to a job queue, AWS Batch will check the status of the associated compute environment to determine whether there are any available resources to execute the job. If there are available resources, AWS Batch will start executing the job on one of those resources. If there are no available resources, AWS Batch will wait until a resource becomes available or until you specify a timeout for the job.

You can specify the minimum and maximum number of EC2 instances that you want to use in a compute environment. AWS Batch will automatically scale the number of instances up or down to meet your workload needs, based on the number of pending jobs and the defined capacity constraints. You can also use Amazon EC2 Auto Scaling to fine-tune the scaling process and to add additional custom logic to the scaling process.

SeanSi
answered a year ago
  • OK, thank you for your answer. How do I make sure that my AWS batch is scalable, as you mentioned in your answer, if there are no resources available, it will wait until a a resources is available. Our requirement is to prevent waiting but instead, if there are no available resources, it will make one to speed up process. How can we acheive that?

0

If i got you correctly, AWS engineers have you covered, dont know about your exact system, but you can do this

Use Amazon EC2 Spot Instances for your compute resources. Spot Instances allow you to take advantage of spare EC2 capacity at a significantly lower price than On-Demand Instances.

Use Amazon EC2 Auto Scaling to automatically scale your compute resources up or down based on the workload. You can set up a policy to scale out when the number of queued or running jobs increases beyond a certain threshold, and scale in when the workload decreases.

Use Amazon EC2 Fleet to automate the management of your compute resources. EC2 Fleet allows you to specify a target capacity and automatically launches the required number of Spot Instances or On-Demand Instances to meet your capacity needs.

Use Amazon CloudWatch alarms to monitor the queue size and the number of running jobs, and trigger an automatic scaling action based on the threshold that you set.

As always AWS is a business, there will be additional costs involved and many of the the products are structured to segment and get marginal value from different customer groups

SeanSi
answered a year ago
  • Thank you for your answer. My Job queue is already using a Spot instance for compute environment, does this mean I am good to go and I dont need to worry as this will scale by its own?

    Also from your comment "We can set up a policy to scale out when the number of queued or running jobs increases beyond a certain threshold, and scale in when the workload decreases."

    I cant seem to find where in the AWS dashboard i can find the scale out settings to set the job threshold, can you point me please? :)

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.

Guidelines for Answering Questions