scheduling containers on amazon ecs
TRANSCRIPT
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Chad Schmutzer, AWS Solutions Architect
October 24th, 2016
Scheduling Containers on
Amazon ECS
What is Amazon ECS?
Amazon EC2 Container Service (ECS) is a highly scalable,
high performance container management service. You
can use Amazon ECS to schedule the placement of
containers across your cluster. You can also integrate your
own scheduler or third-party scheduler to meet business
or application specific requirements.
Agenda
Container Management
Scheduling
Benefits
Demo
Container Management
Maintains Available Resources
Tracks Resource Changes
Accepts Resource Requests
Guarantees Accuracy and Consistency
What is a Container Manager?
CPU
Memory
Ports
Disk Space
Disk IOPS
Network Bandwidth
Resources
ECS
Agent
Docker
Task
Container Instance
Container
ECS Agent
Task
Container
Instance Registration
register-container-instance --total-resources
[
{
“name” : “cpu”,
“type” : “integerValue”,
“integerValue” : 2048
},
…
]
Modifying Exposed Resources
Accepting Resource Requests
Tasks
Shared Data Volume
Containers
launchContainer
Instance
Volume Definitions
Container Definitions
Starting a Task
API
User /
Scheduler
StartTask
Starting a Task
API
User /
Scheduler
StartTask
Cluster Management Engine
Starting a Task
API
User /
Scheduler
StartTask
Cluster Management Engine
Agent Communication
Starting a Task
API
User /
Scheduler
StartTask
Cluster Management Engine
Agent Communication
Docker
Container Instance
ECS Agent
Task
Container
WebSocket
Starting a Task
API
User /
Scheduler
StartTask
Cluster Management Engine
Agent Communication
Docker
Task
Container Instance
Container
ECS Agent
Task
Container
SubmitStateChange
Tracking Resource Changes
Terminated Task
API
User /
Scheduler
StartTask
Cluster Management Engine
Agent Communication
Docker
Task
Container Instance
Container
ECS Agent
SubmitStateChange
Missing Container Instance
API
User /
Scheduler
StartTask
Cluster Management Engine
Docker
Task
Container Instance
Container
ECS Agent
?
Agent Communication
Terminated Container Instance
API
User /
Scheduler
StartTask
Cluster Management Engine
Agent Communication
Termination
Notifier
Docker
Task
Container Instance
Container
ECS Agent
Guaranteeing Accuracy and
Consistency
Amazon ECS under the Hood
IDN-1 IDN IDN+1 IDN+2 IDN+3 IDN+4 IDN+5
IDN+6
IDN+5
WRITE
READ
Amazon ECS under the Hood
IDN-1 IDN IDN+1 IDN+2 IDN+3 IDN+4 IDN+5
IDN+6IDN+3
IDN+5IDN+2
WRITE WRITE
READREAD
Schedulers
What is a Scheduler?
Determine Desired State
Check Against Current State
Perform Action
ECS Schedulers
Batch Jobs
ECS Task scheduler
Run tasks once
Batch jobs
RunTask (random)
StartTask (placed)
Long-Running Apps
ECS Service scheduler
Health management
Scale-up and scale-down
AZ aware
Grouped Containers
Custom Schedulers
1. Calls the ECS List* and Describe* API operations to
determine the current state of the cluster.
2. Selects one (or more) container instances according to
the logic implemented.
3. Calls StartTask API to start a task on the selected
container instance.
Integration with third party schedulers
ECS allows you to use third party schedulers, e.g.
Marathon and Chronos
Integration via ECS API
For Mesos schedulers, the ECSSchedulerDriver interprets
the command given when scheduling jobs with Mesos and
starts a task with TaskDefinition family:revision
Amazon ECS Service Scheduler
Discovering DifferencesDeployment Status Desired Pending Running
ecs-svc/1 PRIMARY 5 0 0
Minimum Healthy Maximum Healthy
50% 200%
Steady State
Determine
Placement Options
Deploy Task
Service State Machine
RUNNING == DESIRED
RUNNING != DESIRED &&
STATUS == PRIMARY
ALL_RUNNING < MAX_HEALTHY
Discovering DifferencesDeployment Status Desired Pending Running
ecs-svc/2 PRIMARY 10 0 0
ecs-svc/1 ACTIVE 5 0 5
Minimum Healthy Maximum Healthy
50% 200%
Steady State
Determine
Placement Options
Deploy Task
RUNNING == DESIRED
RUNNING != DESIRED &&
STATUS == PRIMARY
ALL_RUNNING < MAX_HEALTHY
Service State Machine
Clear Deployment Kill Task
ALL_RUNNING >
MAX_HEALTHY
RUNNING != DESIRED &&
STATUS == ACTIVE
Other Considerations
ELB Registration/Deregistration
Permissions and Errors
Task Health
Scale Down Requests
Multiple Schedulers
Amazon ECS – Scheduling
Amazon ECS – Scheduling
Amazon ECS – Scheduling
Amazon ECS – Scheduling
Demo
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
All attendees will receive a special giveaway gift!
Please join us for the
AWS DevDay Networking Reception
5:00 - 6:30 PM
JW Grand Foyer
Thank You!
Don’t Forget Evaluations!