From 032bdceeef484a8d83fc8d63908597e7c1b4dd1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Sat, 17 Aug 2013 11:36:41 +0200 Subject: [PATCH] FIX: bench script is not working on OS X --- script/bench.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/script/bench.rb b/script/bench.rb index 305b628b2be..37dacb551a6 100644 --- a/script/bench.rb +++ b/script/bench.rb @@ -57,9 +57,8 @@ ENV["RUBY_HEAP_SLOTS_GROWTH_FACTOR"] = "1.25" ENV["RUBY_HEAP_MIN_SLOTS"] = "800000" ENV["RUBY_FREE_MIN"] = "600000" - def port_available? port - server = TCPServer.open port + server = TCPServer.open("0.0.0.0", port) server.close true rescue Errno::EADDRINUSE @@ -86,9 +85,9 @@ run("bundle exec ruby script/profile_db_generator.rb") def bench(path) puts "Running apache bench warmup" - `ab -n 100 http://localhost:#{@port}#{path}` + `ab -n 100 http://127.0.0.1:#{@port}#{path}` puts "Benchmarking #{path}" - `ab -n 100 -e tmp/ab.csv http://localhost:#{@port}#{path}` + `ab -n 100 -e tmp/ab.csv http://127.0.0.1:#{@port}#{path}` percentiles = Hash[*[50, 75, 90, 99].zip([]).flatten] CSV.foreach("tmp/ab.csv") do |percent, time| @@ -105,6 +104,8 @@ begin sleep 1 end + puts "Starting benchmark..." + home_page = bench("/") topic_page = bench("/t/oh-how-i-wish-i-could-shut-up-like-a-tunnel-for-so/69")