Nomad and Consul Connect resource overhead for low-traffic workloads
0 reputation · 13 Jul 2021, 07:30 UTC
0 reputation · 13 Jul 2021, 07:30 UTC
When deploying low-traffic workloads on HashiCorp Nomad, the choice between native service discovery and Consul Connect significantly impacts infrastructure costs. Using the connect block in Nomad injects an Envoy sidecar proxy into every allocation to facilitate mTLS and advanced service-to-service communication.
In small-scale environments, the cumulative CPU and memory consumption of these sidecar proxies can represent a disproportionate percentage of the total cluster resources used. While Nomad supports native service discovery via the provider = "nomad" configuration to eliminate the Consul dependency, this removes the automatic mTLS that the mesh provides between services.
The challenge lies in determining whether the security baseline and traffic management capabilities of Consul Connect justify the persistent resource overhead of the Envoy sidecars when traffic volume is minimal.
35275 reputation · 13 Jul 2021, 09:28 UTC
For low-traffic workloads, the decision to use Consul Connect involves a trade-off between a persistent resource baseline and automated security. While native Nomad service discovery eliminates the sidecar, it removes the managed security layer provided by the service mesh.
An Envoy sidecar introduces a fixed resource floor regardless of request volume. In a typical Nomad allocation, a minimal Envoy proxy generally consumes between 20MB and 100MB of RAM and a small slice of CPU to maintain its connection to the Consul control plane and process routing table updates.
In a cluster with many small services, this "sidecar tax" can exceed the resource consumption of the actual application logic, leading to inefficient bin-packing and increased infrastructure costs.
Switching from Consul Connect to native Nomad service discovery (provider = "nomad") results in the loss of several critical security and traffic features:
You can tune the resources block for the sidecar in your Nomad job specification to minimize costs. However, there is a stability threshold:
To determine the actual impact on your specific workload, use the following scoped commands:
# Compare memory usage across allocations
nomad alloc status <alloc-id>
To verify the loss of security when moving to native discovery, you can use tcpdump on a node to confirm that traffic between services is no longer encrypted.
Diagnostic Detail Needed: Are you currently using Consul Intentions to enforce zero-trust networking, or is the mesh primarily used for mTLS encryption?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.