Skip to content

Commit

Permalink
add ruby benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
gregwebs committed Mar 15, 2011
1 parent dc4b6e2 commit 2b9cc31
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 2 deletions.
9 changes: 9 additions & 0 deletions pong/goliath.sh
@@ -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
6 changes: 6 additions & 0 deletions pong/lib.sh
@@ -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
}
2 changes: 1 addition & 1 deletion pong/rack.rb
Expand Up @@ -2,7 +2,7 @@
require 'rack'
class RackApp
def call(env)
Rack::Response.new("PONG").finish
[200, {} ["PONG"]]
end
end
run RackApp.new
6 changes: 6 additions & 0 deletions pong/rack.ru
@@ -0,0 +1,6 @@
class RackApp
def call(env)
[200, {'Content-Type' => 'text/plain'}, "PONG"]
end
end
run RackApp.new
3 changes: 2 additions & 1 deletion pong/goliath.rb → pong/ruby_goliath.rb
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
require 'goliath'

class Hello < Goliath::API
class RubyGoliath < Goliath::API
def response(env)
[200, {}, "PONG"]
end
Expand Down
11 changes: 11 additions & 0 deletions pong/thin.sh
@@ -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
9 changes: 9 additions & 0 deletions pong/unicorn.sh
@@ -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.