How to limit heap memory of influxdb

influxdb

#1

Metrics from influxdb ‘/metrics’ indicates that it consums a lot of memory but only half of the memory are in use.

# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used.
# TYPE go_memstats_heap_idle_bytes gauge
go_memstats_heap_idle_bytes 3.461259264e+09

# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use.
# TYPE go_memstats_heap_inuse_bytes gauge
go_memstats_heap_inuse_bytes 3.784728576e+09

# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system.
# TYPE go_memstats_heap_sys_bytes gauge
go_memstats_heap_sys_bytes 7.24598784e+09
`
For almost all memory were comsumed by influxdb, kernel OOM Kill happens a lot. So how to configure influxdb that make it using less memory than now ?

Here is the configuretion:

reporting-disabled = true
bind-address = “127.0.0.1:8088”
[meta]
dir = “/data/application/influxdb/meta”
logging-enabled = true
[data]
dir = “/data/application/influxdb/data”
wal-dir = “/dev/shm/influxdb/wal”
wal-fsync-delay = “100ms”
index-version = “tsi1”
trace-logging-enabled = true
query-log-enabled = true
cache-max-memory-size = “2g”
cache-snapshot-memory-size = “15m”
cache-snapshot-write-cold-duration = “5m”
compact-throughput = “80m”
max-index-log-file-size = “40m”
[coordinator]
[retention]
[shard-precreation]
[monitor]
[http]
enabled = true
bind-address = “:8086”
log-enabled = true
access-log-path = “/data/log/influxdb/influx_error.log”
write-tracing = true
[logging]
level = “error”
suppress-logo = true
[subscriber]
[[graphite]]
[[collectd]]
[[opentsdb]]
[[udp]]
[continuous_queries]
log-enabled = false
[tls]


#2

Is there any reply ?