consul icon indicating copy to clipboard operation
consul copied to clipboard

Consul 0.7 - servers constantly writing to disk at ~3MB/s

Open adrianlop opened this issue 10 years ago • 8 comments

Hi guys,

After upgrading the cluster (3 servers, ~40clients) from 0.6.4 to 0.7, I can see in my system metrics that the disk usage has increased in SERVERS. With 0.6.4 they were writing at 100KB/s, now every 10sec, they write at ~3MB/s avg. iotop: 24474 be/4 root 0.00 B/s 4.67 M/s 0.00 % 3.02 % consul agent -config-dir=/etc/consul.d

Is this happening because of a new feature?

Thanks!

adrianlop avatar Oct 21 '16 12:10 adrianlop

do you have any service checks that output a lot of content to consul? for me that was a cause for a lot of network and disk io :)

jippi avatar Oct 21 '16 13:10 jippi

potencially we do, i'll turn them off and compare results. thanks a lot @jippi !!

adrianlop avatar Oct 21 '16 22:10 adrianlop

how to config to let the outputs to log file? @jippi

xautjzd avatar Nov 02 '16 02:11 xautjzd

hi guys,

after changing some http checks that produced a lot of output, to tcp, Consul servers continue writing to disk at the same speed.

any ideas?

adrianlop avatar Nov 02 '16 16:11 adrianlop

Hi @adrianlop there shouldn't have been anything new in 0.7 to cause this. If you look at telemetry and look at the counts for metrics with fsm in the name that may help narrow down what's churning.

slackpad avatar Nov 02 '16 16:11 slackpad

hi @slackpad thanks for the help. Please find attached some additional info. do you see anything abnormal?

consul info output:

agent:
    check_monitors = 3
    check_ttls = 0
    checks = 5
    services = 5
build:
    prerelease = 
    revision = 'a189091
    version = 0.7.0
consul:
    bootstrap = false
    known_datacenters = 1
    leader = false
    leader_addr = 10.120.0.178:8300
    server = true
raft:
    applied_index = 185062591
    commit_index = 185062591
    fsm_pending = 0
    last_contact = 29.537516ms
    last_log_index = 185062591
    last_log_term = 6038
    last_snapshot_index = 185054865
    last_snapshot_term = 6038
    latest_configuration = [{Suffrage:Voter ID:10.120.0.176:8300 Address:10.120.0.176:8300} {Suffrage:Voter ID:10.120.0.178:8300 Address:10.120.0.178:8300} {Suffrage:Voter ID:10.120.0.177:8300 Address:10.120.0.177:8300}]
    latest_configuration_index = 138307850
    num_peers = 2
    protocol_version = 1
    protocol_version_max = 3
    protocol_version_min = 0
    snapshot_version_max = 1
    snapshot_version_min = 0
    state = Follower
    term = 6038
runtime:
    arch = amd64
    cpu_count = 1
    goroutines = 446
    max_procs = 1
    os = linux
    version = go1.6.3
serf_lan:
    encrypted = false
    event_queue = 0
    event_time = 329
    failed = 0
    health_score = 0
    intent_queue = 0
    left = 0
    member_time = 910
    members = 41
    query_queue = 0
    query_time = 1
serf_wan:
    encrypted = false
    event_queue = 0
    event_time = 1
    failed = 0
    health_score = 0
    intent_queue = 0
    left = 0
    member_time = 1
    members = 1
    query_queue = 0
    query_time = 1

consul monitor output:

2016/11/03 07:53:54 [INFO] agent: Synced check 'service:telegraf'
2016/11/03 07:54:34 [INFO] agent: Synced check 'service:filebeat'
2016/11/03 07:55:18 [INFO] consul.fsm: snapshot created in 27.011µs
2016/11/03 07:55:18 [INFO] raft: Starting snapshot up to 185043703
2016/11/03 07:55:18 [INFO] snapshot: Creating new snapshot at /var/consul/data/raft/snapshots/6038-185043703-1478159718535.tmp
2016/11/03 07:55:18 [INFO] snapshot: reaping snapshot /var/consul/data/raft/snapshots/6038-185022435-1478158802323
2016/11/03 07:55:18 [INFO] raft: Compacting logs from 185022619 to 185033465
2016/11/03 07:55:18 [INFO] raft: Snapshot to 185043703 complete
2016/11/03 08:00:09 [INFO] agent: Synced check 'service:telegraf'
2016/11/03 08:00:10 [INFO] agent: Synced check 'service:filebeat'
2016/11/03 08:03:09 [INFO] consul.fsm: snapshot created in 55.761µs
2016/11/03 08:03:09 [INFO] raft: Starting snapshot up to 185054865
2016/11/03 08:03:09 [INFO] snapshot: Creating new snapshot at /var/consul/data/raft/snapshots/6038-185054865-1478160189382.tmp
2016/11/03 08:03:09 [INFO] snapshot: reaping snapshot /var/consul/data/raft/snapshots/6038-185032858-1478159239334
2016/11/03 08:03:09 [INFO] raft: Compacting logs from 185033466 to 185044625
2016/11/03 08:03:09 [INFO] raft: Snapshot to 185054865 complete
2016/11/03 08:04:50 [INFO] agent: Synced check 'service:telegraf'
2016/11/03 08:05:03 [INFO] agent: Synced check 'service:filebeat'
2016/11/03 08:06:22 [INFO] agent: Synced service 'consul-http'
2016/11/03 08:06:22 [INFO] agent: Synced service 'filebeat'
2016/11/03 08:06:22 [INFO] agent: Synced service 'postfix'
2016/11/03 08:06:22 [INFO] agent: Synced service 'telegraf'
2016/11/03 08:06:22 [INFO] agent: Synced check 'freespace'
2016/11/03 08:08:04 [INFO] agent: Synced check 'service:filebeat'
2016/11/03 08:08:30 [INFO] agent.rpc: Accepted client: 127.0.0.1:59334
2016/11/03 08:09:14 [INFO] agent: Synced check 'service:telegraf'
2016/11/03 08:09:34 [INFO] consul.fsm: snapshot created in 57.968µs
2016/11/03 08:09:34 [INFO] raft: Starting snapshot up to 185064133
2016/11/03 08:09:34 [INFO] snapshot: Creating new snapshot at /var/consul/data/raft/snapshots/6038-185064133-1478160574861.tmp
2016/11/03 08:09:34 [INFO] snapshot: reaping snapshot /var/consul/data/raft/snapshots/6038-185043703-1478159718535
2016/11/03 08:09:34 [INFO] raft: Compacting logs from 185044626 to 185053893
2016/11/03 08:09:34 [INFO] raft: Snapshot to 185064133 complete
2016/11/03 08:10:11 [INFO] agent.rpc: Accepted client: 127.0.0.1:59346

telemetry samples (gathered using nc -u -l during 5sec then | grep fsm, this is the result):

consul.consul.fsm.kvs.set:0.040739|ms
consul.raft.fsm.apply:0.078422|ms
consul.consul.fsm.kvs.set:0.043953|ms
consul.raft.fsm.apply:0.081914|ms
consul.consul.fsm.kvs.set:0.044486|ms
consul.raft.fsm.apply:0.075745|ms
consul.consul.fsm.kvs.set:0.036612|ms
consul.raft.fsm.apply:0.072852|ms
consul.consul.fsm.kvs.set:0.037315|ms
consul.raft.fsm.apply:0.057869|ms
consul.consul.fsm.kvs.set:0.057896|ms
consul.raft.fsm.apply:0.084373|ms
consul.consul.fsm.kvs.set:0.051647|ms
consul.raft.fsm.apply:0.078896|ms
consul.consul.fsm.kvs.set:0.046334|ms
consul.raft.fsm.apply:0.065241|ms
consul.consul.fsm.kvs.set:0.035779|ms
consul.raft.fsm.apply:0.071228|ms
consul.consul.fsm.kvs.set:0.036422|ms
consul.raft.fsm.apply:0.060246|ms
consul.consul.fsm.kvs.set:0.034309|ms
consul.raft.fsm.apply:0.056165|ms
consul.consul.fsm.kvs.set:0.036069|ms
consul.raft.fsm.apply:0.069200|ms
consul.consul.fsm.kvs.set:0.040583|ms
consul.raft.fsm.apply:0.076623|ms
consul.consul.fsm.kvs.set:0.098136|ms
consul.raft.fsm.apply:0.122287|ms
consul.consul.fsm.kvs.set:0.038229|ms
consul.raft.fsm.apply:0.060556|ms
consul.consul.fsm.kvs.set:0.037180|ms
consul.raft.fsm.apply:0.060233|ms
consul.consul.fsm.kvs.set:0.038661|ms
consul.raft.fsm.apply:0.076920|ms
consul.consul.fsm.kvs.set:0.044323|ms
consul.raft.fsm.apply:0.105057|ms
consul.consul.fsm.kvs.set:0.049309|ms
consul.raft.fsm.apply:0.070825|ms
consul.consul.fsm.kvs.set:0.036830|ms
consul.raft.fsm.apply:0.073697|ms
consul.consul.fsm.kvs.set:0.034206|ms
consul.raft.fsm.apply:0.056826|ms
consul.consul.fsm.kvs.set:0.062025|ms
consul.raft.fsm.apply:0.086160|ms
consul.consul.fsm.kvs.set:0.067937|ms
consul.raft.fsm.apply:0.098535|ms

adrianlop avatar Nov 03 '16 08:11 adrianlop

Thanks @adrianlop that looks like the only churn over that 5 second period is writes to the KV store. Do you have something in your infrastructure that could be writing a large-ish value some set of keys over and over? We don't have a super great way to chase that down on the server side - if you have debug logging turned on your agents (or use consul monitor for a little while with debug enabled) you will be able to see the requests to /v1/kv on the agent side.

slackpad avatar Nov 03 '16 17:11 slackpad

@slackpad thanks a lot for the help! that's it. we're using consul-alerts for a basic alerting system on top of consul, and it's writing to the KV its own healthcheck info to compare previous data and generate alerts. I'll try to tweak this tool to reduce intensive KV writing.

adrianlop avatar Nov 04 '16 10:11 adrianlop