Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
Adds jmeter for #296 caching, initial test for endpoints at 104
Browse files Browse the repository at this point in the history
  • Loading branch information
esthervillars committed Mar 8, 2016
1 parent 43af28a commit 3e9cfc6
Show file tree
Hide file tree
Showing 10 changed files with 42,938 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ public/javascripts/vendor/*/
.vagrant
.tm_properties
Vagrantfile

# Exclude JMeter Benchmarks
benchmarks/*/*.jtl
benchmarks/*/*.csv
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ group :development do
# by a developer on their local machine before committing the compiled strings
gem 'google_drive', '~> 1.0.0'
gem 'highline'
gem 'ruby-jmeter'
end

group :test do
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ GEM
rsolr (1.0.13)
builder (>= 2.1.2)
ruby-debug-passenger (0.2.0)
ruby-jmeter (2.13.10)
nokogiri
rest-client
rubyzip (1.1.7)
safe_yaml (1.0.4)
sanitize (2.0.6)
Expand Down Expand Up @@ -401,6 +404,7 @@ DEPENDENCIES
rdiscount (~> 2.1.6)
rest-client (~> 1.8.0)
ruby-debug-passenger
ruby-jmeter
rubyzip (~> 1.1.0)
sanitize (~> 2.0.6)
spring
Expand Down
12 changes: 12 additions & 0 deletions benchmarks/296_cache/296_cache_benchmarks-staging.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Label,# Samples,Average,Min,Max,Std. Dev.,Error %,Throughput,KB/sec,Avg. Bytes
JSON,358,956,95,1501,273.7,0.00%,5.9,56.32,9734.8
DocumentCloud Home,251,1187,173,2501,734.89,0.00%,4.1,50.59,12568.8
JSON with callback,355,903,98,1353,295.25,0.00%,5.9,56.03,9692.7
JS,347,91,81,190,9.3,0.00%,5.9,53.82,9381
Iframe embed page,346,846,89,1303,281.06,0.00%,5.8,22.53,3988
Iframe embed page embed params,339,856,91,1248,281.27,0.00%,5.7,10.27,1844
Iframe embed document,335,875,91,1397,272.82,0.00%,5.6,16.97,3086
Iframe embed document with embed params,327,882,102,1195,268.15,100.00%,5.5,7.11,1325
oEmbed,319,859,89,1234,269.85,0.00%,5.4,14.28,2716
oEmbed with responsive params,315,861,88,1186,265.37,0.00%,5.3,14.45,2778
TOTAL,3292,821,81,2501,417.04,9.93%,54.1,297.45,5634.7
42,357 changes: 42,357 additions & 0 deletions benchmarks/296_cache/results-staging.jtl

Large diffs are not rendered by default.

454 changes: 454 additions & 0 deletions benchmarks/296_cache/testplan.jmx

Large diffs are not rendered by default.

51 changes: 51 additions & 0 deletions benchmarks/296_cache/testplan.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
require 'rubygems'
require 'ruby-jmeter'

test do
threads count: 5 do
visit name: 'DocumentCloud Home', url: 'https://staging.documentcloud.org'
end


threads count: 50 do
# 296 Reliably cache/expire:
# JS/JSON endpoints
visit name: 'JSON', url: 'https://staging.documentcloud.org/documents/282753-lefler-thesis.json'
visit name: 'JSON with callback', url: 'https://staging.documentcloud.org/documents/282753-lefler-thesis.json?callback=foo'
visit name: 'JS', url: 'https://staging.documentcloud.org/documents/282753-lefler-thesis.js'
# Iframe embed show pages
visit name: 'Iframe embed page', url: 'https://staging.documentcloud.org/documents/282753-lefler-thesis/pages/57.html'
visit name: 'Iframe embed page embed params', url: 'https://staging.documentcloud.org/documents/282753-lefler-thesis/pages/57.html?embed=true'
visit name: 'Iframe embed document', url: 'https://staging.documentcloud.org/documents/282753-lefler-thesis/annotations/42282.html'
visit name: 'Iframe embed document with embed params', url: 'https://staging.documentcloud.org/documents/282753-lefler-thesis/annotations/42282.html?embed=true'
# oEmbed endpoints
visit name: 'oEmbed', url: 'https://staging.documentcloud.org/api/oembed.json?url=https%3A%2F%2Fstaging.documentcloud.org%2Fdocuments%2F282753-lefler-thesis%2Fannotations%2F42282.html'
visit name: 'oEmbed with responsive params',
url: 'https://staging.documentcloud.org/api/oembed.json?url=https%3A%2F%2Fstaging.documentcloud.org%2Fdocuments%2F282753-lefler-thesis.html&responsive=true'
end

cache use_expires: true, clear_each_iteration: true

generate_summary_results

latencies_over_time 'Response Latencies Over Time'

active_threads 'Active Threads'

composite 'Composite Graph', [
{
graph: 'Response Latencies Over Time',
metric: 'Home Page'
},
{
graph: 'Active Threads',
metric: 'Overall Active Threads'
}
]

end.run(
path: '/usr/local/bin/', #'/usr/bin/', , #adjust path to jmeter
file: './benchmarks/296_cache/testplan.jmx',
log: './log/jmeter.log',
jtl: './benchmarks/296_cache/results-staging.jtl')
#properties: './benchmarks/jmeter/user.properties')
41 changes: 41 additions & 0 deletions benchmarks/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
### Benchmark Tests

Using Apache's JMeter framework, a Java application designed to load test functional behavior and measure performance.

http://jmeter.apache.org/


## Installation

### ubuntu
`sudo apt-get install jmeter`

### OSX

`brew install jmeter --with-plugins`

To open the GUI
`open /usr/local/bin/jmeter`

JMeter load tests are XML files. The ruby-jmeter DSL facilitatles test plan creation
using ruby.

https://github.com/flood-io/ruby-jmeter

### Runing the testplan

ruby path/to/testplan.rb

Also, there is a rake task to generate test plan and run the test.

`bundle exec rake benchmark:run_testplan path/to/testplan.rb`

### Reports

@TODO Rake task to generate reports

`bundle exec rake benchmark:generate_report pluginType path/to/results/file.rb`

## Example

See benchmark/296_cache/testplan.rb
5 changes: 5 additions & 0 deletions benchmarks/jmeter/user.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CookieManager.delete_null_cookies=false
CookieManager.save.cookies=true
jmeter.save.saveservice.url=true
jmeter.save.saveservice.requestHeaders=true
jmeter.save.saveservice.autoflush=true
9 changes: 9 additions & 0 deletions lib/tasks/benchmark.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace :benchmark do

desc "Run jmeter test plan and output results"
task :run_testplan, [:filename] => [:environment] do |t, args|
raise "You need to install jmeter, see http://jmeter.apache.org/" if !system('which jmeter')
#raise "Specify full path to ruby-jmeter rb file" if filename.blank?
system('ruby #{filename}')
end
end

0 comments on commit 3e9cfc6

Please sign in to comment.