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

Could trace-agent feasibly run as a K8S deployment to improve resource efficiency?

Open maxenglander opened this issue 6 years ago • 2 comments

One of the challenges of running trace-agent container as part of the K8S DaemonSet is that some workloads generate a lot more trace data than others. These workloads are distributed unevenly across K8S workers, so as a result the trace-agent container on some workers have very high CPU and memory usage, while others have very low. As a result, we have to set CPU and memory limits very high for the trace-agent container to avoid OOM, which can lead to wasted CPU/memory resources on workers that aren't processing lots of trace data.

I don't know enough about how the trace-agent works, so my question is just about the feasibility of making trace-agent a deployment with pods that can process traces from any node. Feasibility aside, this would lead to more efficient use of resources. I do see a reference here to creating a headless Service for to process traces, so based on that I think it should be possible for trace-agents to process traces from other hosts. I know that many trace clients also generate DogStatsD metrics -- I don't know whether it's OK/safe to have those be sent to a different host than the client.

maxenglander avatar Oct 30 '20 16:10 maxenglander

Hey @maxenglander

It is possible, but this would have some side effects that would basically remove some APM mechanisms. The current mechanism is that application containers will send traces to the agent on the same node. This adds the right host tags and container tags to the traces (thanks to the local kubelet), as well as linking the traces to the trace metrics.

If you have a trace-agent living on another node, receive the trace, you will lose this cardinality which will impact a lot the APM UI because the linked Infra metrics and container metrics will either wrong or not visible. It also reduces troubleshooting abilities from support :) because we will not able to link the trace back to one host in particular.

Simon - Datadog Support Engineer

Simwar avatar Dec 07 '20 16:12 Simwar

Makes sense @Simwar thanks for the reply

maxenglander avatar Dec 07 '20 18:12 maxenglander