# Fluentdベンチマークのメモ ## 単一プロセスのin_tail 以下のように、ファイルを読み込みflowcountだけ取ってnullに捨てる ``` type tail path /tmp/dummy_log.log pos_file /var/log/td-agent/td-agent-test_file.pos tag test.dummy format ltsv type copy type null type flowcounter count_keys * unit minute tag flowcount.uldata13_td-agent-test type growthforecast gfapi_url http://10.29.254.50:5125/api/ service fluent_flowcount tag_for section remove_prefix flowcount name_key_pattern .*_count$ ``` 負荷はdummerでかける. 設定は以下の通り. rateは変えていく ```ruby 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 1. 10000 1. 15000 1. 20000 1. 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](プロセスCPU使用率) ![https://gist.github.com/ogibayashi/7e8cb6665f6e9aa0abe3/raw/f2314b8893e928e15f35749602e454e1f96bbd6c/test.dummy_count.png](メッセージ流量) ## (in_tail -> out_forward) -> (in_forward -> out_null )のケース 送信側はin_tailで読み込んでforwardする ``` type tail path /tmp/dummy_log.log pos_file /var/log/td-agent/td-agent-test_file.pos tag test.dummy format ltsv type copy type forward flush_interval 1s host localhost port 24231 type flowcounter count_keys * unit minute tag flowcount.uldata13_td-agent-test ``` 受信側は、forwardで受け取ったものをnullに捨てる ``` type forward port 24231 type copy type null type flowcounter count_keys * unit minute tag flowcount.uldata13_td-agent-test2 ``` こんな感じで、流量を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 ```