Permalink
Browse files

Add quicky ab(8) wrapper

  • Loading branch information...
evanphx committed Dec 1, 2011
1 parent bcdd535 commit 60a5478310c99e315735d7d2c8de22be3b790523
Showing with 22 additions and 0 deletions.
  1. +22 −0 test/ab_rs.rb
View
@@ -0,0 +1,22 @@
+url = ARGV.shift
+count = (ARGV.shift || 1000).to_i
+
+STDOUT.sync = true
+
+1.upto(5) do |i|
+ print "#{i}: "
+ str = `ab -n #{count} -c #{i} #{url} 2>/dev/null`
+
+ rs = /Requests per second:\s+([\d.]+)\s/.match(str)
+ puts rs[1]
+end
+
+puts "Keep Alive:"
+
+1.upto(5) do |i|
+ print "#{i}: "
+ str = `ab -n #{count} -k -c #{i} #{url} 2>/dev/null`
+
+ rs = /Requests per second:\s+([\d.]+)\s/.match(str)
+ puts rs[1]
+end

0 comments on commit 60a5478

Please sign in to comment.