test_socket_helper: Socket#bind may fail with EINVAL if IPv6 is missing
[unicorn.git] / test / benchmark / dd.ru
blob111fa2ed864c97aa8957273fc11731609e234600
1 # This benchmark is the simplest test of the I/O facilities in
2 # unicorn.  It is meant to return a fixed-sized blob to test
3 # the performance of things in Unicorn, _NOT_ the app.
5 # Adjusting this benchmark is done via the "bs" (byte size) and "count"
6 # environment variables.  "count" designates the count of elements of
7 # "bs" length in the Rack response body.  The defaults are bs=4096, count=1
8 # to return one 4096-byte chunk.
9 bs = ENV['bs'] ? ENV['bs'].to_i : 4096
10 count = ENV['count'] ? ENV['count'].to_i : 1
11 slice = (' ' * bs).freeze
12 body = (1..count).map { slice }.freeze
13 hdr = {
14   'Content-Length' => (bs * count).to_s.freeze,
15   'Content-Type' => 'text/plain'.freeze
16 }.freeze
17 response = [ 200, hdr, body ].freeze
18 run(lambda { |env| response })