datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

Datadog ECS container possible memory leak

Open noma4i opened this issue 8 years ago • 5 comments

Im following this manual https://docs.datadoghq.com/integrations/amazon_ecs/ and everything works but I can see container is flapping every ~20m as it runs out of memory

image

Recommended settings for resources allocations are:

    {
      "name": "datadog-agent",
      "image": "datadog/agent:latest",
      "cpu": 10,
      "memory": 256
}

After monitoring I can see that data-dog process in container lives between 80 and 350mb RAM. Is that fine and we need update docs to set memory resource up to 384mb or it's more likely a bug somewhere?

noma4i avatar Oct 28 '18 22:10 noma4i

hi @noma4i, thanks for the report. The recommended settings should work for most people, but the agent's resource usage depends on what you do with it (how many integrations/containers/log sources it monitors, mostly). I would advise to increase the limit to see how much memory it needs to stabilize, and open a memory leak issue here if it never stabilizes, or a high memory usage issue if you think it's consuming too much memory.

I'm going to close this issue, feel free to open a new one if you notice a strange behavior. Thanks again

hkaj avatar Oct 30 '18 14:10 hkaj

@hkaj I can confirm that 320mb is good enough to run agent w/o restarts. You can update help pages with recommended setting of 320. 350mb limit hits very rarely and is not an issue.

Could you update following pages:

  • https://docs.datadoghq.com/json/dd-agent-ecs.json
  • https://docs.datadoghq.com/integrations/faq/agent-5-amazon-ecs/

I can't see place to do PR to address that configs.

noma4i avatar Nov 01 '18 13:11 noma4i

My datadog agent is getting OOM killed after using all the allocated resources for its container (2 GB). It is also using an entire core all the time. I believe this might be related with the network integration: https://docs.datadoghq.com/integrations/network/ as this only started happening when I enabled it.

andredasilvapinto avatar Jun 07 '19 14:06 andredasilvapinto

Facing similar issue with datadog agent in GKE. We have deployed it as a daemon set with 512 MI of request and 1 Gi of limit but still, only a few pods keep restarting with OOM. Also, we see a spike int the reserved memory when we do a top inside the container. PFB the output of the same:

top - 08:54:27 up 45 days, 13:15, 0 users, load average: 0.79, 1.08, 1.42 Tasks: 13 total, 1 running, 12 sleeping, 0 stopped, 0 zombie %Cpu(s): 5.4 us, 1.3 sy, 0.0 ni, 93.1 id, 0.0 wa, 0.0 hi, 0.3 si, 0.0 st MiB Mem : 120873.6 total, 856.6 free, 6882.5 used, 113134.5 buff/cache MiB Swap: 0.0 total, 0.0 free, 0.0 used. 112826.0 avail Mem

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
337 root      20   0 6123632 974480  52864 S  55.3   0.8   3:41.71 agent
338 root      20   0 5652096  27248  12976 S   1.7   0.0   0:13.08 trace-a+
339 root      20   0 5375968  67684  26004 S   0.3   0.1   0:08.17 process+
  1 root      20   0     196      4      0 S   0.0   0.0   0:00.03 s6-svsc+
 30 root      20   0     196      4      0 S   0.0   0.0   0:00.00 s6-supe+
330 root      20   0     196      4      0 S   0.0   0.0   0:00.00 s6-supe+
331 root      20   0     196      4      0 S   0.0   0.0   0:00.00 s6-supe+
333 root      20   0     196      4      0 S   0.0   0.0   0:00.00 s6-supe+
334 root      20   0     196      4      0 S   0.0   0.0   0:00.00 s6-supe+

Please update if you have solved this issue.

Thanks.

sagarpatil23192 avatar Aug 15 '19 08:08 sagarpatil23192

Hi @sagarpatil23192 You can check the status of the agent by running: kubectl exec <agent-pod-name> -ti agent status

And spot which check is taking a long time to run. From here, you can try to investigate why. It could be because of a bad configuration, not running under auto-discovery (running the check multiple times on multiple agents), etc.

I would suggest to open a ticket with our solutions team so they can pin point the issue with you.

Thanks

Simon

Simwar avatar Aug 16 '19 11:08 Simwar