[0.9.4-0.9.5-rc3] Influx service becomes unavailable, "failed to store statistics: timeout"
After loading data of few megs, influx service becomes unavailable. Logs :
[monitor] 2015/09/16 06:05:49 failed to store statistics: timeout
[wal] 2015/09/16 06:05:58 Flushing 5 measurements and 41 series to index
[wal] 2015/09/16 06:05:58 Metadata flush took 2.830629ms
[wal] 2015/09/16 06:05:58 Flushing 36 measurements and 108 series to index
[wal] 2015/09/16 06:05:58 Metadata flush took 2.719846ms
[wal] 2015/09/16 06:05:58 Flushing 36 measurements and 252 series to index
[wal] 2015/09/16 06:05:58 Metadata flush took 2.775602ms
[wal] 2015/09/16 06:05:58 Flushing 36 measurements and 144 series to index
[wal] 2015/09/16 06:05:58 Metadata flush took 2.134082ms
[wal] 2015/09/16 06:05:58 Flushing 36 measurements and 144 series to index
[wal] 2015/09/16 06:05:58 Metadata flush took 2.145459ms
[wal] 2015/09/16 06:05:58 Flushing 36 measurements and 144 series to index
[wal] 2015/09/16 06:05:58 Metadata flush took 2.546441ms
[wal] 2015/09/16 06:05:58 Flushing 36 measurements and 144 series to index
[wal] 2015/09/16 06:05:58 Metadata flush took 2.441598ms
[wal] 2015/09/16 06:05:58 Flushing 36 measurements and 72 series to index
[wal] 2015/09/16 06:05:58 Metadata flush took 2.315491ms
[monitor] 2015/09/16 06:05:59 failed to store statistics: timeout
[monitor] 2015/09/16 06:06:09 failed to store statistics: timeout
[monitor] 2015/09/16 06:06:19 failed to store statistics: timeout
[monitor] 2015/09/16 06:06:29 failed to store statistics: timeout
[monitor] 2015/09/16 06:06:39 failed to store statistics: timeout
[monitor] 2015/09/16 06:06:49 failed to store statistics: timeout
[monitor] 2015/09/16 06:06:59 failed to store statistics: timeout
[monitor] 2015/09/16 06:07:09 failed to store statistics: timeout
[monitor] 2015/09/16 06:07:19 failed to store statistics: timeout
[monitor] 2015/09/16 06:07:29 failed to store statistics: timeout
[monitor] 2015/09/16 06:07:39 failed to store statistics: timeout
[monitor] 2015/09/16 06:07:49 failed to store statistics: timeout
[monitor] 2015/09/16 06:07:59 failed to store statistics: timeout
[monitor] 2015/09/16 06:08:09 failed to store statistics: timeout
OS? Cluster or single node? How many points per second are you writing? Line protocol? Graphite plugin? Are you batching writes?
influx service becomes unavailable.
Does it respond to HTTP requests to the /ping endpoint? Does it panic? Anything else in the logs?
@beckettsean OS : Ubuntu14.04.1 LTS Cluster : 3 raft node cluster I am not sure exactly how many points we are writing per second, what I know is that we are writing data in a batch with Line protocol through HTTP, each batch has around 30,000 points. We didn't try to send HTTP requests to the /ping endpoint, but it didn't respond to any queries and it still kept writing to log.
This is the config file we are using
[meta]
dir = "/data/meta"
hostname = "influx-01"
bind-address = ":8088"
retention-autocreate = true
election-timeout = "1s"
heartbeat-timeout = "1s"
leader-lease-timeout = "500ms"
commit-timeout = "50ms"
[data]
dir = "/data/db"
max-wal-size = 104857600 # Maximum size the WAL can reach before a flush. Defaults to 100MB.
wal-flush-interval = "10m0s" # Maximum time data can sit in WAL before a flush.
wal-partition-flush-delay = "2s" # The delay time between each WAL partition being flushed.
wal-dir = "/data/wal"
wal-enable-logging = true
[cluster]
write-timeout = "5s" # The time within which a write operation must complete on the cluster.
shard-writer-timeout = "5s" # The time within which a shard must respond to write.
[retention]
enabled = true
check-interval = "10m0s"
[admin]
enabled = true
bind-address = ":8083"
https-enabled = false
https-certificate = "/etc/ssl/influxdb.pem"
[http]
enabled = true
bind-address = ":8086"
auth-enabled = false
log-enabled = true
write-tracing = false
pprof-enabled = false
https-enabled = false
https-certificate = "/etc/ssl/influxdb.pem"
[[graphite]]
enabled = false
bind-address = ":2003"
protocol = "tcp"
consistency-level = "one"
separator = "."
database = "graphitedb"
batch-size = 1000
batch-timeout = "1s"
templates = [
"instance.profile.measurement*"
]
[collectd]
enabled = false
[opentsdb]
enabled = false
[[udp]]
enabled = false
bind-address = ":4444"
database = "udpdb"
[monitoring]
enabled = false
write-interval = "24h"
[continuous_queries]
log-enabled = true
enabled = true
recompute-previous-n = 2
recompute-no-older-than = "10m0s"
compute-runs-per-interval = 10
compute-no-more-than = "2m0s"
[hinted-handoff]
enabled = true
dir = "/data/hh"
max-size = 1073741824
max-age = "168h"
retry-rate-limit = 0
retry-interval = "1s"
+1
+1
+1
+1
+1
+1 This happens with 0.9.3 too..
:+1: - I noted this too
InfluxDB starting, version 0.9.4.2, branch 0.9.4, commit da1b59e7d7764d36786253b2db13b97f42ed4e1d
For those having issues, does SHOW DATABASES reveal an _internal database? If not, can you try CREATE DATABASE _internal and see if that helps?
It looks from the logs like a failure of the internal statistics database, but I am unable to reproduce.
It's not specific to the internal database.
Internal monitoring is attempting to store stats and the WAL flushing is blocking it (as it would any write). It's just that the internal monitoring is the first victim.
This is another example of why we're moving to the new storage engine, tsm1.
this also occurs in 0.9.5 nightly build
How do I resolve this issue? And avoid it in the future?
OS: Red Hat 4.4.7-4 Cluster or single node? Just one node. How many points per second are you writing? 120000 Line protocol? Graphite plugin? influxdb-java, I think that's the line protocol. Are you batching writes? yes, batching inserts every 1000ms. Was about 40-60 inserts a batch.
Influx is completely unresponsive.
> show databases
ERR: Get http://localhost:8086/query?db=&q=show+databases: dial tcp [::1]:8086: getsockopt: connection refused
Short of deleting the data directory how do I get infuxdb back up?
@nmarshall23 try pausing writes while keeping the database up, so that the WAL can flush.
Note that the error from the CLI strongly suggests that the influxd process is not running. Can you verify with ps -ef | grep influx that both the CLI and the database process are up?
@beckettsean I couldn't verify that the influxd process was up. I had tried to restart influxd. Last night I ran another test. I reset the config. Then changed the max-wal-size to 1gig. The box has 16 gigs of ram in it. It's still running, however it is very slow to respond. I am seeing occasional write error in the _internal.
Try pausing writes while keeping the database up, so that the WAL can flush.
How long do you suggest that I pause writes after I get back a 500 status code?
I am only sending 120 to 160 points per 2 seconds.
I will get back to you on after I run a test with pausing writing. Looks like I might have to patch the influxdb-java client. As it throws a RuntimeException, and doesn't handle error response from influxdb.
@nmarshall23
How long do you suggest that I pause writes after I get back a 500 status code?
If you are getting 500s on writes that means the WAL is full and not accepting writes. If it happens for the steady-state data rate, the rate is too high for the server to maintain. The WAL is intended to handle traffic spikes, and can accept points faster than the persistent storage engine can accept them. So, if the WAL is backing up under your typical load, the system simply won't be able to handle the steady-state load regardless of how long writes are paused. Once started up again, they will saturate the database, then fill the WAL, and then start timing out again.
Then changed the max-wal-size to 1gig.
If the data rate is simply too high, making the WAL bigger just means the problem takes longer to show up. The database is already unable to drain the WAL, so making the WAL bigger doesn't help.
How many points per second are you writing? 120000
That's a moderate load. What are the server specs? They need to be at least 2 CPUs and 4GB RAM, but 4 and 8 would be better.
Line protocol? Graphite plugin? influxdb-java, I think that's the line protocol.
Yes, it should be.
Are you batching writes? yes, batching inserts every 1000ms. Was about 40-60 inserts a batch.
I don't quite follow. How does 40-60 points per batch, with 1000ms batches equal 120k pps? Are you writing from multiple sources? If there are ~2400 sources, each writing ~50 points per batch at a batch per second, that equals 120k pps.
That also equates to 2400 HTTP connections per second, which is a significant overhead. That would lead me to think you need at least 4 CPUs to handle the TCP/IP + database load.
Same problem, influxdb process is running,
influxdb 15734 1 17 15:41 pts/0 00:00:59 /opt/influxdb/influxd -pidfile /var/run/influxdb/influxd.pid -config /etc/opt/influxdb/influxdb.conf
CLI:
InfluxDB shell 0.9.4
> show databases
ERR: Get http://localhost:8086/query?db=&q=show+databases: dial tcp 127.0.0.1:8086: getsockopt: connection refused
Running:
Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24) x86_64 GNU/Linux
InfluxDB - 1 node with default settings
:+1: Same problem. InfluxDB is still running, responds to pings, and even responds to certain requests (SHOW DATABASES, SHOW USERS, and SHOW RETENTION POLICIES all work, but SHOW MEASUREMENTS just hangs with no response).
We're running InfluxDB version 0.9.4.2 in a Docker container (using the tutum/influxdb:latest image as of 3 weeks ago, with no config changes from the one they provide) on a 4-core virtual server with 8GB of RAM; influxd is using about 6.2 GB RSS, and 17.5 GB virtual. There are 10 other servers running telegraf that are writing to that InfluxDB instance; they're configured to collect data every 10 seconds, and write it via http to port 8086. They have the following plugins enabled: cpu, disk, docker, io, mem, net, swap, and system.
We have just made some changes to our config that should cut down on traffic to InfluxDB (turning off percpu in the cpu plugin, filtering net to only monitor eth0, limiting the disk plugin to ext4 filesystems, and limiting the io plugin to a specific device) but we haven't pushed them out yet.
We stopped all but 1 of the telegraf instances writing to this server, and for the next hour it was still giving us timeout errors:
[monitor] 2015/11/16 18:07:14 failed to store statistics: timeout
[http] 2015/11/16 18:07:15 **.**.**.94 - root [16/Nov/2015:18:07:10 +0000] POST /write?consistency=&db=server-metrics&precision=s&rp= HTTP/1.1 500 32 - InfluxDBClient db488169-8c8c-11e5-933b-000000000000 5.002574482s
[monitor] 2015/11/16 18:07:22 failed to store statistics: timeout
[http] 2015/11/16 18:07:25 **.**.**.94 - root [16/Nov/2015:18:07:20 +0000] POST /write?consistency=&db=server-metrics&precision=s&rp= HTTP/1.1 500 32 - InfluxDBClient e13dfd70-8c8c-11e5-933c-000000000000 5.002366704s
After stopping that last telegraf instance, it almost immediately triggered a retention policy enforcement check, and then kept giving us errors:
[monitor] 2015/11/16 18:07:32 failed to store statistics: timeout
[http] 2015/11/16 18:07:35 **.**.**.94 - root [16/Nov/2015:18:07:30 +0000] POST /write?consistency=&db=server-metrics&precision=s&rp= HTTP/1.1 500 32 - InfluxDBClient e733eb9f-8c8c-11e5-933d-000000000000 5.002523726s
[monitor] 2015/11/16 18:07:42 failed to store statistics: timeout
[retention] 2015/11/16 18:07:44 retention policy enforcement check commencing
[monitor] 2015/11/16 18:07:52 failed to store statistics: timeout
[monitor] 2015/11/16 18:08:02 failed to store statistics: timeout
[monitor] 2015/11/16 18:08:12 failed to store statistics: timeout
[monitor] 2015/11/16 18:08:22 failed to store statistics: timeout
[monitor] 2015/11/16 18:08:32 failed to store statistics: timeout
[monitor] 2015/11/16 18:08:42 failed to store statistics: timeout
[monitor] 2015/11/16 18:08:52 failed to store statistics: timeout
[monitor] 2015/11/16 18:09:02 failed to store statistics: timeout
[monitor] 2015/11/16 18:09:12 failed to store statistics: timeout
[monitor] 2015/11/16 18:09:22 failed to store statistics: timeout
[monitor] 2015/11/16 18:09:32 failed to store statistics: timeout
[monitor] 2015/11/16 18:09:42 failed to store statistics: timeout
[monitor] 2015/11/16 18:09:52 failed to store statistics: timeout
Since then, it has continued to give timeout messages constantly, and run a retention policy enforcement check every 10 minutes:
[monitor] 2015/11/16 18:37:32 failed to store statistics: timeout
[monitor] 2015/11/16 18:37:42 failed to store statistics: timeout
[retention] 2015/11/16 18:37:44 retention policy enforcement check commencing
[monitor] 2015/11/16 18:37:53 failed to store statistics: timeout
[monitor] 2015/11/16 18:38:02 failed to store statistics: timeout
[monitor] 2015/11/16 18:38:12 failed to store statistics: timeout
[monitor] 2015/11/16 18:38:22 failed to store statistics: timeout
[monitor] 2015/11/16 18:38:32 failed to store statistics: timeout
[monitor] 2015/11/16 18:38:42 failed to store statistics: timeout
At this point, I'm going to try simply shutting down the InfluxDB container and restarting it.
This may be a deadlock in the code. A stack dump would be great, but I don't think is possible unless the process is running in the background.
Which engine are you using @whitelynx ?