Skip to content

Instantly share code, notes, and snippets.

@nas
Created July 4, 2012 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nas/3047128 to your computer and use it in GitHub Desktop.
Save nas/3047128 to your computer and use it in GitHub Desktop.
Apache Bench
#! /usr/bin/ruby
raise "Provide the dir path" unless ARGV[0] =~ /[a-z]*/
to_dir = ARGV[0].strip
raise "Provide the dir path" if to_dir.nil?
site = 'http://url'
print "Processing home page ... "
system("ab -n 100 -c 10 #{site}/ > benchmark/#{to_dir}/home_page")
puts "Done"
%w{page_1 page_2 page_3}.each do |page|
page_name = page.capitalize.sub('_', ' ')
print "Processing #{page_name} page ... "
system("ab -n 100 -c 10 #{site}/#{page} > benchmark/#{to_dir}/#{page}")
puts "Done"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment