Skip to content

Commit 5e26532

Browse files
committed
[BENCHMARKING] Run all simple benchmarks in Jenkins
1 parent ea1aefa commit 5e26532

File tree

6 files changed

+17
-9
lines changed

6 files changed

+17
-9
lines changed

.ci/jobs/elastic+elasticsearch-ruby+benchmark-tests+master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
bundle install
5252
5353
export ELASTICSEARCH_URL=http://worker-954083.build.fsn1-dc3.hetzner.elasticnet.co:9200
54-
bundle exec rake benchmark:simple:ping
54+
bundle exec rake benchmark:simple:all
5555
5656
# override default
5757
publishers: null

profile/benchmarking/benchmarking_tasks.rake

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ namespace :benchmark do
132132
%w[ benchmark:simple:ping
133133
benchmark:simple:create_index
134134
benchmark:simple:index_document_small
135-
benchmark:simple:index_document_small_patron
136135
benchmark:simple:index_document_large
137136
benchmark:simple:get_document_small
138137
benchmark:simple:get_document_large
@@ -162,8 +161,16 @@ namespace :benchmark do
162161

163162
namespace :complex do
164163

164+
task :download_dataset do
165+
current_path = File.expand_path(File.dirname(__FILE__))
166+
data_path = [current_path, 'data'].join('/')
167+
unless File.exists?([data_path, 'stackoverflow.json'].join('/'))
168+
`gsutil cp gs://clients-team-files/stackoverflow.json "#{data_path}/"`
169+
end
170+
end
171+
165172
desc "Run the \'index documents\' benchmark test"
166-
task :index_documents do
173+
task :index_documents => :download_dataset do
167174
require 'elasticsearch'
168175
Elasticsearch::Benchmarking.each_run(ENV['matrix']) do |run|
169176
task = Elasticsearch::Benchmarking::Complex.new(run)

profile/benchmarking/complex.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ def search_documents(opts = {})
8888
slice
8989
end[rand(slices.size)-1]
9090

91-
sample_documment = sample_slice[rand(sample_slice.size)-1][:index][:data]
92-
search_criteria = sample_documment.find { |k,v| v.is_a?(String) }
91+
sample_document = sample_slice[rand(sample_slice.size)-1][:index][:data]
92+
search_criteria = sample_document.find { |k,v| v.is_a?(String) }
9393
request = { body: { query: { match: { search_criteria[0] => search_criteria[1] } } } }
9494

9595
warmup_repetitions.times do

profile/benchmarking/measurable.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def action_iterations
204204
# @return [ String ] The file path and name for the dataset.
205205
#
206206
# @since 7.0.0
207-
DATASET_FILE = [DATA_PATH, 'documents-small.json'].join('/').freeze
207+
DATASET_FILE = [DATA_PATH, 'stackoverflow.json'].join('/').freeze
208208

209209
# The name of the index to use for benchmark tests.
210210
#
@@ -270,6 +270,7 @@ def index_results!(results, options = {})
270270
res.results_doc
271271
rescue => ex
272272
puts "Could not index results, due to #{ex.class}."
273+
puts "#{ex.backtrace[0..15]}"
273274
end
274275

275276
def result_cluster_client

profile/benchmarking/results.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ def min
171171
end
172172

173173
def standard_deviation
174+
return 0 if raw_results.size < 2
174175
Math.sqrt(sample_variance)
175176
end
176177

@@ -205,7 +206,6 @@ def git_doc
205206
commit_message = `git log -1 --pretty=%B`
206207
repository = 'elasticsearch-ruby'
207208

208-
209209
{ branch: branch,
210210
sha: sha.chomp,
211211
commit_message: commit_message.gsub(/\n/, ''),

profile/benchmarking/simple.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def search_document_small(opts={})
290290
with_cleanup do
291291
client.create(index: INDEX, body: small_document)
292292
search_criteria = { match: { cuisine: 'mexican' } }
293-
request = { body: { query: { match: search_criteria } } }
293+
request = { body: { query: search_criteria } }
294294
if noop_plugin?
295295
Elasticsearch::API.const_set('UNDERSCORE_SEARCH', '_noop_search')
296296
else
@@ -340,7 +340,7 @@ def search_document_large(opts={})
340340
results = with_cleanup do
341341
client.create(index: INDEX, body: large_document)
342342
search_criteria = { match: { 'user.lang': 'en' } }
343-
request = { body: { query: { match: search_criteria } } }
343+
request = { body: { query: search_criteria } }
344344
if noop_plugin?
345345
Elasticsearch::API.const_set('UNDERSCORE_SEARCH', '_noop_search')
346346
else

0 commit comments

Comments
 (0)