Influx memory usage

Hi, I’ve noticed high memory usage for influxd process.

We have a database storing about 38000 series, data resolution is 1h, data range is last 3 years.
influxd process is using minimum 13G of memory all the time, and when I’m trying to copy data memory usage peak is sometimes more than 30G.

I need to copy one influx database into another (the reason is that when I want to regenerate production database then I’m regenerating database on a temporary influx database to avoid downtime and also because this is failsafe. Then when the temporary database is generated I just want to copy or rename it into production).

This proved very hard for Influx database, please see this: Should be able to backup/restore single database · Issue #7758 · influxdata/influxdb · GitHub

I came with a solution:
https://github.com/cncf/devstats/blob/master/cmd/idb_backup/idb_backup.go

This is a custom program to copy all series from one database into another. I’m quite sure that I’m doing all things right. All connections are closed, resources freed etc. program itself consumes maximum 400M of memory, but influxd process can go as high as 31G !!

How can I control influxd memory usage? What can I do?

What other details can I provide to help?
lukaszgryglicki@o2.pl

Same problem, v1.3.6 aJust rebooted, no queries, no writes, and memory usage went through the room VIRT=20.7G, RES, 9.69G, SHR 3.9G for influx