Module: Fluent::Loadgen
- Defined in:
- lib/fluent/loadgen.rb,
lib/fluent/loadgen/loader.rb,
lib/fluent/loadgen/datagen.rb
Defined Under Namespace
Classes: ApacheLogGen, HTTPTarget
Class Method Summary collapse
- .main ⇒ Object
-
.run(target, n) ⇒ Object
g = Gen.new.
Class Method Details
.main ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fluent/loadgen.rb', line 6 def self.main # "http://192.168.100.128:8888/load.test") uri = URI(ARGV.shift) n = ARGV.shift.to_i print "making load to #{uri}\n" target = HTTPTarget.new uri run(target, n) end |
.run(target, n) ⇒ Object
g = Gen.new
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fluent/loadgen.rb', line 18 def self.run(target, n) g = Fluent::Loadgen::ApacheLogGen.new start = Time.now (0..n).each do |i| today = Date.today key = "#{today.to_s}-#{i}" # robj = Riak::RObject.new(bucket, key) records = g.gen records[:key] = key res = target.post records.to_json # p records.to_json # robj.raw_data = records.to_json # robj.indexes['year_int'] << today.year # robj.indexes['month_bin'] << "#{today.year}-#{today.month}" # robj.indexes['tag_bin'] << records[:tag] # # robj.content_type = 'application/json' # robj.store if (i % 10) == 0 then print "#{i}: #{res.code}\r" end end duration = (Time.now - start).to_i mps = n * 1.0 / duration print "#{n} messages in #{duration} secs: #{mps} mps.\n" end |