Created
March 2, 2011 18:51
-
-
Save funny-falcon/851464 to your computer and use it in GitHub Desktop.
testing sinatra application with results for REE 2010.2 and 1.9.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/sin.rb' | |
run Sinatra::Application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Transactions per second: | |
| /h | /hh | /n | /nh | /s | /sh | /m | /mh | | |
---------------------------------------------------------------- | |
ree | 1108 | 882 | 207 | 106 | 27.9 | 25.1 | 25.3 | 24.9 | | |
ree tuned | 1356 | 1032 | 273 | 133 | 34.5 | 30.9 | 31.3 | 31.1 | | |
1.9.2-p136| 929 | 731 | 293 | 146 | 31.9 | 28.1 | 29.7 | 27.7 | | |
Passenger command line: | |
passenger start -e production --max-pool-size 1 --spawn-method conservative --log-file /dev/null | |
REE tuning: | |
export RUBY_HEAP_MIN_SLOTS=500000 | |
export RUBY_HEAP_SLOTS_INCREMENT=250000 | |
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 | |
export RUBY_GC_MALLOC_LIMIT=50000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'sequel' | |
require 'haml' | |
con = Sequel.connect('postgres://user:login@localhost:5433/testdb') | |
enable :inline_template | |
get '/h' do | |
'hello' | |
end | |
get '/hh' do | |
haml :index | |
end | |
get '/n' do | |
s = '' | |
for i in 1..1000 | |
s << "#{i}" << "\n" | |
end | |
s | |
end | |
get '/nh' do | |
haml :numbers | |
end | |
# users has about 40 rows in a table | |
get '/s' do | |
'<pre>'+ | |
con[:users].all.map do |u| | |
"#{u[:id]}\t#{u[:login]}\t#{u[:first_name]}\t#{u[:ser_name]}" | |
end.join("\n") + | |
'</pre>' | |
end | |
get '/sh' do | |
@users = con[:users].all | |
haml :sequel | |
end | |
class User < Sequel::Model | |
end | |
get '/m' do | |
'<pre>'+ | |
User.all.map do |u| | |
[u.id, u.login, u.first_name, u.ser_name].join("\t") | |
end.join("\n") + | |
'</pre>' | |
end | |
get '/mh' do | |
@users = User.all | |
haml :model | |
end | |
before do | |
content_type 'text/html', :charset => 'utf-8' | |
end | |
__END__ | |
@@ layout | |
%html | |
%body | |
= yield | |
@@ index | |
%h1 Hello | |
@@ numbers | |
- for i in 1..1000 | |
= i | |
@@ sequel | |
%ol | |
- @users.each do |u| | |
%li | |
= "#{u[:id]}\t#{u[:login]}\t#{u[:first_name]}\t#{u[:ser_name]}" | |
@@ model | |
%ol | |
- @users.each do |u| | |
%li | |
= [u.id, u.login, u.first_name, u.ser_name].join("\t") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PORT=$1 | |
PAGES="h hh n nh s sh m mh" | |
for p in $PAGES ; do | |
curl http://localhost:$PORT/$p > /dev/null 2>&1 | |
siege -b -t 1S http://localhost:$PORT/$p > /dev/null 2>&1 | |
done | |
for p in $PAGES ; do | |
#sleep 1 | |
echo "BENCH http://localhost:$PORT/$p" | |
siege -b -t 5S http://localhost:$PORT/$p > /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment