amazon ec2 - What does 'cpu' parameter mean in aws container service? -
i'm going register new task in container service t2.medium. saw examples cpu parameter equal 0. i'm trying find out , how many need put here 1 task.
all able find according question: http://docs.aws.amazon.com/amazonecs/latest/developerguide/task_definition_parameters.html?shortfooter=true http://docs.aws.amazon.com/amazonecs/latest/developerguide/example_task_definitions.html
"the number of cpu units reserve container. container instance has 1,024 cpu units every cpu core. parameter specifies minimum amount of cpu reserve container, , containers share unallocated cpu units other containers on instance same ratio allocated amount. parameter maps cpushares in create container section of docker remote api , --cpu-shares option docker run."
a t2.medium has 2 vcpus, has 2,048 available cpu units schedule out. if want single container running on host can budget 2,048 cpu units, no other containers ever placed on host.
containers guaranteed @ least budgeted cpu when need it. additionally, neat thing cpu units container can burst above allocated units if no other containers taking resource. instance, if have 2 tasks running on t2.medium, each 1,024 budgeted cpu units, each task individually burst 2,048 given other task idle. when start sharing hosts way, can squeeze cost savings out of using ecs.
additionally, if of cpu units not budgeted out, ecs automatically divvy remaining cpu units each container @ ratio of budgeted cpu units. if have 2 tasks running on t2.medium each 0 cpu units, each container 1,024 cpu units since no other container has reserved them.
one thing note here memory works bit differently; hard limit. if container ever tries allocate more memory budgeted, task/container exit. can underprovision cpu units , away (because containers can burst above provision), need make sure stay within memory contraints.
example: if set 0, take proportionate amount of unreserved cpu. assume these scenarios on t2.mediums 2,048 cpu units:
task #1 - 0 cpu units, task #2 - 0 cpu units: in situation, both task#1 , task#2 given 1,024 cpu units, since there 2,048 unreserved units. since tasks 1:1 cpu unit reservations, both equal share of available cpu units.
task #1 - 0 cpu units, task #2 - 1,024 cpu units: task #2 given 2,048 cpu units , task#1 given 0 since trying divvy 1,024 unused cpu units @ ratio of 0:1,024.
task #1 - 0 cpu units: if 1 task on machine, given 2,048 cpu units since units unused, split among containers @ ratio of reservation.
Comments
Post a Comment