以下のように、ファイルを読み込み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を変えて実施した
- 5000
- 10000
- 15000
- 20000
- 20000 (worker = 2)
rate=15000/secあたりでプロセスCPUは100%近くなり、flowcountも伸びなくなっている. が、dummerのCPU使用率もほぼ100%だったため、最後のケースでworkerを2にして実施. 結果、約27000msg/secまでflowcountが伸びた. dummerのrateはworkerごとなのか?
送信側は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