rubberband_flamethrower 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/VERSION +1 -1
- data/lib/rubberband_flamethrower.rb +11 -11
- data/rubberband_flamethrower.gemspec +1 -3
- metadata +12 -14
- data/lib/rubberband_flamethrower/inserter.rb +0 -37
- data/lib/rubberband_flamethrower/retriever.rb +0 -37
data/README.md
CHANGED
@@ -77,7 +77,7 @@ The "auto" argument can be used to repeatedly run the "flamethrower fire" comman
|
|
77
77
|
|
78
78
|
flamethrower auto
|
79
79
|
|
80
|
-
This can be configured much like the above example
|
80
|
+
This can be configured much like the above example with two additional parameters, which is supplied first and represents the number of times to run the "flamethrower fire" command. Here are the parameters in order with their default values: (how_many_batches=3, per_batch=500, starting_id=1, server_url="http://localhost:9200", index="twitter", type="tweet", id_overwrite="n")
|
81
81
|
|
82
82
|
To run the "flamethrower fire" command 5 times in a row instead of the default 3:
|
83
83
|
|
@@ -87,7 +87,7 @@ To run the "flamethrower fire" command 5 times, inserting 5,000 objects each ti
|
|
87
87
|
|
88
88
|
flamethrower auto 5 5000
|
89
89
|
|
90
|
-
The id_overwrite parameter determines the ID strategy used for subsequent batches in the auto command.
|
90
|
+
The id_overwrite parameter determines the ID strategy used for subsequent batches in the auto command. When set to "n" ("n" is the default) each batch will be writing new data with unused IDs to the Elastic Search server, simulating a system where new data is constantly being inserted and not updated. 5 batches of 500 with an "n" would use the IDs 1-2500. When it is set to "y" each batch (after the first) will be overwriting existing data on the Elastic Search server, simulating a system where data is constantly being updated (after the initial batch). 5 batches of 500 with a setting of "y" would use the IDs 1-500 on each batch.
|
91
91
|
|
92
92
|
#### Help
|
93
93
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
@@ -46,25 +46,25 @@ module RubberbandFlamethrower
|
|
46
46
|
# this is adapted from the file README.md
|
47
47
|
# things updated here should be updated there
|
48
48
|
def self.help
|
49
|
-
puts "
|
49
|
+
puts "\nRubberband Flamethrower is a gem for inserting faked data into an Elastic Search server"
|
50
50
|
puts "and providing basic benchmarks. It creates and inserts fake data objects with three"
|
51
51
|
puts "fields (message, username, and post_date) and reports timing information."
|
52
52
|
|
53
|
-
puts "\
|
53
|
+
puts "\nFlamethrower Commands Available:\n\n"
|
54
54
|
puts "flamethrower fire #benchmark a batch insert of data to an elastic search server"
|
55
55
|
puts "flamethrower auto #benchmark a series of batch inserts to an elastic search server"
|
56
56
|
puts "flamethrower help #display this help message"
|
57
57
|
|
58
|
-
puts "\
|
58
|
+
puts "\nThe fire and auto commands can be configured by passing arguments."
|
59
59
|
puts "The parameters accepted by fire and auto all have a default value if left blank."
|
60
60
|
|
61
|
-
puts "\n\
|
61
|
+
puts "\n\"fire\" parameters in order with their default values:"
|
62
62
|
puts "(how_many=500, starting_id=1, server_url=http://localhost:9200, index=twitter, type=tweet)"
|
63
63
|
|
64
|
-
puts "\n\
|
64
|
+
puts "\n\"auto\" parameters in order with their default values:"
|
65
65
|
puts "(how_many_batches=3, per_batch=500, starting_id=1, server_url=http://localhost:9200, index=twitter, type=tweet, id_overwrite=n)"
|
66
66
|
|
67
|
-
puts "\
|
67
|
+
puts "\nUsage Examples With Parameters:"
|
68
68
|
puts "flamethrower fire 10000 #To Insert 10,000 instead of 500"
|
69
69
|
puts "flamethrower fire 5000 5001 #To Insert 5,000 starting with the ID 5001"
|
70
70
|
puts "flamethrower fire 2000 1 \"http://es.com:9200\" #Elastic Search Node located at http://es.com:9200"
|
@@ -72,11 +72,11 @@ module RubberbandFlamethrower
|
|
72
72
|
puts "\t#Insert into an index named \"facebook\" instead of \"twitter\""
|
73
73
|
puts "\t#with a type of \"message\" instead of \"tweet\""
|
74
74
|
|
75
|
-
puts "\
|
76
|
-
puts "When set to \"n\" (
|
77
|
-
puts "Search server, simulating a system where data is constantly being inserted and not updated. When it is
|
78
|
-
puts "to \"y\" each batch will
|
79
|
-
puts "system where data is constantly being updated (after the initial batch)."
|
75
|
+
puts "\nThe id_overwrite parameter determines the ID strategy used for subsequent batches in the auto command."
|
76
|
+
puts "When set to \"n\" (\"n\" is the default) each batch will be writing new data with unused IDs to the Elastic"
|
77
|
+
puts "Search server, simulating a system where new data is constantly being inserted and not updated. When it is"
|
78
|
+
puts "set to \"y\" each batch (after the first) will be overwriting existing data on the Elastic Search server,"
|
79
|
+
puts "simulating a system where data is constantly being updated (after the initial batch)."
|
80
80
|
end
|
81
81
|
|
82
82
|
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rubberband_flamethrower"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Orr"]
|
@@ -30,8 +30,6 @@ Gem::Specification.new do |s|
|
|
30
30
|
"lib/rubberband_flamethrower/.DS_Store",
|
31
31
|
"lib/rubberband_flamethrower/data_generator.rb",
|
32
32
|
"lib/rubberband_flamethrower/flamethrower.rb",
|
33
|
-
"lib/rubberband_flamethrower/inserter.rb",
|
34
|
-
"lib/rubberband_flamethrower/retriever.rb",
|
35
33
|
"lib/rubberband_flamethrower/words/README",
|
36
34
|
"lib/rubberband_flamethrower/words/american-words.10",
|
37
35
|
"lib/rubberband_flamethrower/words/american-words.20",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubberband_flamethrower
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-04-09 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
16
|
-
requirement: &
|
16
|
+
requirement: &11304560 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.10.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *11304560
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &11320540 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 3.2.13
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *11320540
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdoc
|
38
|
-
requirement: &
|
38
|
+
requirement: &11314600 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '3.12'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *11314600
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &11330760 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.3.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *11330760
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &11324960 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: 1.8.4
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *11324960
|
69
69
|
description: Use to quickly fill up some indicies in Elastic Search and to retrieve
|
70
70
|
statistics about insertion rates
|
71
71
|
email: michael@cloudspace.com
|
@@ -88,8 +88,6 @@ files:
|
|
88
88
|
- lib/rubberband_flamethrower/.DS_Store
|
89
89
|
- lib/rubberband_flamethrower/data_generator.rb
|
90
90
|
- lib/rubberband_flamethrower/flamethrower.rb
|
91
|
-
- lib/rubberband_flamethrower/inserter.rb
|
92
|
-
- lib/rubberband_flamethrower/retriever.rb
|
93
91
|
- lib/rubberband_flamethrower/words/README
|
94
92
|
- lib/rubberband_flamethrower/words/american-words.10
|
95
93
|
- lib/rubberband_flamethrower/words/american-words.20
|
@@ -117,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
115
|
version: '0'
|
118
116
|
segments:
|
119
117
|
- 0
|
120
|
-
hash:
|
118
|
+
hash: 2071983575362906945
|
121
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
120
|
none: false
|
123
121
|
requirements:
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# Rubberband Flamethrower is a collection of scripts for dealing with faked Elastic Search data.
|
2
|
-
# This file is the main script for inserting fake data
|
3
|
-
# It inserts fake "tweet" type objects into a "twitter" index
|
4
|
-
# on a local Elastic Search server at localhost:9200.
|
5
|
-
# It runs in an infinite loop until you stop it.
|
6
|
-
#
|
7
|
-
#
|
8
|
-
# Author:: Michael Orr
|
9
|
-
# email - michael@cloudspace.com
|
10
|
-
# twitter - @imbiat
|
11
|
-
# Copyright:: Copyright (c) 2013
|
12
|
-
# License:: MIT License
|
13
|
-
|
14
|
-
|
15
|
-
require_relative "data_generator.rb"
|
16
|
-
|
17
|
-
# a unique ID must be provided for each document stored in Elastic Search
|
18
|
-
# since we are looping, we set a starting id and it will be incremented in the loop
|
19
|
-
id = 2
|
20
|
-
|
21
|
-
# initialize the random data generator object
|
22
|
-
data = DataGenerator.new
|
23
|
-
|
24
|
-
# start infinite loop
|
25
|
-
while true do
|
26
|
-
|
27
|
-
# generate a piece of random data to insert that approxiamates a tweet
|
28
|
-
insert_data = data.generate_random_insert_data
|
29
|
-
puts insert_data
|
30
|
-
|
31
|
-
# insert the random data into local elastic search index "twitter" as type "tweet" with set id
|
32
|
-
response = HTTParty.put("http://localhost:9200/twitter/tweet/#{id}", body: insert_data)
|
33
|
-
puts response.body
|
34
|
-
|
35
|
-
#increment the insert id
|
36
|
-
id = id + 1
|
37
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# Rubberband Flamethrower is a collection of scripts for dealing with faked Elastic Search data.
|
2
|
-
# This file is the main script for retrieving fake data
|
3
|
-
# When running it will loop continuously
|
4
|
-
# doing a search on the tweets type in the twitter index
|
5
|
-
# for all objects within the date range between 2 and 3 minutes ago
|
6
|
-
# and reports the number of objects found.
|
7
|
-
#
|
8
|
-
# This can be used to easily approximate the maximum speed obtainable
|
9
|
-
# for inserting to a local Elastic Search index for a given AWS box size.
|
10
|
-
#
|
11
|
-
#
|
12
|
-
# Author:: Michael Orr
|
13
|
-
# email - michael@cloudspace.com
|
14
|
-
# twitter - @imbiat
|
15
|
-
# Copyright:: Copyright (c) 2013
|
16
|
-
# License:: MIT License
|
17
|
-
|
18
|
-
|
19
|
-
require 'httparty'
|
20
|
-
require "active_support/core_ext"
|
21
|
-
|
22
|
-
# start infinite loop
|
23
|
-
while true do
|
24
|
-
|
25
|
-
# set up start and end range values for query
|
26
|
-
range_start = (Time.now - 3.minutes).strftime "%Y%m%dT%H:%M:%S"
|
27
|
-
range_end = (Time.now - 2.minutes).strftime "%Y%m%dT%H:%M:%S"
|
28
|
-
|
29
|
-
# set up json for elastic search range query
|
30
|
-
query = {query: {range: { postDate: {from: "#{range_start}", to: "#{range_end}"}}}}.to_json
|
31
|
-
puts query
|
32
|
-
|
33
|
-
# perform elastic search query and report results
|
34
|
-
response = HTTParty.get("http://localhost:9200/twitter/tweet/_search", body: query)
|
35
|
-
parsed = JSON.parse(response.body)
|
36
|
-
puts "hits found: #{parsed["hits"]["total"]}"
|
37
|
-
end
|