Permalink
Browse files

httperf benchmarks

  • Loading branch information...
1 parent 5374bba commit 96c06f30b20fb48bb6c3817d8ffa9d5da985befc @tarcieri tarcieri committed Mar 6, 2012
Showing with 46 additions and 7 deletions.
  1. +10 −7 README.md
  2. +11 −0 benchmarks/hello_goliath.rb
  3. +8 −0 benchmarks/hello_node.js
  4. +5 −0 benchmarks/hello_rack.ru
  5. +12 −0 benchmarks/hello_reel.rb
View
@@ -21,15 +21,18 @@ primarily I/O bound, and threads for where you're compute bound.
### Is It Good?
Yes, but it has room for improvement. A "hello world" web server benchmark,
-done on a 2GHz i7 w\ ApacheBench, 64 concurrent connections:
+run on a 2GHz i7 (OS X 10.7.3). All servers used in a single-threaded mode.
+Ruby 1.9.3 was used for all Ruby benchmarks.
```
-Web Server Throughput Latency
----------- ----------- -------
-Reel (HEAD) 5189 reqs/s (6.1 ms/req)
-Goliath (0.9.4) 3495 reqs/s (18.3 ms/req)
-Thin (1.2.11) 8747 reqs/s (7.3 ms/req)
-Node.js (0.6.5) 9023 reqs/s (7.1 ms/req)
+httperf --num-conns=50 --num-calls=1000
+
+Web Server Throughput Latency
+---------- ---------- -------
+Reel (HEAD) 5027 reqs/s (0.2 ms/req)
+Goliath (0.9.4) 2058 reqs/s (0.5 ms/req)
+Thin (1.2.11) 7502 reqs/s (0.1 ms/req)
+Node.js (0.6.5) 11735 reqs/s (0.1 ms/req)
```
All Ruby benchmarks done on Ruby 1.9.3. Latencies given are average-per-request
@@ -0,0 +1,11 @@
+# Run with: ruby hello_goliath.rb -sv -e production
+require 'goliath'
+
+class Hello < Goliath::API
+ # default to JSON output, allow Yaml as secondary
+ use Goliath::Rack::Render, ['json', 'yaml']
+
+ def response(env)
+ [200, {}, "Hello World"]
+ end
+end
View
@@ -0,0 +1,8 @@
+/* Run with: node hello_node.js */
+
+var http = require('http');
+http.createServer(function (req, res) {
+ res.writeHead(200, {'Content-Type': 'text/plain'});
+ res.end('Hello World\n');
+}).listen(1337, "127.0.0.1");
+console.log('Server running at http://127.0.0.1:1337/');
View
@@ -0,0 +1,5 @@
+# Run with: thin -e production -R hello_rack.ru start
+require 'rack'
+
+body = "Hello World"
+run proc { |env| [200, {}, body] }
View
@@ -0,0 +1,12 @@
+require 'rubygems'
+require 'bundler/setup'
+require 'reel'
+
+addr, port = '127.0.0.1', 1234
+
+puts "*** Starting server on #{addr}:#{port}"
+Reel::Server.new(addr, port) do |connection|
+ connection.respond :ok, "Hello World"
+end
+
+sleep

0 comments on commit 96c06f3

Please sign in to comment.