Skip to content

Commit 032bdce

Browse files
committed
FIX: bench script is not working on OS X
1 parent b6e6637 commit 032bdce

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

script/bench.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ def prereqs
5757
ENV["RUBY_HEAP_MIN_SLOTS"] = "800000"
5858
ENV["RUBY_FREE_MIN"] = "600000"
5959

60-
6160
def port_available? port
62-
server = TCPServer.open port
61+
server = TCPServer.open("0.0.0.0", port)
6362
server.close
6463
true
6564
rescue Errno::EADDRINUSE
@@ -86,9 +85,9 @@ def port_available? port
8685

8786
def bench(path)
8887
puts "Running apache bench warmup"
89-
`ab -n 100 http://localhost:#{@port}#{path}`
88+
`ab -n 100 http://127.0.0.1:#{@port}#{path}`
9089
puts "Benchmarking #{path}"
91-
`ab -n 100 -e tmp/ab.csv http://localhost:#{@port}#{path}`
90+
`ab -n 100 -e tmp/ab.csv http://127.0.0.1:#{@port}#{path}`
9291

9392
percentiles = Hash[*[50, 75, 90, 99].zip([]).flatten]
9493
CSV.foreach("tmp/ab.csv") do |percent, time|
@@ -105,6 +104,8 @@ def bench(path)
105104
sleep 1
106105
end
107106

107+
puts "Starting benchmark..."
108+
108109
home_page = bench("/")
109110
topic_page = bench("/t/oh-how-i-wish-i-could-shut-up-like-a-tunnel-for-so/69")
110111

0 commit comments

Comments
 (0)