diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-03-22 20:58:11 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-03-22 20:58:11 -0700 |
commit | f4503b0eb9dd73296988021f355f3d28959975e5 (patch) | |
tree | 5be11934e0ac81d2331d4d5b60693ae77dc94d91 /test/benchmark/dd.ru | |
parent | 78668173ab0e78c5c94fe23b916a81822c24bf9c (diff) | |
parent | 018f827ebdc1668d2262ef1337386f896379e0f6 (diff) | |
download | unicorn-f4503b0eb9dd73296988021f355f3d28959975e5.tar.gz |
* commit 'origin/benchmark': benchmark: header values must be strings All new benchmarks, old ones removed
Diffstat (limited to 'test/benchmark/dd.ru')
-rw-r--r-- | test/benchmark/dd.ru | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/benchmark/dd.ru b/test/benchmark/dd.ru new file mode 100644 index 0000000..111fa2e --- /dev/null +++ b/test/benchmark/dd.ru @@ -0,0 +1,18 @@ +# This benchmark is the simplest test of the I/O facilities in +# unicorn. It is meant to return a fixed-sized blob to test +# the performance of things in Unicorn, _NOT_ the app. +# +# Adjusting this benchmark is done via the "bs" (byte size) and "count" +# environment variables. "count" designates the count of elements of +# "bs" length in the Rack response body. The defaults are bs=4096, count=1 +# to return one 4096-byte chunk. +bs = ENV['bs'] ? ENV['bs'].to_i : 4096 +count = ENV['count'] ? ENV['count'].to_i : 1 +slice = (' ' * bs).freeze +body = (1..count).map { slice }.freeze +hdr = { + 'Content-Length' => (bs * count).to_s.freeze, + 'Content-Type' => 'text/plain'.freeze +}.freeze +response = [ 200, hdr, body ].freeze +run(lambda { |env| response }) |