influxdb icon indicating copy to clipboard operation
influxdb copied to clipboard

Select does not get recent data

Open yogeswaran opened this issue 11 years ago • 49 comments

We are running influxdb version 0.9.0-rc28, when there is not much load 'select' works fine but when we ingest ~5000 data points per second, 'select' query returns old data points and not the recent ones.

Here is an example of a data point that is being ingested, following metric is ingested every 30 seconds:

   {"database":"collectd",
    "retentionPolicy":"collectdPolicy",
    "points":[{
       "name":"aggregation.cpu",
       "timestamp":1430321509,
       "precision":"s",
       "fields":{"value":6597},
       "tags":{
          "host":"MyHost1",
          "plugin_instance":"cpu-average",
          "type_instance":"idle"
          }
     }]
    }

Note: epoch 1430321509 is Apr 29 15:31:49 UTC 2015, so expectation is that select returns all data points until 15:31:49

Here is the output from select query (SELECT value FROM "aggregation.cpu" WHERE host='MyHost1' AND plugin_instance='cpu-average' AND type_instance='idle')

   "results": [
        {
            "series": [
                {
                    "name": "aggregation.cpu",
                    "columns": [
                        "time",
                        "value"
                    ],
                    "values": [
                        [
                            "2015-04-29T13:00:34Z",
                            29215
                        ],

 .... 
 ....
 ....
                        [
                            "2015-04-29T15:18:18Z",
                            17588
                        ]
                    ]
                }
            ]
        }
    ]
}

Though data points are ingested every 30 seconds, select query returns data points only up to 15:18:18 and not getting any values from 15:18:18 to 15:31:49

yogeswaran avatar Apr 29 '15 15:04 yogeswaran

I thnik we're hitting same issue, I've described it on groups: https://groups.google.com/forum/#!topic/influxdb/OiFY6D3_d6I

quhar avatar Apr 30 '15 11:04 quhar

Here is the output from "SHOW STATS"

> show stats
name: server
------------
broadcastMessageRx      batchWriteRx    writeSeriesMessageTx    queriesRx       queriesExecuted shardsCreated   batchWriteRxError       shardsOpen      pointWriteRx    broadcastMessageTx
335                     3462280         3461354                 1049            1048            1               927                     1               411234743       334

name: shard 1
-------------
open    writeSeriesMessageRx    shardBytes      shardWrite
1       400869                  810545108       47679124

name: shard 2
-------------
initialize      open    writeSeriesMessageRx    shardBytes      shardWrite
1               1       387402                  781334229       45960837

server's writeSeriesMessageTx : 3461354

shard-1's writeSeriesMessageRx : 400869
shard-2's writeSeriesMessageRx : 387402

Total (shard 1 + 2) writeSeriesMessageRx is 788271

Pending messages to be written (writeSeriesMessageTx - Total writeSeriesMessageRx ) = 3461354 - 788271 = 2673083

Does this mean 2673083 pending messages to be written to disk? If this is correct, does this explain why select query is not giving recent data?

yogeswaran avatar Apr 30 '15 18:04 yogeswaran

@yogeswaran -- is this a single node? If so, those stats do indicate that 2673083 messages in the queue of the broker component of the node, waiting to be drained by the data component of the node. Does the number continually increase?

otoolep avatar Apr 30 '15 18:04 otoolep

yes it is a single node. I stopped ingesting data 2 hours back and this number goes down very slowly.

Any reason why messages are drained very slow? Is there any settings that I am missing?

yogeswaran avatar Apr 30 '15 18:04 yogeswaran

No settings control this, it looks like an issue with the system. Is there anything in the logs? If you restart the node, does data start moving again?

otoolep avatar Apr 30 '15 18:04 otoolep

I restarted influxdb service, looks like all the stats got reset and the writeSeriesMessageRx for both the shards are going up very slowly and writeSeriesMessageTx is not displayed probably because I am not ingesting any data now.

> show stats
name: server
------------
shardsOpen      broadcastMessageRx      queriesRx       queriesExecuted
2               4                       9               8


name: shard 1
-------------
open    writeSeriesMessageRx    shardBytes      shardWrite
1       1036                    2088229         122837


name: shard 2
-------------
open    writeSeriesMessageRx    shardBytes      shardWrite
1       1044                    2116364         124492

How do I troubleshoot this issue?

yogeswaran avatar Apr 30 '15 18:04 yogeswaran

Thanks @yogeswaran, we will need to dig into this here.

otoolep avatar Apr 30 '15 18:04 otoolep

Seeing this as well. Are there any logs I can share as well? Here is my show stats...

> show stats
name: server
------------
pointWriteRx    writeSeriesMessageTx    queriesRx   queriesExecuted broadcastMessageTx  shardsOpen  broadcastMessageRx  batchWriteRx
489572141   4863692         13      12      201         2       202         4971468
name: shard 1
-------------
open    writeSeriesMessageRx    shardBytes  shardWrite
1   249015          639512886   37631429
name: shard 2
-------------
open    writeSeriesMessageRx    shardBytes  shardWrite
1   1655089         28136513    1655089

original-el8 avatar May 01 '15 13:05 original-el8

I have some system stats which may help finding cause of this behavior. Data started to be inserted just around 03:30. Every 5 min there are 1.2M points written, grouped in 1.8k batches. Each batch has various interface stats from one network device. For around 10 hours everything was working fine. But from 13:50 selects are returning recent data. At 15:40 last returned timestamp is 14:04. Please see attached graphs of IOs, disk utilization and throughput. Positive values are write, negative read. Times are in UTC+2

> show diagnostics
name: server_go
tags: serverID=1
time                            goMaxProcs      numGoRoutine    version
----                            ----------      ------------    -------
2015-05-02T13:39:35.092091177Z  8               55              go1.4.2


name: server_system
tags: serverID=1
time                            hostname        pid     os      arch    numCPU
----                            --------        ---     --      ----    ------
2015-05-02T13:39:35.092097496Z  at-vie01a-osd03 22596   linux   amd64   8


name: server_memory
tags: serverID=1
time                            alloc           totalAlloc      sys             lookups mallocs         frees           heapAlloc       heapSys         heapIdle        heapInUse       heapReleased    heapObjects     pauseTotalNs      numGG
----                            -----           ----------      ---             ------- -------         -----           ---------       -------         --------        ---------       ------------    -----------     ------------      -----
2015-05-02T13:39:35.092101522Z  1502239568      6820074890384   2381192968      5233360 37491366474     37481821373     1502239568      2202107904      518578176       1683529728      0               9545101         3790929005245     9170


name: server_build
tags: serverID=1
time                            version         commitHash
----                            -------         ----------
2015-05-02T13:39:35.092126549Z  0.9.0-rc28      f50b2a0a982d0c64aec2d43cb30b98d141cdcea2


name: server_diag
tags: serverID=1
time                            startTime                               uptime                  id      path                    authEnabled     index   retentionAutoCreate     numShards       cqLastRun
----                            ---------                               ------                  --      ----                    -----------     -----   -------------------     ---------       ---------
2015-05-02T13:39:35.085579662Z  2015-05-01 11:32:00.495982608 +0000 UTC 26h7m34.596039052s      1       /srv/influxdb/db        false           623743  true                    2               0001-01-01 00:00:00 +0000 UTC


name: shardGroups_diag
tags: serverID=1
time                            database        retentionPolicy id      startTime                       endTime                         duration        numShards
----                            --------        --------------- --      ---------                       -------                         --------        ---------
2015-05-02T13:39:35.085579662Z  observer        daily           1       2015-05-01 00:00:00 +0000 UTC   2015-05-02 00:00:00 +0000 UTC   24h0m0s         1
2015-05-02T13:39:35.085579662Z  observer        daily           2       2015-05-02 00:00:00 +0000 UTC   2015-05-03 00:00:00 +0000 UTC   24h0m0s         1


name: shards_diag
tags: serverID=1
time                            id      dataNodes       index   path
----                            --      ---------       -----   ----
2015-05-02T13:39:35.085579662Z  1       1               213019  /srv/influxdb/db/shards/1
2015-05-02T13:39:35.085579662Z  2       1               596166  /srv/influxdb/db/shards/2

> show stats
name: server
------------
queriesRx       queriesExecuted batchWriteRx    pointWriteRx    shardsCreated   writeSeriesMessageTx    broadcastMessageTx      broadcastMessageRx
549             548             397161          260493127       2               397161                  1812                    1812


name: shard 1
-------------
initialize      open    writeSeriesMessageRx    shardBytes      shardWrite
1               1       141436                  1652372364      92391774


name: shard 2
-------------
initialize      open    writeSeriesMessageRx    shardBytes      shardWrite
1               1       226613                  2667719808      149158656

IOS ios Utilization util Throughput throughput

quhar avatar May 02 '15 13:05 quhar

any thoughts on this from the developers?

original-el8 avatar May 06 '15 20:05 original-el8

No updates yet but we haven't forgotten about this.

beckettsean avatar May 06 '15 21:05 beckettsean

Thanks Sean.

original-el8 avatar May 07 '15 13:05 original-el8

@yogeswaran have you tried to reproduce this on rc29 yet?

toddboom avatar May 08 '15 22:05 toddboom

Tried it on rc29, I still see this issue.

We cannot proceed our testing without this issue fixed, can this issue be prioritized please?

yogeswaran avatar May 11 '15 14:05 yogeswaran

I'm still seeing it too. Wiped the databases and started from scratch with rc29.

original-el8 avatar May 11 '15 16:05 original-el8

This issue has been prioritized and we're looking into it now. Please note that the next release (RC30) will have some new diagnostics available to help debug this.The diagnostic information will be available at the endpoint messaging/diagnostics.

E.g.:

$ curl -v localhost:8086/messaging/diagnostics
{"isLeader":true,"clusterID":7033784242934498664,"path":"influxdb/broker","index":6,"topics":{"influxdb/broker/0":{"id":0,"path":"influxdb/broker/0","open":true,"truncated":false,"index":3,"indexByURL":{"http://localhost:8086":0},"maxSegmentSize":10485760}},"maxTopicSize":52428800}

Reports from the field should include this information if possible.

otoolep avatar May 11 '15 19:05 otoolep

What I would be particularly interested in when this happens, are the indexes for each indexByURL changing? Or are they remaining at the same value?

otoolep avatar May 11 '15 21:05 otoolep

{
    "isLeader": true,
    "clusterID": 7033784242934498000,
    "path": "influxdb/broker",
    "index": 6,  #<- where the broker is writing to right now.
    "topics": {
        "influxdb/broker/0": {
            "id": 0,
            "path": "influxdb/broker/0",
            "open": true,
            "truncated": false,
            "index": 3,
            "indexByURL": {
                "http://localhost:8086": 0 # <- where the data node is reading from.
            },
            "maxSegmentSize": 10485760
        }
    },
    "maxTopicSize": 52428800
}

otoolep avatar May 11 '15 21:05 otoolep

@yogeswaran @jmcook we just released rc30 today. could you try reproducing this and send us the output of the curl -v localhost:8086/messaging/diagnostics command that @otoolep mentioned above?

toddboom avatar May 13 '15 03:05 toddboom

I wiped out rc29, installed rc30 and started my test from scratch.

First load was less and select worked fine. I ran diagnostics twice:

{"isLeader":true,"clusterID":2529535395155578698,"path":"/var/opt/influxdb/raft","index":12845,"topics":{"/var/opt/influxdb/raft/0":{"id":0,"path":"/var/opt/influxdb/raft/0","open":true,"truncated":false,"index":9397,"indexByURL":{"http://influxdbdev1:28588":9397},"maxSegmentSize":10485760},"/var/opt/influxdb/raft/1":{"id":1,"path":"/var/opt/influxdb/raft/1","open":true,"truncated":false,"index":12817,"indexByURL":{"http://influxdbdev1:28588":12817},"maxSegmentSize":10485760}},"maxTopicSize":52428800}

{"isLeader":true,"clusterID":2529535395155578698,"path":"/var/opt/influxdb/raft","index":13181,"topics":{"/var/opt/influxdb/raft/0":{"id":0,"path":"/var/opt/influxdb/raft/0","open":true,"truncated":false,"index":9397,"indexByURL":{"http://influxdbdev1:28588":9397},"maxSegmentSize":10485760},"/var/opt/influxdb/raft/1":{"id":1,"path":"/var/opt/influxdb/raft/1","open":true,"truncated":false,"index":13145,"indexByURL":{"http://influxdbdev1:28588":13145},"maxSegmentSize":10485760}},"maxTopicSize":52428800}

I added more load, reproduced the problem and ran diagnostics twice:



{"isLeader":true,"clusterID":2529535395155578698,"path":"/var/opt/influxdb/raft","index":35953,"topics":{"/var/opt/influxdb/raft/0":{"id":0,"path":"/var/opt/influxdb/raft/0","open":true,"truncated":false,"index":34346,"indexByURL":{"http://influxdbdev1:28588":34346},"maxSegmentSize":10485760},"/var/opt/influxdb/raft/1":{"id":1,"path":"/var/opt/influxdb/raft/1","open":true,"truncated":false,"index":35953,"indexByURL":{"http://influxdbdev1:28588":28318},"maxSegmentSize":10485760}},"maxTopicSize":52428800}

{"isLeader":true,"clusterID":2529535395155578698,"path":"/var/opt/influxdb/raft","index":43259,"topics":{"/var/opt/influxdb/raft/0":{"id":0,"path":"/var/opt/influxdb/raft/0","open":true,"truncated":false,"index":43137,"indexByURL":{"http://influxdbdev1:28588":43137},"maxSegmentSize":10485760},"/var/opt/influxdb/raft/1":{"id":1,"path":"/var/opt/influxdb/raft/1","open":true,"truncated":false,"index":43259,"indexByURL":{"http://influxdbdev1:28588":32862},"maxSegmentSize":10485760}},"maxTopicSize":52428800}

yogeswaran avatar May 13 '15 13:05 yogeswaran