From 98ea5cca50b907e20d6357f425d7789bac1d1a47 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 10 Mar 2009 18:44:34 -0700 Subject: All new benchmarks, old ones removed dd.ru is a rackup file is intended as a dd(1)-like test for I/O performance. There are also individual request, response, and big_request benchmarks for micro benchmarking some parts of Unicorn. The rest of the benchmarks are gone: I am not interested in performance comparisons (and pissing matches) with other web servers (or their fanboys/girls). I will _NEVER_ publically publish benchmarks comparing Unicorn against other web servers. I will only compare Unicorn against other versions of Unicorn, possibly on different platforms. Neutral third-parties are invited to publish their own benchmarks (along with detailed procedures, version numbers and other details) comparing Unicorn to other servers. Signed-off-by: Eric Wong --- test/benchmark/response.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/benchmark/response.rb (limited to 'test/benchmark/response.rb') diff --git a/test/benchmark/response.rb b/test/benchmark/response.rb new file mode 100644 index 0000000..95291f1 --- /dev/null +++ b/test/benchmark/response.rb @@ -0,0 +1,29 @@ +require 'benchmark' +require 'unicorn' + +class NullWriter + def syswrite(buf); buf.size; end + def close; end +end + +include Unicorn + +socket = NullWriter.new +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, + 'Content-Type' => 'text/plain'.freeze +}.freeze +response = [ 200, hdr, body ].freeze + +nr = ENV['nr'] ? ENV['nr'].to_i : 100000 +Benchmark.bmbm do |x| + x.report do + for i in 1..nr + HttpResponse.write(socket.dup, response) + end + end +end -- cgit v1.2.3-24-ge0c7 From 018f827ebdc1668d2262ef1337386f896379e0f6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 22 Mar 2009 20:52:00 -0700 Subject: benchmark: header values must be strings Newer versions of Unicorn "enforce" this by splitting on "\n" to handle Rack-style multi-value headers. --- test/benchmark/response.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/benchmark/response.rb') diff --git a/test/benchmark/response.rb b/test/benchmark/response.rb index 95291f1..0ff0ac2 100644 --- a/test/benchmark/response.rb +++ b/test/benchmark/response.rb @@ -14,7 +14,7 @@ count = ENV['count'] ? ENV['count'].to_i : 1 slice = (' ' * bs).freeze body = (1..count).map { slice }.freeze hdr = { - 'Content-Length' => bs * count, + 'Content-Length' => (bs * count).to_s.freeze, 'Content-Type' => 'text/plain'.freeze }.freeze response = [ 200, hdr, body ].freeze -- cgit v1.2.3-24-ge0c7