how to decrease memory consumption
One single node 0.9.6.1 bz1 on production environment, one ssd hard-disk, virtual machine. There is only this InfluxDB service running on this machine, nothing else.
Machine: 8 core, 24G ram. 150G SSD
The memory consumption of influxDB is keep growing:
Mem: 25165824k total, 23833672k used, 1332152k free, 0k buffers
Swap: 1999864k total, 0k used, 1999864k free, 21300008k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
78205 admin 20 0 31.3g 15g 13g S 8.0 64.6 5724:39 influxd
$free -lm
total used free shared buffers cached
Mem: 24576 23068 1507 0 0 20720
Low: 24576 23068 1507
High: 0 0 0
-/+ buffers/cache: 2347 22228
Swap: 1952 0 1952
"lsof " shows that influxdb mapped all the files in the memory:
......(lines omitted)
influxd 78205 500 mem-W REG 8,5 1073741824 33816593 /home/admin/influxdb/0.9.6.1/var/lib/influxdb/data/accessdb/_5w_rp/177
influxd 78205 500 31u REG 8,5 0 33947754 /home/admin/influxdb/0.9.6.1/var/lib/influxdb/wal/accessdb/_5w_rp/177/000146.meta
influxd 78205 500 72uW REG 8,5 1073741824 33816593 /home/admin/influxdb/0.9.6.1/var/lib/influxdb/data/accessdb/_5w_rp/177
......(lines omitted)
even though that file now is only for read, for example, the file "_5w_rp/177" was last modified at
-rw-rw-r-- 1 admin admin 1.0G Jan 15 08:32 ./accessdb/_5w_rp/177
and now is only for read,but is still in the memory.
is there any solutions to descrease the influxDB memory consumption? OOM killer will kill, and the system will break. Running on one VM and I can't execute
cat /proc/sys/vm/drop_caches
0
sudo sh -c “/bin/echo 3 > /proc/sys/vm/drop_caches”
bash: /proc/sys/vm/drop_caches”: No such file or directory
There is no way to reduce the memory consumption currently. What you are seeing is mostly the way MMAP files and page cache consume memory.
Your free output shows 20720mb of cached memory. That means the OS is using free memory to improve file system IO by using the memory for the page cache. If an application requires memory, the OS will release memory used by the page cache for it. It looks like you also have ~2GB of swap space that could be used if you did happen to use all your memory. You can try disabling overcommit and adjust the influxd OOM adjustment score to minimize the chance of the OOM killer selecting the influxd process.
@just2d Also, you'll want to upgrade to v0.10.0 (RC1 is available) to take advantage of the tsm1 storage engine. It's likely you'll see better memory utilization than you do with bz1, in addition to better overall performance.