The only agent that thinks for itself

Autonomous Monitoring with self-learning AI built-in, operating independently across your entire stack.

Unlimited Metrics & Logs
Machine learning & MCP
5% CPU, 150MB RAM
3GB disk, >1 year retention
800+ integrations, zero config
Dashboards, alerts out of the box
> Discover Netdata Agents

Centralized metrics streaming and storage

Aggregate metrics from multiple agents into centralized Parent nodes for unified monitoring across your infrastructure.

Stream from unlimited agents
Long-term data retention
High availability clustering
Data replication & backup
Scalable architecture
Enterprise-grade security
> Learn about Parents

Fully managed cloud platform

Access your monitoring data from anywhere with our SaaS platform. No infrastructure to manage, automatic updates, and global availability.

Zero infrastructure management
99.9% uptime SLA
Global data centers
Automatic updates & patches
Enterprise SSO & RBAC
SOC2 & ISO certified
> Explore Netdata Cloud

Deploy Netdata Cloud in your infrastructure

Run the full Netdata Cloud platform on-premises for complete data sovereignty and compliance with your security policies.

Complete data sovereignty
Air-gapped deployment
Custom compliance controls
Private network integration
Dedicated support team
Kubernetes & Docker support
> Learn about Cloud On-Premises

Powerful, intuitive monitoring interface

Modern, responsive UI built for real-time troubleshooting with customizable dashboards and advanced visualization capabilities.

Real-time chart updates
Customizable dashboards
Dark & light themes
Advanced filtering & search
Responsive on all devices
Collaboration features
> Explore Netdata UI

Monitor on the go

Native iOS and Android apps bring full monitoring capabilities to your mobile device with real-time alerts and notifications.

iOS & Android apps
Push notifications
Touch-optimized interface
Offline data access
Biometric authentication
Widget support
> Download apps

The future of infrastructure observability

See our strategic direction across AI-native observability, full-stack signals, operational intelligence, and enterprise platform maturity.

AI-native observability
Full-stack signal coverage
Operational intelligence
Enterprise platform maturity
Agent releases every 6 weeks
Cloud continuous delivery
> Explore Product Roadmap

Best energy efficiency

True real-time per-second

100% automated zero config

Centralized observability

Multi-year retention

High availability built-in

Zero maintenance

Always up-to-date

Enterprise security

Complete data control

Air-gap ready

Compliance certified

Millisecond responsiveness

Infinite zoom & pan

Works on any device

Native performance

Instant alerts

Monitor anywhere

AI-native observability

Continuous delivery

Open source foundation

80% Faster Incident Resolution

AI-powered troubleshooting from detection, to root cause and blast radius identification, to reporting.

True Real-Time and Simple, even at Scale

Linearly and infinitely scalable full-stack observability, that can be deployed even mid-crisis.

90% Cost Reduction, Full Fidelity

Instead of centralizing the data, Netdata distributes the code, eliminating pipelines and complexity.

See and Map Your Entire Network

Live topology, flow analytics, and SNMP device and trap monitoring — unified with your full-stack observability.

Control Without Surrender

SOC 2 Type 2 certified with every metric kept on your infrastructure.

Integrations

800+ collectors and notification channels, auto-discovered and ready out of the box.

800+ data collectors
Auto-discovery & zero config
Cloud, infra, app protocols
Notifications out of the box
> Explore integrations
Real Results
46% Cost Reduction

Reduced monitoring costs by 46% while cutting staff overhead by 67%.

— Leonardo Antunez, Codyas

Zero Pipeline

No data shipping. No central storage costs. Query at the edge.

From Our Users
"Out-of-the-Box"

So many out-of-the-box features! I mostly don't have to develop anything.

— Simon Beginn, LANCOM Systems

No Query Language

Point-and-click troubleshooting. No PromQL, no LogQL, no learning curve.

Enterprise Ready
67% Less Staff, 46% Cost Cut

Enterprise efficiency without enterprise complexity—real ROI from day one.

— Leonardo Antunez, Codyas

SOC 2 Type 2 Certified

Zero data egress. Only metadata reaches the cloud. Your metrics stay on your infrastructure.

Full Coverage
800+ Collectors

Auto-discovered and configured. No manual setup required.

Any Notification Channel

Slack, PagerDuty, Teams, email, webhooks—all built-in.

Built for the People Who Get Paged

Because 3am alerts deserve instant answers, not hour-long hunts.

Every Industry Has Rules. We Master Them.

See how healthcare, finance, and government teams cut monitoring costs 90% while staying audit-ready.

Monitor Any Technology. Configure Nothing.

Install the agent. It already knows your stack.
From Our Users
"A Rare Unicorn"

Netdata gives more than you invest in it. A rare unicorn that obeys the Pareto rule.

— Eduard Porquet Mateu, TMB Barcelona

99% Downtime Reduction

Reduced website downtime by 99% and cloud bill by 30% using Netdata alerts.

— Falkland Islands Government

Real Savings
30% Cloud Cost Reduction

Optimized resource allocation based on Netdata alerts cut cloud spending by 30%.

— Falkland Islands Government

46% Cost Cut

Reduced monitoring staff by 67% while cutting operational costs by 46%.

— Codyas

Real Coverage
"Plugin for Everything"

Netdata has agent capacity or a plugin for everything, including Windows and Kubernetes.

— Eduard Porquet Mateu, TMB Barcelona

"Out-of-the-Box"

So many out-of-the-box features! I mostly don't have to develop anything.

— Simon Beginn, LANCOM Systems

Real Speed
Troubleshooting in 30 Seconds

From 2-3 minutes to 30 seconds—instant visibility into any node issue.

— Matthew Artist, Nodecraft

20% Downtime Reduction

20% less downtime and 40% budget optimization from out-of-the-box monitoring.

— Simon Beginn, LANCOM Systems

Pay per Node. Unlimited Everything Else.

One price per node. Unlimited metrics, logs, users, and retention. No per-GB surprises.

Free tier—forever
No metric limits or caps
Retention you control
Cancel anytime
> See pricing plans

What's Your Monitoring Really Costing You?

Most teams overpay by 40-60%. Let's find out why.

Expose hidden metric charges
Calculate tool consolidation
Customers report 30-67% savings
Results in under 60 seconds
> See what you're really paying

Your Infrastructure Is Unique. Let's Talk.

Because monitoring 10 nodes is different from monitoring 10,000.

On-prem & air-gapped deployment
Volume pricing & agreements
Architecture review for your scale
Compliance & security support
> Start a conversation

Monitoring That Sells Itself

Deploy in minutes. Impress clients in hours. Earn recurring revenue for years.

30-second live demos close deals
Zero config = zero support burden
Competitive margins & deal protection
Response in 48 hours
> Apply to partner

Per-Second Metrics at Homelab Prices

Same engine, same dashboards, same ML. Just priced for tinkerers.

Community: Free forever · 5 nodes · non-commercial
Homelab: $90/yr · unlimited nodes · fair usage
> Get the Homelab Plan

$1,000 Per Referral. Unlimited Referrals.

Your colleagues get 10% off. You get 10% commission. Everyone wins.

10% of subscriptions, up to $1,000 each
Track earnings inside Netdata Cloud
PayPal/Venmo payouts in 3-4 weeks
No caps, no complexity
> Get your referral link
Cost Proof
40% Budget Optimization

"Netdata's significant positive impact" — LANCOM Systems

Calculate Your Savings

Compare vs Datadog, Grafana, Dynatrace

Savings Proof
46% Cost Reduction

"Cut costs by 46%, staff by 67%" — Codyas

30% Cloud Bill Savings

"Reduced cloud bill by 30%" — Falkland Islands Gov

Enterprise Proof
"Better Than Combined Alternatives"

"Better observability with Netdata than combining other tools." — TMB Barcelona

Real Engineers, <24h Response

DPA, SLAs, on-prem, volume pricing

Why Partners Win
Demo Live Infrastructure

One command, 30 seconds, real data—no sandbox needed

Zero Tickets, High Margins

Auto-config + per-node pricing = predictable profit

Homelab Ready
Free Video Course

8-episode Netdata tutorial by LearnLinux.tv

76k+ GitHub Stars

3rd most starred monitoring project

Worth Recommending
Product That Delivers

Customers report 40-67% cost cuts, 99% downtime reduction

Zero Risk to Your Rep

Free tier lets them try before they buy

AI Support Assistant, Available 24/7

Nedi has access to all official documentation, source code, and resources. Ask any question about Netdata—responds in your language.

Deployment & configuration
Troubleshooting & sizing
Alerts & notifications
Evidence-based answers
> Ask Nedi now

Never Fight Fires Alone

Docs, community, and expert help—pick your path to resolution.

Learn.netdata.cloud docs
Discord, Forums, GitHub
Premium support available
> Get answers now

60 Seconds to First Dashboard

One command to install. Zero config. 850+ integrations documented.

Linux, Windows, K8s, Docker
Auto-discovers your stack
> Read our documentation

76,000+ Engineers Strong

615+ contributors. 1.5M daily downloads. One mission: simplify observability.

Per-Second. 90% Cheaper. Data Stays Home.

Side-by-side comparisons: costs, real-time granularity, and data sovereignty for every major tool.

See why teams switch from Datadog, Prometheus, Grafana, and more.

> Browse all comparisons
Edge-Native Observability, Born Open Source
Per-second visibility, ML on every metric, and data that never leaves your infrastructure.
Founded in 2016
615+ contributors worldwide
Remote-first, engineering-driven
Open source first
> Read our story
Promises We Publish—and Prove
12 principles backed by open code, independent validation, and measurable outcomes.
Open source, peer-reviewed
Zero config, instant value
Data sovereignty by design
Aligned pricing, no surprises
> See all 12 principles
Edge-Native, AI-Ready, 100% Open
76k+ stars. Full ML, AI, and automation—GPLv3+, not premium add-ons.
76,000+ GitHub stars
GPLv3+ licensed forever
ML on every metric, included
Zero vendor lock-in
> Explore our open source
Build Real-Time Observability for the World
Remote-first team shipping per-second monitoring with ML on every metric.
Remote-first, fully distributed
Open source (76k+ stars)
Challenging technical problems
Your code on millions of systems
> See open roles
Meet the Team Behind Netdata
Conferences, meetups, and tradeshows where you can see Netdata in action and talk to the engineers who build it.
Live demos and deep dives
Book 1-on-1 meetings
Talks and panel sessions
Event recaps and photos
> See all events
Talk to a Netdata Human in <24 Hours
Sales, partnerships, press, or professional services—real engineers, fast answers.
Discuss your observability needs
Pricing and volume discounts
Partnership opportunities
Media and press inquiries
> Book a conversation
Your Data. Your Rules.
On-prem data, cloud control plane, transparent terms.
Trust & Scale
76,000+ GitHub Stars

One of the most popular open-source monitoring projects

SOC 2 Type 2 Certified

Enterprise-grade security and compliance

Data Sovereignty

Your metrics stay on your infrastructure

Validated
University of Amsterdam

"Most energy-efficient monitoring solution" — ICSOC 2023, peer-reviewed

ADASTEC (Autonomous Driving)

"Doesn't miss alerts—mission-critical trust for safety software"

Community Stats
615+ Contributors

Global community improving monitoring for everyone

1.5M+ Downloads/Day

Trusted by teams worldwide

GPLv3+ Licensed

Free forever, fully open source agent

Why Join?
Remote-First

Work from anywhere, async-friendly culture

Impact at Scale

Your work helps millions of systems

$ guides / nats / nats-goroutine-leak ▌

Operations Guides

NATS goroutine leak: connection cleanup that never completes

The symptom is a steady, one-directional climb. Goroutine count goes up day after day, RSS follows it, and nothing on the traffic side explains it: client connections are flat, routes are flat, throughput is flat. Then, weeks later, the server gets OOM-killed or starts showing GC and scheduling overhead that has nothing to do with message load.

A NATS goroutine leak is connection (or subsystem) cleanup that never completes. A goroutine is spawned to handle a connection, a timer, or a Raft loop; the work ends, but the goroutine never exits. It sits blocked on a channel receive that will never fire, a lock that will never be released, or a retry loop with nothing to retry. Each one is cheap individually, so the leak is invisible until it is not: at roughly 4-8KB of stack per goroutine, 100k leaked goroutines is about 400-800MB of RSS.

The reason most teams find this late is instrumentation. Goroutine count is not on the standard NATS monitoring port: /varz gives you connections, memory, and throughput, but not goroutines. The authoritative source is the Go pprof endpoint (/debug/pprof/goroutine), which is only available if profiling was enabled in the server config. Many teams enable neither pprof nor metrics until they are already in the incident.

What this means

NATS is a Go server, and its concurrency model is predictable. Every client TCP connection gets dedicated read and write goroutines. Routes, gateways, and leaf node connections get the same treatment. On top of that sits a fixed set of server internals, plus JetStream Raft goroutines if persistence is enabled. The expected steady-state count is roughly:

goroutines ~ 2 x (clients + routes + gateways + leafs)
           + server internals (~50-100)
           + JetStream Raft goroutines (if enabled)

That formula is the whole diagnostic key. Goroutine count should track connection count. When connections are flat and goroutines grow, something is being created without being destroyed. Three mechanisms produce that pattern:

  1. Cleanup that never completes. A connection closes, but its goroutines stay blocked on a channel or lock, so they never return.
  2. Stuck goroutines. A goroutine is parked on a receive from a closed or abandoned channel, or on a mutex held by another stuck goroutine. This is where client library bugs live: a Next() call that blocks forever after the server goes away, or a Drain() that deadlocks against an in-flight Next().
  3. Accumulating background work. Raft-related goroutines or timer loops that pile up instead of being reused, common after repeated elections or reconnect churn.

The blast radius is memory and scheduler overhead first, then GC pressure, then OOM. The server usually keeps routing messages correctly for a long time, which is why this class of bug survives to production.

flowchart TD
  A[Goroutine count rising] --> B{Connections also rising?}
  B -->|Yes| C[Not a leak: load growth or churn.
Check total_connections delta] B -->|No| D[Leak: capture a goroutine dump] D --> E{Where are the stacks parked?} E -->|Connection read/write paths| F[Server-side cleanup not completing
or route/gateway stuck] E -->|Client library: Next, Drain, reconnect loops| G[Client bug or app leak
new connection per request] E -->|Raft loops and timers| H[JetStream Raft accumulation
after election churn] F --> I[Upgrade server, restart to reclaim] G --> J[Fix app lifecycle, upgrade client] H --> K[Upgrade server, review Raft health]

Common causes

CauseWhat it looks likeFirst thing to check
Application connection leakGoroutines and connections both grow; clients open a new connection per request and never close ittotal_connections delta vs. stable connections on /varz; audit app code for unclosed connections
Client library stuck Next() / deadlocked Drain()Client process goroutines climb; consumers stop progressing after server restarts or shutdownsGoroutine dump of the client process; look for stacks parked in Next() or drain cleanup
Server-side cleanup not completingServer goroutines grow while connections is flat; stacks parked in connection close pathsGoroutine dump on the server; count stacks in connection teardown
Route/gateway goroutines stuck after network eventsGrowth steps up after partitions or reconnection storms; route count is back to normalDump stacks mentioning route or gateway paths; correlate with route churn history
Raft goroutine accumulationGrowth tracks JetStream election storms or stream/consumer churn/jsz meta cluster leader changes, /raftz, election events in logs

Version note: specific stuck-goroutine bugs are version-dependent. Known examples from upstream issues include nats.go Next() blocking indefinitely after server shutdown, and a Drain() deadlock when Next() is already blocked waiting for messages, in older client releases. Server-side, several releases have shipped fixes for goroutine and timer retention in reconnect loops, healthcheck monitors, and interest-tracking goroutines. If your dump matches one of these patterns, the fix is usually an upgrade. Check the release notes for your exact server and client versions before concluding you have a novel bug.

Quick checks

The curl checks are read-only and cheap. The full dump (step 6) and SIGQUIT (step 7) are not; read the warnings before running either.

# 1. Goroutine count via pprof (if enabled with the prof_port config option, typically 6060).
#    The first line of the debug=1 output is the total.
curl -s http://localhost:6060/debug/pprof/goroutine?debug=1 | head -1

# 2. Connection counts to compare against the baseline formula
curl -s http://localhost:8222/varz | jq '{connections, routes, leafnodes, mem, uptime}'

# 3. Route and gateway counts for the full baseline
curl -s http://localhost:8222/routez | jq '.num_routes'
curl -s http://localhost:8222/gatewayz | jq '{out: (.outbound_gateways | length), in: (.inbound_gateways | length)}'

# 4. Connection churn: is the cumulative counter racing while current count is flat?
curl -s http://localhost:8222/varz | jq '{active: .connections, lifetime_total: .total_connections}'
# 5. Full goroutine dump with stack traces (EXPENSIVE: can pause the scheduler
#    and spike latency on a busy server. Run once, off-peak if possible.)
curl -s http://localhost:6060/debug/pprof/goroutine?debug=2 > /tmp/nats-goroutines.txt

# 6. Fallback if pprof is not enabled: SIGQUIT dumps all goroutine stacks to stderr.
#    WARNING: on a default Go runtime, SIGQUIT dumps the stacks and then TERMINATES
#    the process. Treat this as a disruptive action, not a probe. Verify how your
#    nats-server build handles SIGQUIT before using it, and capture stderr from the
#    service manager (journald, container logs) since the dump goes there.
kill -QUIT $(pgrep nats-server)

The server registers handlers only for SIGINT, SIGTERM, SIGHUP, SIGUSR1, and SIGUSR2; SIGQUIT follows default Go runtime behavior (dump stacks to stderr, then terminate the process).

For a client-side leak, the same pprof endpoints work against your application if it exposes them, and SIGQUIT works on any Go client process, with the same terminate-after-dump caveat. For deployments with the system account set up, the NATS CLI can also request a goroutine profile from a server remotely. (the subcommand is nats server request profile goroutine)

A note on Prometheus: if you scrape the prometheus-nats-exporter (default port 7777), its go_goroutines series typically describes the exporter process itself, not the NATS server. Do not use it as the server goroutine count unless you have confirmed your exporter re-exports the server’s runtime stats. The pprof endpoint is authoritative.

How to diagnose it

  1. Confirm the trend, not the point value. A single goroutine count is meaningless. You need the slope over hours or days. If you only have pprof and no time series, take three samples an hour apart and compare. Flat connections plus rising goroutines is the leak signature.

  2. Compute the baseline. Pull connections, routes, gateway count, and leafnodes from /varz, /routez, /gatewayz. Apply the formula: 2 x (sum of all connection types) + server internals + Raft goroutines. If the actual count is 50% or more above the estimate and still climbing, you have a leak.

  3. Check for churn masquerading as growth. If total_connections is racing while connections is flat, clients are flapping. High churn amplifies small per-connection leaks: each reconnect cycle that fails to fully clean up adds a few permanent goroutines. See the connection churn and connection storm guides if this is your pattern.

  4. Capture a full dump once. Use debug=2 (or SIGQUIT only if pprof is off and you accept the restart risk). On a server with 100k+ goroutines this file is large and generation stalls the process briefly. Warn your team before running it in production.

  5. Group the stacks. Do not read the dump linearly. Count goroutines by their top frames:

# Histogram of the top stack frame each goroutine is parked in
awk '/^goroutine /{getline; print}' /tmp/nats-goroutines.txt | sort | uniq -c | sort -rn | head -30

The leaked population shows up as hundreds or thousands of goroutines with identical stacks, all blocked in the same place: a channel receive, sync.Mutex.Lock, select in a reconnect or iterator loop, or a Raft apply/ticker path.

  1. Map the dominant stack to a subsystem. Connection read/write loops point to server-side cleanup. Stacks in client library iterators (Next(), drain, subscription cleanup) point to the client. Raft ticks and apply loops point to JetStream. One dominant stack signature, thousands of copies: that is your leak.

  2. Correlate with history. Line the growth curve up against deploys, server restarts, network events, and Raft elections. A leak that steps up after every client deploy is application-side. One that steps up after every partition event is server or route side.

  3. Check the client processes too. If the server is clean but clients show the same growth pattern, the leak is in the client library or the application’s connection lifecycle. The most common application bug is trivial: opening a new connection per request or per goroutine and never calling Close() (or Drain() then Close()), leaving old connections and their goroutines alive until timeout.

Metrics and signals to monitor

SignalWhy it mattersWarning sign
Goroutine count (pprof endpoint)The leak indicator itselfMonotonic growth over hours/days with flat connections
/varz connections + routes + gateways + leafsThe baseline the goroutine count should trackGoroutine growth decoupled from this sum
/varz mem (RSS)Goroutine stacks show up here; 100k leaked is ~400-800MBRSS climbing with no GC recovery, tracking goroutine growth
/varz total_connections deltaChurn amplifies per-connection cleanup failuresLifetime counter racing while active count is flat
/varz slow_consumersIndicates consumers falling behind, which stresses cleanup pathsNon-zero sustained
JetStream meta leader changes (/jsz)Election storms correlate with Raft goroutine accumulationLeader flapping, repeated elections
/varz uptimeBounds how long the leak has had to accumulateRecent reset means the counter baseline restarted

Fixes

Application connection leak

Reuse connections. A NATS connection is designed to be long-lived and multiplexed; one per process, or a small pool, is the norm. Audit for code paths that connect per request, per message, or per goroutine, and make sure every path calls Close() on shutdown, ideally Drain() then Close() so inflight messages finish first. Tradeoff: pooling adds a little coordination complexity, but it eliminates the entire class of leak.

Client library stuck goroutines

If the dump shows goroutines parked in Next(), drain cleanup, or reconnect loops, you are likely on an affected client version. Upgrade the client library and re-test your shutdown path explicitly: kill the server mid-consume and verify the client’s consumer goroutines exit. If you cannot upgrade immediately, the only reliable recovery for a process full of permanently blocked iterator goroutines is a process restart, so gate it behind supervision that detects stalled consumption.

Server-side cleanup or route/gateway leaks

Check release notes for your server version against goroutine, timer, and cleanup fixes; this class of bug is almost always resolved by upgrading, not configuring. If the leaked goroutines are tied to route or gateway churn, also address the underlying instability (network, RTT, flapping) or the leak will keep re-accumulating after every event.

Raft goroutine accumulation

Treat the election storm as the primary problem: stabilize inter-node latency, disk I/O, and CPU headroom so Raft stops churning, then upgrade the server. Restarting to reclaim the goroutines without fixing the elections just resets the clock.

Reclaiming memory now

The only way to reclaim goroutine stacks in a running Go process is for the goroutines to exit, and leaked ones never do. A restart is the reclamation, and it is legitimate here once you have captured a dump and identified the cause. Do it rolling in a cluster, and capture the dump first: after the restart the evidence is gone.

Prevention

  • Collect the goroutine count permanently. Scrape the pprof endpoint on a schedule, or confirm a metrics path that reflects the server’s runtime, so the count is a time series rather than an incident-time surprise. Trend it against the connection baseline and alert on divergence, not on absolute values.
  • Alert on the ratio, not the count. Goroutines per connection that climbs steadily is the actionable signal. Absolute thresholds break across deployment sizes.
  • Load-test your shutdown path. In staging, kill servers while clients are mid-consume and verify client goroutine counts return to baseline. This is where stuck Next() and drain deadlocks show up.
  • Correlate memory with goroutine count in dashboards. RSS climbing in lockstep with goroutines, without connection growth, is the earliest cheap confirmation.
  • Track server and client versions against upstream leak fixes. Goroutine cleanup bugs are recurring enough that staying current is real prevention.

How Netdata helps

  • Netdata’s NATS collector tracks /varz connection counts, total_connections, mem (RSS), routes, and slow consumers at per-second resolution, giving you the baseline half of the leak equation without manual polling.
  • Pairing it with a goroutine-count series (scraped pprof, or the Go runtime metrics if you have confirmed they reflect the server) lets you chart goroutines against connections on the same timeline, which is the exact divergence that defines this leak.
  • RSS trend views make the 4-8KB-per-goroutine memory cost visible early, well before the OOM kill, and correlate it with uptime so you can tell leak growth from cold-start noise.
  • Connection churn (total_connections delta vs. stable active count) surfaces the flap pattern that turns a small per-connection cleanup bug into a fast leak.
  • JetStream signals such as meta cluster leader changes help you connect Raft instability events to steps in the goroutine growth curve.