# InfluxDB memory usages high

**URL:** https://community.influxdata.com/t/influxdb-memory-usages-high/12465
**Category:** Systems
**Created:** [December 31, 2019, 9:56am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465 "2019-12-31T09:56:08Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![rguptarg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/rguptarg/32/4265_2.png) [@rguptarg](https://community.influxdata.com/u/rguptarg)
#### Post date: [December 31, 2019, 9:56am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/1 "2019-12-31T09:56:08Z")

</div>

HI Team,

I have influxdb-1.7.8-1.x86\_64 , and running on “Red Hat Enterprise Linux Server release 7.5 (Maipo)” .

Last few days we have notices Memory usage is suddenly high, these are hardware parameters :-

```auto
          total used free shared buff/cache available

```

Mem: 94G 93G 439M 120M 661M 384M  
Swap: 19G 3.6G 16G

Total cpu allocated :- 8

please suggest how we can control this issue.

---

<div class="post-metadata">

### Author: ![Mert](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/mert/32/5152_2.png) [@Mert](https://community.influxdata.com/u/Mert)
#### Post date: [January 1, 2020, 3:47pm UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/2 "2020-01-01T15:47:03Z")

</div>

What did you change in last few days? Check if there is a Continuous Query running?

---

<div class="post-metadata">

### Author: ![rguptarg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/rguptarg/32/4265_2.png) [@rguptarg](https://community.influxdata.com/u/rguptarg)
#### Post date: [January 2, 2020, 6:39am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/3 "2020-01-02T06:39:04Z")

</div>

I am facing this issue long back, even I have raised a request on GIthub.

Currently 900+ Telegraf agents are reporting to InfluxDB.

I have checked “SHOW QUERIES” but no result

is there any other option to check long running query?

---

<div class="post-metadata">

### Author: ![Giovanni\_Luisotto](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/giovanni_luisotto/32/4017_2.png) [@Giovanni\_Luisotto](https://community.influxdata.com/u/Giovanni_Luisotto)
#### Post date: [January 2, 2020, 8:06am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/4 "2020-01-02T08:06:16Z")

</div>

You can try the [Telegraf Influxdb Input](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/influxdb), it may give you more information about what’s happening in the db instance

---

<div class="post-metadata">

### Author: ![rguptarg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/rguptarg/32/4265_2.png) [@rguptarg](https://community.influxdata.com/u/rguptarg)
#### Post date: [January 3, 2020, 6:15am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/5 "2020-01-03T06:15:34Z")

</div>

![119](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/8/88f07ff53d9a6a63411138deaddf03aeeda28c1b.jpeg) ![influx2](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/8/896c75596e10c6123c5e4662241eacdeda97d68a.jpeg) ![influx1](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/b/b5f71d58e68666a37bae9c93eb2b396aada1f914.jpeg)

HI, as suggested I have enable influx plugin in telegraf,  
it’s look like normal utilization, but still we are facing high memory utilization on server , hence server will gone in hang-state.

please suggest, let me know if any other details required

---

<div class="post-metadata">

### Author: ![Giovanni\_Luisotto](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/giovanni_luisotto/32/4017_2.png) [@Giovanni\_Luisotto](https://community.influxdata.com/u/Giovanni_Luisotto)
#### Post date: [January 3, 2020, 8:03am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/6 "2020-01-03T08:03:01Z")

</div>

You should try to understand what’s happening when the memory has 100% spikes (and I can’t help with that). is a continuous query running?  
(btw 13min of avg query duration looks a lot to me)

---

<div class="post-metadata">

### Author: ![Mert](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/mert/32/5152_2.png) [@Mert](https://community.influxdata.com/u/Mert)
#### Post date: [January 3, 2020, 8:44am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/7 "2020-01-03T08:44:41Z")

</div>

Try in influx console:

```
SHOW CONTINUOUS QUERIES

```

13min for avg is query is very high. Are these write queries or read? You can visualize it too. You should figure it out which query/queries took long and why. Probably, those long queries are causing high memory usage.

---

<div class="post-metadata">

### Author: ![rguptarg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/rguptarg/32/4265_2.png) [@rguptarg](https://community.influxdata.com/u/rguptarg)
#### Post date: [January 3, 2020, 9:50am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/8 "2020-01-03T09:50:01Z")

</div>

Thanks for reply!!!

I am also trying to find out long running query on influx. whenever I have run these 2 query, it’s gives no record.  
“SHOW QUERIES" and “SHOW CONTINUOUS QUERIES”

Is there any way to find query history or all executed query on influx

---

<div class="post-metadata">

### Author: ![Giovanni\_Luisotto](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/giovanni_luisotto/32/4017_2.png) [@Giovanni\_Luisotto](https://community.influxdata.com/u/Giovanni_Luisotto)
#### Post date: [January 3, 2020, 10:01am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/9 "2020-01-03T10:01:08Z")

</div>

Have a look at the data related to the “Average Query Duration” that you see in Grafana, I think the measurement contains more than that, not sure with what detail though, if you are lucky it might contain the query text.

If you have no continuous query then somewhere in a report you have a huge query that might need some work. Query performance is also influenced by the retention policy settings (shard duration), but first you need to find what is causing the issue

can you provide the structure of the measurement about queries?

---

<div class="post-metadata">

### Author: ![rguptarg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/rguptarg/32/4265_2.png) [@rguptarg](https://community.influxdata.com/u/rguptarg)
#### Post date: [January 3, 2020, 10:56am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/10 "2020-01-03T10:56:18Z")

</div>

> [@Giovanni\_Luisotto](#):
>
> structure of the measurement about queries

> SHOW MEASUREMENTS on telegraf  
> name: measurements  
> name

* * *

cpu  
cpu\_util  
disk  
diskio  
kernel  
mem  
mem\_util  
msr\_atl\_c360\_agg\_info\_log  
msr\_error\_code\_info  
net  
net\_response  
oracle\_session\_longrunning  
procCheck  
processes  
redis  
redis\_keyspace  
swap  
swap\_util  
system  
win\_cpu  
win\_disk  
win\_diskio  
win\_mem  
win\_net  
win\_services  
win\_swap  
win\_system

> SHOW MEASUREMENTS on chronograf  
> name: measurements  
> name

* * *

alerts

> SHOW MEASUREMENTS on \_internal  
> name: measurements  
> name

* * *

cq  
database  
httpd  
queryExecutor  
runtime  
shard  
subscriber  
tsm1\_cache  
tsm1\_engine  
tsm1\_filestore  
tsm1\_wal  
write

---

<div class="post-metadata">

### Author: ![Giovanni\_Luisotto](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/giovanni_luisotto/32/4017_2.png) [@Giovanni\_Luisotto](https://community.influxdata.com/u/Giovanni_Luisotto)
#### Post date: [January 3, 2020, 11:22am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/11 "2020-01-03T11:22:15Z")

</div>

I meant which tags and fields are available in the measurement about queries (it should be the “queryExecutor” measurement), but you will see which one is used in the Grafana query…

This is what I have in the Internal db

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/b/bc9aaf24b5624804096fdbeb6bee03c14c3c0dee.png)

Sadly, since no tags are available to further restrict your research for the guilty query, you will probably need to open some reports (or run whatever usually runs on influx), probably the most used (since the problem occurs often) and see which one requires like 13 minutes to load, from there analyze the queries.  
maybe someone is querying a huge time range or there might be some heavy calculation…

let us know if you find something

---

<div class="post-metadata">

### Author: ![rguptarg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/rguptarg/32/4265_2.png) [@rguptarg](https://community.influxdata.com/u/rguptarg)
#### Post date: [January 3, 2020, 11:52am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/12 "2020-01-03T11:52:31Z")

</div>

Thanks for reply !!!

that 13 was showing last 24 hrs avrg.

can you please help me to know find out all executed query in influxDB.

means is there any way to get executed query history.

---

<div class="post-metadata">

### Author: ![Giovanni\_Luisotto](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/giovanni_luisotto/32/4017_2.png) [@Giovanni\_Luisotto](https://community.influxdata.com/u/Giovanni_Luisotto)
#### Post date: [January 3, 2020, 1:12pm UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/13 "2020-01-03T13:12:16Z")

</div>

3 options:

1. Run [SHOW QUERIES](https://docs.influxdata.com/influxdb/v1.7/troubleshooting/query_management/#list-currently-running-queries-with-show-queries) while the cpu is at 100%, it will return all the query in execution
2. Check the [Http request log](https://docs.influxdata.com/influxdb/v1.7/administration/logs/#http-access-logging), it tracks the requests and you can get the “query history” from its data. If not already configured have a look at the [docs](https://docs.influxdata.com/influxdb/v1.7/administration/config/#http-endpoints-settings) or at the section “2- Define Logging Settings” of [this blog post](https://thesqldump.code.blog/2019/11/13/install-configure-and-run-influxdb-on-windows/) (the blog itself)
3. Manually do what users or system do daily and check the response time and memory consumption

The best one probably is option 2.

Another useful setting in this case is " [`log-queries-after`](https://docs.influxdata.com/influxdb/v1.7/administration/config/#log-queries-after-0s)"

---

<div class="post-metadata">

### Author: ![rguptarg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/rguptarg/32/4265_2.png) [@rguptarg](https://community.influxdata.com/u/rguptarg)
#### Post date: [January 17, 2020, 5:35am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/14 "2020-01-17T05:35:58Z")

</div>

Thanks for reply,

I have observed few days InfluxDB logs and below are the analysis :-

- As 900+ telegraf agents reporting to InfluxDB, so many POST request.
- I can see GET request from Grafana server and few scheduled query, these all are SELECT query, so is it possible they will impact InfluxDB performance ?

• 38669 out of 58058 GET request from A server on 14 Jan 2020.  
• 26004 out of 40489 GET request from A server on 13 Jan 2020.

- 

```
  52185 out of 92094 GET request from A server on 15 Jan 2020.

```

- 

```
  63644 out of 96290 GET request from A server on 16 Jan 2020.

```

Queries like :-  
Jan 17 10:50:08 N2VL-PD-FLU01 influxd: [httpd] 10.5.98.200 - - [17/Jan/2020:10:50:08 +0530] “GET /query?db=telegraf&epoch=s&q=SELECT+mean%28%22used\_percent%22%29+from+%22telegraf%22.%22autogen%22.%22mem%22+WHERE+%28%22time%22+%3E%3D+%272020-01-10T05%3A14%3A00.000000000Z%27+and+%22time%22+%3C%3D+%272020-01-10T05%3A18%3A59.599999999Z%27+AND+%22IP%22+%3D+%2710.56.4.52%27%29+GROUP+BY+%22IP%22 HTTP/1.1” 200 151 “-” “python-requests/2.21.0” 06ce1767-38e9-11ea-a512-005056b67104 148463  
Jan 17 10:50:08 N2VL-PD-FLU01 influxd: [httpd] 10.5.98.200 - - [17/Jan/2020:10:50:08 +0530] “GET /query?db=telegraf&epoch=s&q=SELECT+%28100-mean%28%22usage\_idle%22%29%29+from+%22telegraf%22.%22autogen%22.%22cpu%22+WHERE+%28%22time%22+%3E%3D+%272020-01-11T05%3A14%3A00.000000000Z%27+and+%22time%22+%3C%3D+%272020-01-11T05%3A18%3A59.599999999Z%27+AND+%22IP%22+%3D+%2710.135.0.235%27%29+GROUP+BY+%22IP%22 HTTP/1.1” 200 153 “-” “python-requests/2.21.0” 06cd8de1-38e9-11ea-a510-005056b67104 152424  
Jan 17 10:50:08 N2VL-PD-FLU01 influxd: [httpd] 10.5.98.200 - - [17/Jan/2020:10:50:08 +0530] “GET /query?db=telegraf&epoch=s&q=SELECT+%28100-mean%28%22usage\_idle%22%29%29+from+%22telegraf%22.%22autogen%22.%22cpu%22+WHERE+%28%22time%22+%3E%3D+%272020-01-11T05%3A14%3A00.000000000Z%27+and+%22time%22+%3C%3D+%272020-01-11T05%3A18%3A59.599999999Z%27+AND+%22IP%22+%3D+%2710.92.204.57%27%29+GROUP+BY+%22IP%22 HTTP/1.1” 200 151 “-” “python-requests/2.21.0” 06e28664-38e9-11ea-a521-005056b67104 25637

So can you please confirm, GET query impact the server performance or increase the load on influxDB ?

---

<div class="post-metadata">

### Author: ![Giovanni\_Luisotto](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/giovanni_luisotto/32/4017_2.png) [@Giovanni\_Luisotto](https://community.influxdata.com/u/Giovanni_Luisotto)
#### Post date: [January 17, 2020, 9:33am UTC](https://community.influxdata.com/t/influxdb-memory-usages-high/12465/15 "2020-01-17T09:33:55Z")

</div>

those 3 queries are simple and I doubt that this is the cause of the problem.  
I can imagine those query are made by a grafana chart, all the query have the following pattern:

```auto
SELECT mean("used_percent") from "telegraf"."autogen"."mem" WHERE ("time" >= ''2020-01-10T05:14:00.000000000Z'' and "time" <= ''2020-01-10T05:18:59.599999999Z'' AND "IP" = '10.56.4.52') GROUP BY "IP"

```

You can run it yourself and check the response time but I doubt this is the problem
