Permalink
Browse files

add ruby benchmarks

  • Loading branch information...
1 parent dc4b6e2 commit 2b9cc31b2d96d4ca2ee3c1aaa3e57f37d139275e @gregwebs gregwebs committed Mar 15, 2011
Showing with 44 additions and 2 deletions.
  1. +9 −0 pong/goliath.sh
  2. +6 −0 pong/lib.sh
  3. +1 −1 pong/rack.rb
  4. +6 −0 pong/rack.ru
  5. +2 −1 pong/{goliath.rb → ruby_goliath.rb}
  6. +11 −0 pong/thin.sh
  7. +9 −0 pong/unicorn.sh
View
@@ -0,0 +1,9 @@
+#!/bin/bash -x
+DIR="$( cd "$( dirname "$0" )" && pwd )"
+d=$(readlink -f $DIR)
+source lib.sh
+
+rvm use 1.9.2
+ruby ruby_goliath.rb -e production -p 3000 &
+
+benchmark
View
@@ -0,0 +1,6 @@
+benchmark(){
+ sleep 1
+ nx=$!
+ httperf --hog --server=localhost --port=3000 --uri=/ --rate=1000 --num-conns=200 --num-calls=100 --burst-length=20 > results/`basename $0 .sh`
+ kill $nx
+}
View
@@ -2,7 +2,7 @@
require 'rack'
class RackApp
def call(env)
- Rack::Response.new("PONG").finish
+ [200, {} ["PONG"]]
end
end
run RackApp.new
View
@@ -0,0 +1,6 @@
+class RackApp
+ def call(env)
+ [200, {'Content-Type' => 'text/plain'}, "PONG"]
+ end
+end
+run RackApp.new
@@ -1,6 +1,7 @@
+#!/usr/bin/env ruby
require 'goliath'
-class Hello < Goliath::API
+class RubyGoliath < Goliath::API
def response(env)
[200, {}, "PONG"]
end
View
@@ -0,0 +1,11 @@
+#!/bin/bash -x
+DIR="$( cd "$( dirname "$0" )" && pwd )"
+d=$(readlink -f $DIR)
+source lib.sh
+
+rvm use 1.9.2
+thin -p 3000 -R rack.ru -s 2 start &
+
+benchmark
+
+killall -KILL thin
View
@@ -0,0 +1,9 @@
+#!/bin/bash -x
+DIR="$( cd "$( dirname "$0" )" && pwd )"
+d=$(readlink -f $DIR)
+source lib.sh
+
+rvm use 1.9.2
+unicorn -p 3000 rack.ru &
+
+benchmark

0 comments on commit 2b9cc31

Please sign in to comment.