Skip to content

Instantly share code, notes, and snippets.

@jodosha
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jodosha/42a954b5ea3fcfc063f9 to your computer and use it in GitHub Desktop.
Save jodosha/42a954b5ea3fcfc063f9 to your computer and use it in GitHub Desktop.
Lotus wrk benchmarks

Action

Lotus    (22.ru)  5018.70 req/s
Sinatra  (04.ru)  2922.74 req/s
Rails    (02.ru)  1148.16 req/s

Template

Lotus    (24.ru)  4175.90 req/s
Sinatra  (05.ru)  2207.73 req/s
Rails    (03.ru)  1027.73 req/s
require 'rack'
class HelloWorld
def call(env)
[200, {}, ['Hello World!']]
end
end
run HelloWorld.new
__END__
Running 10s test @ http://localhost:9292/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.76ms 3.97ms 23.92ms 96.32%
Req/Sec 4.83k 1.20k 6.22k 90.90%
90911 requests in 10.00s, 4.42MB read
Requests/sec: 9091.41
Transfer/sec: 452.81KB
require 'rails'
require 'action_controller/railtie'
require 'action_view/railtie'
class HelloWorld < Rails::Application
routes.append do
root 'hello#world'
end
config.cache_classes = true
config.eager_load = true
config.secret_key_base = '49837489qkuweoiuoqwehisuakshdjksadhaisdy78o34y138974xyqp9rmye8yrpiokeuioqwzyoiuxftoyqiuxrhm3iou1hrzmjk'
['Rack::Lock', 'ActionDispatch::Flash', 'ActionDispatch::BestStandardsSupport',
'Rack::Sendfile', 'ActionDispatch::Static', 'Rack::MethodOverride',
'ActionDispatch::RequestId', 'Rails::Rack::Logger',
'ActionDispatch::ShowExceptions', 'ActionDispatch::DebugExceptions',
'ActionDispatch::RemoteIp', 'ActionDispatch::Callbacks',
'ActionDispatch::Cookies', 'ActionDispatch::Session::CookieStore',
'ActionDispatch::ParamsParser', 'Rack::Head', 'Rack::ConditionalGet',
'Rack::ETag'].each do |middleware|
config.middleware.delete(middleware)
end
end
class HelloController < ActionController::Base
def world
render text: 'Hello World!'
end
end
run HelloWorld.initialize!
__END__
Compare with:
* 04_sinatra_action.ru
* 22_action.ru
Running 10s test @ http://localhost:9292/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 8.76ms 1.66ms 24.59ms 97.63%
Req/Sec 590.51 63.55 777.00 80.04%
11482 requests in 10.00s, 2.46MB read
Requests/sec: 1148.16
Transfer/sec: 252.30KB
require 'rails'
require 'action_controller/railtie'
require 'action_view/railtie'
class HelloWorld < Rails::Application
routes.append do
root 'hello#world'
end
config.cache_classes = true
config.eager_load = true
config.secret_key_base = '49837489qkuweoiuoqwehisuakshdjksadhaisdy78o34y138974xyqp9rmye8yrpiokeuioqwzyoiuxftoyqiuxrhm3iou1hrzmjk'
['Rack::Lock', 'ActionDispatch::Flash', 'ActionDispatch::BestStandardsSupport',
'Rack::Sendfile', 'ActionDispatch::Static', 'Rack::MethodOverride',
'ActionDispatch::RequestId', 'Rails::Rack::Logger',
'ActionDispatch::ShowExceptions', 'ActionDispatch::DebugExceptions',
'ActionDispatch::RemoteIp', 'ActionDispatch::Callbacks',
'ActionDispatch::Cookies', 'ActionDispatch::Session::CookieStore',
'ActionDispatch::ParamsParser', 'Rack::Head', 'Rack::ConditionalGet',
'Rack::ETag'].each do |middleware|
config.middleware.delete(middleware)
end
end
class HelloController < ActionController::Base
prepend_view_path 'views'
def world
end
end
run HelloWorld.initialize!
__END__
Compare with:
* 05_sinatra_template.ru
* 24_template.ru
Running 10s test @ http://localhost:9292/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 9.77ms 1.82ms 27.97ms 97.56%
Req/Sec 527.48 60.52 666.00 81.74%
10277 requests in 10.00s, 2.22MB read
Requests/sec: 1027.73
Transfer/sec: 226.82KB
require 'sinatra/base'
class HelloWorld < Sinatra::Base
get '/' do
'Hello World!'
end
end
__END__
Compare with:
* 02_rails_action.ru
* 22_action.ru
Running 10s test @ http://localhost:9292/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 10.45ms 26.69ms 109.83ms 93.01%
Req/Sec 1.55k 457.93 2.33k 90.78%
29226 requests in 10.00s, 5.16MB read
Requests/sec: 2922.74
Transfer/sec: 528.05KB
require 'sinatra/base'
class HelloWorld < Sinatra::Base
get '/' do
erb :greet
end
end
run HelloWorld
__END__
Compare with:
* 03_rails_template.ru
* 24_template.ru
Running 10s test @ http://localhost:9292/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 10.98ms 26.25ms 112.94ms 93.66%
Req/Sec 1.16k 332.06 1.67k 88.57%
22077 requests in 10.00s, 3.92MB read
Requests/sec: 2207.73
Transfer/sec: 401.06KB
require 'lotus/router'
run Lotus::Router.new {
get '/', to: ->(env) { [200, {}, ['Hello World!']] }
}
__END__
Running 10s test @ http://localhost:9292/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 3.88ms 11.58ms 58.22ms 94.78%
Req/Sec 3.79k 1.01k 5.11k 90.85%
71393 requests in 10.00s, 3.47MB read
Requests/sec: 7139.26
Transfer/sec: 355.58KB
require 'lotus/controller'
class Greet
include Lotus::Action
def call(params)
self.body = 'Hello World!'
end
end
run Greet.new
__END__
Running 10s test @ http://localhost:9292/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 5.50ms 16.25ms 74.22ms 93.63%
Req/Sec 3.33k 0.97k 4.55k 89.41%
62786 requests in 10.00s, 5.45MB read
Requests/sec: 6278.59
Transfer/sec: 557.98KB
require 'lotus'
module OneFile
class Application < Lotus::Application
configure do
routes do
get '/', to: ->(env) {[200, {}, ['Hello World!']]}
end
end
end
end
run OneFile::Application.new
__END__
Running 10s test @ http://localhost:9292/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 2.22ms 4.36ms 26.15ms 96.00%
Req/Sec 3.62k 0.87k 4.67k 91.38%
68250 requests in 10.00s, 3.32MB read
Requests/sec: 6825.26
Transfer/sec: 339.93KB
require 'lotus'
module OneFile
class Application < Lotus::Application
configure do
routes do
get '/', to: 'home#index'
end
end
load!
end
module Controllers
module Home
include OneFile::Controller
action 'Index' do
def call(params)
self.body = 'Hello World!'
end
end
end
end
end
run OneFile::Application.new
__END__
Compare with:
* 02_rails.ru
* 04_sinatra_action.ru
Running 10s test @ http://localhost:9292/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 4.39ms 9.61ms 41.85ms 93.14%
Req/Sec 2.66k 773.93 3.67k 89.88%
50188 requests in 10.00s, 3.64MB read
Requests/sec: 5018.70
Transfer/sec: 372.50KB
require 'lotus'
module OneFile
class Application < Lotus::Application
configure do
routes do
get '/', to: 'home#index'
end
end
load!
end
module Controllers
module Home
include OneFile::Controller
action 'Index' do
def call(params)
end
end
end
end
module Views
module Home
class Index
include Lotus::View
def render
'Hello World!'
end
end
end
end
end
run OneFile::Application.new
__END__
Running 10s test @ http://localhost:9292/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 7.80ms 22.31ms 97.10ms 93.44%
Req/Sec 2.36k 684.31 3.33k 89.94%
44474 requests in 10.00s, 3.22MB read
Requests/sec: 4447.57
Transfer/sec: 330.12KB
require 'lotus'
module OneFile
class Application < Lotus::Application
configure do
templates __dir__
routes do
get '/', to: 'home#index'
end
end
load!
end
module Controllers
module Home
include OneFile::Controller
action 'Index' do
def call(params)
end
end
end
end
module Views
module Home
class Index
include Lotus::View
template 'home/index'
end
end
end
end
run OneFile::Application.new
__END__
Compare with:
* 03_rails_template.ru
* 05_sinatra_template.ru
Running 10s test @ http://localhost:9292/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 9.28ms 26.30ms 107.81ms 93.19%
Req/Sec 2.22k 635.54 3.11k 90.94%
41759 requests in 10.00s, 3.07MB read
Requests/sec: 4175.90
Transfer/sec: 314.01KB
require 'lotus'
module OneFile
class Application < Lotus::Application
configure do
templates __dir__
routes do
get '/', to: 'home#index'
end
end
load!
end
module Controllers
module Home
include OneFile::Controller
action 'Index' do
expose :planet
def call(params)
@planet = 'World'
end
end
end
end
module Views
module Home
class Index
include Lotus::View
template 'home/index'
end
end
end
end
run OneFile::Application.new
__END__
Running 10s test @ http://localhost:9292/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 9.91ms 28.00ms 113.16ms 93.01%
Req/Sec 2.19k 633.35 3.11k 91.15%
41132 requests in 10.00s, 3.02MB read
Requests/sec: 4113.10
Transfer/sec: 309.31KB
source 'https://rubygems.org'
gem 'lotusrb', github: 'lotus/lotus'
gem 'sinatra'
gem 'rails'
gem 'puma'

Installation

bundle install

Start the server

bundle exec puma -e production -t 16:16 <file>.ru

Run the benchmark

wrk -t 2 http://localhost:9292/
@lappi-lynx
Copy link

@jodosha, do you have an actual benchmark for lotus 0.3.0?
I cannot run 22.ru file because I have undefined methodaction' for OneFile::Controllers::Home:Module`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment