Search code examples
influxdb

Influxdb high CPU usage jumping to 80 %?


I am relatively new to time series db world . I am running a Influxdb 1.8.x as a docker container, and I have configured the influxdb.conf file as a default config. Currently I am facing a issue of high CPU usage by influxdb, the CPU jumps to 80 to 90% and creating a problem for other process running on same machine. I have tried a solution given here ->> Influx high CPU issue but unfortunately It did not work? I am unable to understand the reason behind the issue and also struggling to get support in terms of documentation or community help. What I have tried so far:

  1. updated the monitor section of influxdb.conf file like this ->> monitor DB
  2. Checked the series cardinality SHOW SERIES CARDINALITY and it looks well within limits--9400(I am also not sure about the ideal number for high cardinality red flag)

I am looking for an approach, which will help me understand this problem the root cause?

Please let me know if you need any further information on same.


Solution

  • After reading about Influxdb debug and CPU profiling HTTP API influxdb I was able to pin-down the issue, the problem was in the way I was making the query, my query involved more complex functions and also GROUP BAY tag.I also tried query analysis using EXPLAIN ANALYZE (query) command to check how much time a query is taking to execute. I resolved that and noticed a huge Improvement in CPU load. Basically I can suggest the following:

    1. Run the CPU profile analysis using influxdb HTTP API with the command curl -o <file name> http://localhost:8086/debug/pprof/all?cpu=true e and collect result.
    2. Visualize the result using tool like Pprof tool and find the problem
    3. Also one can run basic commands like SHOW SERIES CARDINALITY and EXPLAIN ANALYZE <query> to understand the execution of the query
    4. Before designing any schema and Influx client check the hardware recommendation ->> Hardware sizing guidelines