Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ogibayashi
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ogibayashi/7e8cb6665f6e9aa0abe3 to your computer and use it in GitHub Desktop.
Save ogibayashi/7e8cb6665f6e9aa0abe3 to your computer and use it in GitHub Desktop.
Fluentd benchmark memo

Fluentdベンチマークのメモ

単一プロセスのin_tail

以下のように、ファイルを読み込みflowcountだけ取ってnullに捨てる

<source>
 type tail
 path /tmp/dummy_log.log
 pos_file /var/log/td-agent/td-agent-test_file.pos
 tag test.dummy
 format ltsv
</source>

<match test.**>
  type copy
  <store>
    type null
  </store>
  <store>
        type        flowcounter
        count_keys  *
        unit        minute
        tag         flowcount.uldata13_td-agent-test
  </store>
</match>

<match flowcount.**>
     type growthforecast
     gfapi_url http://10.29.254.50:5125/api/
     service fluent_flowcount
     tag_for section
     remove_prefix flowcount
     name_key_pattern .*_count$
</match>

負荷はdummerでかける. 設定は以下の通り. rateは変えていく

configure 'sample' do
  output "/tmp/dummy_log.log"
  rate 20000
  delimiter "\t"
  labeled true
  field :id, type: :integer, countup: true, format: "%04d"
  field :time, type: :datetime, format: "[%Y-%m-%d %H:%M:%S]", random: false
  field :level, type: :string, any: %w[DEBUG INFO WARN ERROR]
  field :method, type: :string, any: %w[GET POST PUT]
  field :uri, type: :string, any: %w[/api/v1/people /api/v1/textdata]
  field :reqtime, type: :float, range: 0.1..5.0
  field :foobar, type: :string, length: 8
end 

以下のようにrateを変えて実施した

  1. 5000
  2. 10000
  3. 15000
  4. 20000
  5. 20000 (worker = 2)

rate=15000/secあたりでプロセスCPUは100%近くなり、flowcountも伸びなくなっている. が、dummerのCPU使用率もほぼ100%だったため、最後のケースでworkerを2にして実施. 結果、約27000msg/secまでflowcountが伸びた. dummerのrateはworkerごとなのか?

https://gist.github.com/ogibayashi/7e8cb6665f6e9aa0abe3/raw/7d2beb2215377e7986552521db67bbb27c18b14d/td-agent-test_cpu.png

https://gist.github.com/ogibayashi/7e8cb6665f6e9aa0abe3/raw/f2314b8893e928e15f35749602e454e1f96bbd6c/test.dummy_count.png

(in_tail -> out_forward) -> (in_forward -> out_null )のケース

送信側はin_tailで読み込んでforwardする

<source>
 type tail
 path /tmp/dummy_log.log
 pos_file /var/log/td-agent/td-agent-test_file.pos
 tag test.dummy
 format ltsv
</source>

<match test.**>
  type copy
  <store>
    type forward
    flush_interval 1s
    <server>
      host localhost
      port 24231
    </server>
  </store>
  <store>
        type        flowcounter
        count_keys  *
        unit        minute
        tag         flowcount.uldata13_td-agent-test
  </store>
</match>

受信側は、forwardで受け取ったものをnullに捨てる

<source>
  type forward
  port 24231
</source>

<match test.**>
  type copy
  <store>
    type null
  </store>
  <store>
        type        flowcounter
        count_keys  *
        unit        minute
        tag         flowcount.uldata13_td-agent-test2
  </store>
</match>

こんな感じで、流量を20,000/sec, 25,000/sec, 30,000/secと増やす

#!/bin/sh
sleep 600
dummer -c dummer.conf -r 5000 -w 4  &
pid=$!
sleep 600; kill $pid
dummer -c dummer.conf -r 5000 -w 5  &
pid=$!
sleep 600; kill $pid
dummer -c dummer.conf -r 5000 -w 6  &
pid=$!
sleep 600; kill $pid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment