Skip to content

Instantly share code, notes, and snippets.

@tongueroo
Created March 26, 2009 22:46
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 tongueroo/86420 to your computer and use it in GitHub Desktop.
Save tongueroo/86420 to your computer and use it in GitHub Desktop.
bleacherreport@ey03-s00338 /data/tung $ cat test_nginx.rb
data = []
50.times do |i|
t1 = Time.now
out = `curl -I -H "Host:bleacherreport.com" localhost/stylesheets/ie7_1238100323.css`
t2 = Time.now
tdiff = t2 - t1
data << tdiff
end
data.sort!
sum = data.inject {|sum, n| sum + n }
puts "average : #{sum / data.size}"
puts "median: #{data[24]}"
puts "max: #{data.max}"
puts "min: #{data.min}"
bleacherreport@ey03-s00338 /data/tung $
##############################
# with haproxy
##############################
bleacherreport@ey03-s00338 /data/tung $ ruby test_nginx.rb
average : 0.0164004
median: 0.016
max: 0.072002
min: 0.008
##############################
# with ey-balancer
##############################
bleacherreport@ey03-s00342 /data/tung $ ruby test_nginx.rb
average : 5.07459592
median: 0.560004
max: 32.164228
min: 0.012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment