# Netdata consuming high ram amount

**URL:** <https://community.netdata.cloud/t/netdata-consuming-high-ram-amount/1005>\
**Category:** Help\
**Tags:** agent\
**Created:** [March 1, 2021, 4:43am UTC](https://community.netdata.cloud/t/netdata-consuming-high-ram-amount/1005 "2021-03-01T04:43:26Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![haydenseitz](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/haydenseitz/32/234_2.png) [@haydenseitz](https://community.netdata.cloud/u/haydenseitz)\
**Post date:** [April 8, 2021, 10:58pm UTC](https://community.netdata.cloud/t/netdata-consuming-high-ram-amount/1005/22 "2021-04-08T22:58:07Z")

</div>

Good news! I think ebpf is the plugin causing the memory issues.

I went through the docs and disabled each of these plugins one at a time:

```auto
[plugins]
#proc = no
#diskspace = no
#cgroups = no
#tc = no
#idlejitter = no
#fping = no
#ioping = no
#node.d = no
#python.d = no
#go.d = no
#apps = no
#perf = no
#charts.d = no
ebpf = no

```

Each time the memory would jump back up, but I noticed that the memory usage was flapping between too high and normal, shown below. I saw in htop that it was the ebpf plugin that was starting and stopping at the same time the memory usage was jumping. After disabling that, it has stayed at a normal level.

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/netdata2/original/1X/21184f589a6cc40c0c8ce81abf68722698bf1d02.png)

---

<div class="post-metadata">

**Author:** ![ilyam8](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/ilyam8/32/134_2.png) [@ilyam8](https://community.netdata.cloud/u/ilyam8)\
**Post date:** [April 9, 2021, 7:53am UTC](https://community.netdata.cloud/t/netdata-consuming-high-ram-amount/1005/23 "2021-04-09T07:53:41Z")

</div>

Yeah, `ebpf` was my suspect after checking your snapshot, i noticed that from time to time its cpu usage spikes to 95% (Applications). At the same time i saw a lot of do\_fork calls (other dimensions) on the _process (eBPF)_ chart.

---

<div class="post-metadata">

**Author:** ![ilyam8](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/ilyam8/32/134_2.png) [@ilyam8](https://community.netdata.cloud/u/ilyam8)\
**Post date:** [April 9, 2021, 12:09pm UTC](https://community.netdata.cloud/t/netdata-consuming-high-ram-amount/1005/24 "2021-04-09T12:09:33Z")

</div>

We did some tests and discovered several problems with `ebpf.plugin`.

It contributes a lot to the kernel memory usage, indeed. That is why we see nothing in the `ps` output, it is not memory used by the processes.

The issue in the netdata repo: [high kernel memory usage when using ebpf plugin · Issue #10949 · netdata/netdata · GitHub](https://github.com/netdata/netdata/issues/10949)

@haydenseitz `ebpf.plugin` crashes on your server, those are the periods when memory usage drops.

Do you have `cachestat` collector enabled in the `ebpf.d.conf`?

We could make `ebpf.plugin` crashing under the following conditions:

- `cachestat` collector enabled (`ebpf.d.conf`)
- spawn processes every seconds (`while true; do sleep 1; for i in $(seq 1 200); do sleep 1 & done; done`)

---

<div class="post-metadata">

**Author:** ![OdysLam](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/odyslam/32/98_2.png) [@OdysLam](https://community.netdata.cloud/u/OdysLam)\
**Post date:** [April 9, 2021, 2:38pm UTC](https://community.netdata.cloud/t/netdata-consuming-high-ram-amount/1005/25 "2021-04-09T14:38:39Z")

</div>

Thanks a lot @haydenseitz for your effort in identifying this. Without your analysis, it would take considerably more time for us to root-cause this.

Very nice job! ❤

---

<div class="post-metadata">

**Author:** ![haydenseitz](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/haydenseitz/32/234_2.png) [@haydenseitz](https://community.netdata.cloud/u/haydenseitz)\
**Post date:** [April 14, 2021, 3:31pm UTC](https://community.netdata.cloud/t/netdata-consuming-high-ram-amount/1005/26 "2021-04-14T15:31:25Z")

</div>

I’ve not changed any settings related to `ebpf`(aside from disabling on most systems), so I would assume `cachestat` was at it’s default state

---

<div class="post-metadata">

**Author:** ![ilyam8](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/ilyam8/32/134_2.png) [@ilyam8](https://community.netdata.cloud/u/ilyam8)\
**Post date:** [April 15, 2021, 6:55pm UTC](https://community.netdata.cloud/t/netdata-consuming-high-ram-amount/1005/27 "2021-04-15T18:55:00Z")

</div>

- we added `Percpu` dimension to the `mem.kernel` chart (Memory-\>kernel-\>Memory Used by Kernel). `ebpf.plugin` needs this memory to create hashtables [[PR](https://github.com/netdata/netdata/pull/10964)]

> Memory allocated to the percpu allocator used to back percpu allocations. This stat excludes the cost of metadata

- and we significantly decreased the amount of used `Percpu` memory by default (103=\>29.8 MB on my server) [[PR](https://github.com/netdata/netdata/pull/10962)]

I consider this case of _Netdata consuming high ram_ fixed.

❗ Keep in mind that those changes are not in the latest stable (v1.30.1), but in the master branch.

---

<div class="post-metadata">

**Author:** ![ilyam8](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/ilyam8/32/134_2.png) [@ilyam8](https://community.netdata.cloud/u/ilyam8)\
**Post date:** [April 15, 2021, 6:56pm UTC](https://community.netdata.cloud/t/netdata-consuming-high-ram-amount/1005/28 "2021-04-15T18:56:35Z")

</div>

@Lcarrillo @haydenseitz thanks for highlighting the problem and helping us to resolve it.

@Thiago_Marques_0 thanks for the fix 😉

---

<div class="post-metadata">

**Author:** ![Ahmed\_Kamel](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/ahmed_kamel/32/1445_2.png) [@Ahmed\_Kamel](https://community.netdata.cloud/u/Ahmed_Kamel)\
**Post date:** [January 9, 2022, 5:57am UTC](https://community.netdata.cloud/t/netdata-consuming-high-ram-amount/1005/29 "2022-01-09T05:57:17Z")

</div>

I think it’s still leaking memory, look at this picture out from `ps_mem` command

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/netdata2/original/2X/f/fcb25fc1847a47d4c60f71151df84bcf537492de.png)

---

<div class="post-metadata">

**Author:** ![ilyam8](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.netdata.cloud/ilyam8/32/134_2.png) [@ilyam8](https://community.netdata.cloud/u/ilyam8)\
**Post date:** [January 11, 2022, 11:51am UTC](https://community.netdata.cloud/t/netdata-consuming-high-ram-amount/1005/30 "2022-01-11T11:51:34Z")

</div>

@Ahmed_Kamel, hey. If you can give us more details (Netdata Agent version, your setup (parent/child/standalone), install method, etc.) it’d be helpful. If you think there is a bug consider [creating a bug report](https://github.com/netdata/netdata/issues/new?assignees=&labels=bug%2Cneeds+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+) in the netdata/netdata repo.

---

<div class="post-metadata">

**Author:** ![coldspringhead](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@coldspringhead](https://community.netdata.cloud/u/coldspringhead)\
**Post date:** [February 6, 2022, 6:41pm UTC](https://community.netdata.cloud/t/netdata-consuming-high-ram-amount/1005/31 "2022-02-06T18:41:00Z")

</div>

```auto
I believe the same thing is happening to me on two different systems. netdata Memory usage seems rather high:
---------------------------------------------------------------------------------------------
Install method:
wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh
---------------------------------------------------------------------------------------------
[plugins]
	# PATH environment variable = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
	# PYTHONPATH environment variable = 
	# checks = no
	# idlejitter = yes
	# timex = yes
	# tc = yes
	# diskspace = yes
	# proc = yes
	# cgroups = yes
	# enable running new plugins = yes
	# check for new plugins every = 60
	# slabinfo = no
	# python.d = yes
	# node.d = yes
	# nfacct = yes
	# perf = yes
	# charts.d = yes
	# fping = yes
	# go.d = yes
	# ioping = yes
	# apps = yes
	# ebpf = yes
---------------------------------------------------------------------------------------------
Ubuntu 20.04.3 LTS \n \l
---------------------------------------------------------------------------------------------
root@foo:~# netdata -v
netdata v1.33.0-21-g4ec90eea7
---------------------------------------------------------------------------------------------
root@foo:~# ps -eo pmem,pcpu,vsize,pid,cmd | sort -k 1 -nr | head -30
11.3 0.5 2858976 251405 /usr/sbin/mysqld
 1.6 1.9 341332 437313 /usr/sbin/netdata -D
 1.5 0.0 1457644 1068 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
 1.3 0.0 1242580 715 /usr/lib/snapd/snapd

```

[Previous page](https://community.netdata.cloud/t/netdata-consuming-high-ram-amount/1005.md?page=1)
