hackoregon / civic-devops

Master collection point for issues, procedures, and code to manage the HackOregon Civic platform
MIT License
11 stars 4 forks source link

Create doc on process to check service resource usage in ECS #127

Open iant01 opened 6 years ago

iant01 commented 6 years ago

Document the docker commands and their format for determining the amount of CPU and Memory being used by a service an docker command that can be used to verify the which image in ECR is currently running in ECS for a service.

iant01 commented 6 years ago

Command sequence to dump the container resource usage.

docker ps --format "{{.Names}}"  |  xargs docker stats  $1

CONTAINER                                                          CPU %               MEM USAGE / LIMIT     MEM %               NET I/O               BLOCK I/O             PIDS
ecs-civic-2018-service-3-civic-2018-service-b2f4bccad180e88b4600   0.00%               63.48 MiB / 100 MiB   63.48%              2.242 MB / 5.78 MB    32.01 MB / 0 B        0
ecs-civic-2017-service-4-civic-2017-service-f2b2ede19cd3f2df9101   0.00%               64.7 MiB / 100 MiB    64.70%              2.281 MB / 5.86 MB    33.96 MB / 0 B        0
ecs-civic-lab-service-6-civic-lab-service-c6dba389ebd68e95df01     0.00%               9.559 MiB / 1 GiB     0.93%               8.622 MB / 14.86 MB   10.09 MB / 0 B        0
ecs-transport-service-58-transport-service-92c6c0b38c82f1fbd301    0.07%               775.4 MiB / 2 GiB     37.86%              81.9 MB / 32.02 MB    83.41 MB / 0 B        0
ecs-agent                                                          0.38%               27.15 MiB / 7.8 GiB   0.34%               0 B / 0 B             12.84 MB / 84.75 MB   0
ecs-homeless-service-66-homeless-service-f09291e7b2ebd49d5600      0.04%               114.9 MiB / 128 MiB   89.77%              49.87 MB / 418.1 MB   45.03 MB / 0 B        0
ecs-budget-service-129-budget-service-a8e0f5c0a3bd89997400         0.04%           89.23 MiB / 100 MiB   89.23%              1.558 GB / 3.429 GB   66.47 MB / 0 B        0
ecs-emergency-service-132-emergency-service-bac08894d08fc69fba01   0.04%               94.47 MiB / 100 MiB   94.47%              1.713 GB / 4.244 GB   45.31 GB / 0 B        0
ecs-endpoint-service-22-endpoint-service-b2b4e28eabca82e89101      0.00%               9.559 MiB / 128 MiB   7.47%               1.022 GB / 2.054 GB   10.1 MB / 0 B         0
iant01 commented 6 years ago

Command sequence to dump the service and the current image running (as of 05/24/2018 all services are running the images tagged as last in ECR)

docker images  --digests --format="{{.Repository}}  {{.Digest}}" | sed 's/^845828040396.dkr.ecr.us-west-2.amazonaws.com\///'

production/civic-2017  sha256:9cadeaa8751b6d15387fb2acca69c9911d4116aa76ff33032abc5ff648b5dd01
production/civic-2018  sha256:b41442ee62d964c3457020e452e687cc14657546c26228e8c646c07401d8d196
integration/homeless-service  sha256:3beb2d7ee748398300464de429088fab714de87aeb05bae4241738284d3aec95
integration/budget-service  sha256:65096bf2e709064431ccbe1760c5278dbb1378a32d14179e272110ce60812673
amazon/amazon-ecs-agent  <none>
<none>  <none>
integration/transport-service  sha256:b81b284f9969ffb8e5d1ef6649e209203c3714c5b26882169ac99910d8ab647c
integration/housing-service  sha256:f0db0fd24420e96ade2189b29bc6efbdba5b7a00e30d69ef731d34d3831f3a10
integration/emergency-service  sha256:1446b2ce1ea43a4a9ffe98fe4b6758c726390f106c76cffb9e0c5e789ecc55cd
integration/endpoint-service  sha256:27ea44a0fb3464b51104f2ae9c1f91678fbd9a765d13283c7a4e1628c5753981
integration/civic-lab-service  sha256:64956c3fb42d28f87350bf1d63462d2ce8adb84f923aabbc7c200574739fcf06
<none>  <none>
MikeTheCanuck commented 6 years ago

I fixed formatting and a missing " character - the first command is darned useful for real-time performance observations.