Permalink
Browse files

First commit

  • Loading branch information...
0 parents commit e8a8103e60d62e19d62a0f14e260e322512b122b @topfunky committed Jan 28, 2008
Showing with 413 additions and 0 deletions.
  1. +12 −0 History.txt
  2. +6 −0 Manifest.txt
  3. +101 −0 README.txt
  4. +16 −0 Rakefile
  5. +95 −0 bin/bong
  6. +183 −0 lib/bong.rb
@@ -0,0 +1,12 @@
+== 0.0.2 / ???
+
+* ???
+
+== 0.0.1 / 2007-11-07
+
+* First release. See README.txt for the details.
+
+== TODO
+
+* Compare multiple benchmarking runs and generate a report.
+* Generate Gruff graphs or an HTML report.
@@ -0,0 +1,6 @@
+History.txt
+Manifest.txt
+README.txt
+Rakefile
+bin/bong
+lib/bong.rb
@@ -0,0 +1,101 @@
+bong
+ by Geoffrey Grosenbach
+ boss@topfunky.com
+ http://topfunky.com
+
+== DESCRIPTION:
+
+Hit your website with bong. Uses httperf to run a suite of benchmarking tests against specified urls on your site.
+
+Graphical output and multi-test comparisons are planned. Apache ab support may be added in the future.
+
+== USAGE
+
+See all options with:
+
+ % bong --help
+
+Generate a config file (writes to config/httperf.yml by default):
+
+ % bong --generate
+
+Edit the config file with a list of servers, urls, and your preferred sample size. NOTE: Don't run this against servers you don't own!
+
+ ---
+ uris:
+ - /
+ - /pages/about
+ samples: 2
+ servers:
+ - localhost:3000
+
+Run the benchmarking suite, label it 'baseline', and output the raw data to a file (writes output to log/httperf-report.yml by default):
+
+ % bong baseline
+
+A report will be printed to the screen and the raw data will be saved to log/httperf-report.yml (change with the --out option). It's a good idea to use a label for each test so you can compare them later and find out what the fastest implementation was. Examples: 'baseline', 'memcached-optimization', 'sql-queries', etc.
+
+ baseline
+ localhost
+ / 37-56 req/sec
+ /products.rss 395-403 req/sec
+ example.com
+ / 35-58 req/sec
+ /products.rss 400-407 req/sec
+
+View the saved report again with:
+
+ % bong baseline -r log/httperf-report.yml
+
+Lather, rinse, repeat.
+
+== LIMITATIONS
+
+* Can't access pages that require login.
+* HTTP GET only.
+
+== REQUIREMENTS
+
+The httperf command-line tool must be installed. Get it here:
+
+ http://www.hpl.hp.com/research/linux/httperf/download.php
+
+You must start a webserver (or just Mongrel). Ideally, this would be on a different machine over a fast network. You can also run bong against the local machine or (less ideally) against a remote machine over a slow network, but these will give different performance numbers and may not be accurate.
+
+Internally, bong will
+
+* Run a short series of 5 hits against a URL.
+* Calculate the number of hits needed to run for 10 seconds, or 2 samples. You can change this in the config file, but 2 is the minimum for getting a meaningful standard deviation out of the report.
+* A test will be run again.
+* A short report will be displayed and the raw data will be saved for later comparison.
+
+See http://peepcode.com/products/benchmarking-with-httperf for a full tutorial on httperf (produced by Geoffrey Grosenbach, technical editing by Zed Shaw).
+
+== INSTALL:
+
+* sudo gem install bong
+
+== LICENSE:
+
+(The MIT License)
+
+Copyright (c) 2007 Topfunky Corporation
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,16 @@
+require 'rubygems'
+
+require 'hoe'
+require './lib/bong.rb'
+
+Hoe.new('bong', Bong::VERSION) do |p|
+ p.rubyforge_name = 'bong'
+ p.author = 'Geoffrey Grosenbach'
+ p.email = 'boss@topfunky.com'
+ p.summary = 'Website benchmarking helper.'
+ p.description = p.paragraphs_of('README.txt', 1..2).join("\n\n")
+ p.url = "http://rubyforge.org/projects/bong"
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
+
+ p.remote_rdoc_dir = '' # Release to root
+end
@@ -0,0 +1,95 @@
+#!/usr/bin/env ruby
+
+##
+# Created on 2007-11-6.
+# Copyright (c) 2007 Topfunky Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+begin
+ require "rubygems"
+ require "bong"
+rescue LoadError
+ require File.dirname(__FILE__) + "/../lib/bong"
+end
+
+require 'optparse'
+
+OPTIONS = {
+ :config => 'config/httperf.yml',
+ :generate => 'config/httperf.yml',
+ :out => "log/httperf-report.yml"
+}
+MANDATORY_OPTIONS = %w( )
+
+parser = OptionParser.new do |opts|
+ opts.banner = <<-BANNER
+ A benchmarking tool for staging hits on your website. Uses httperf.
+
+ Usage: #{File.basename($0)} [label] [options]
+
+ label is a name for this benchmarking run.
+ Examples: 'baseline', 'with-optimizations', 'custom-sql-queries'
+
+ Other options are:
+ BANNER
+
+ opts.separator ""
+
+ opts.on("-c", "--config [PATH]", String, "Path to config file.", "Default: config/httperf.yml") do |v|
+ OPTIONS[:config] = v || OPTIONS[:config]
+ end
+
+ opts.on("-g", "--generate [PATH]", String, "Generate a config file.", "Default: config/httperf.yml") do |v|
+ Bong.generate(v || OPTIONS[:generate]); exit
+ end
+
+ opts.on("-o", "--out [PATH]", String, "Write output to a file.", "Default: log/httperf-report.yml") do |v|
+ OPTIONS[:out] = v || OPTIONS[:out]
+ end
+
+ opts.on("-r", "--report PATH", String, "Display the report for a data file.") do |v|
+ OPTIONS[:report] = v
+ end
+
+ opts.on("-h", "--help", "Show this help message.") { puts opts; exit }
+
+ opts.parse!(ARGV)
+
+ if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
+ puts opts; exit
+ end
+
+ OPTIONS[:label] = ARGV.first || "benchmark-#{Time.now.to_i}"
+
+end
+
+# Finally, run the app.
+
+bong = Bong.new(OPTIONS[:config], OPTIONS[:label])
+
+if OPTIONS[:report]
+ bong.load_report(OPTIONS[:report])
+else
+ bong.run
+ bong.save_report(OPTIONS[:out])
+end
+
+puts bong.report
Oops, something went wrong.

0 comments on commit e8a8103

Please sign in to comment.