Skip to content

Instantly share code, notes, and snippets.

@fl00r
Created November 25, 2012 17:27
Show Gist options
  • Save fl00r/4144442 to your computer and use it in GitHub Desktop.
Save fl00r/4144442 to your computer and use it in GitHub Desktop.
# config.ru
module Server
def self.call(env)
body = File.read("index.html")
[200, { "Content-Type" => "text/html", "Content-Length" => body.bytesize.to_s }, [body]]
end
end
run Server
# rainbows.rb
worker_processes 1
Rainbows! do
worker_connections 1000
use :EventMachine
keepalive_requests 1000
keepalive_timeout 10
end
# in your shell
# install rainbows
gem install rainbows
# fire it
rainbows -c rainbows.rb -E production
./wrk -c32 -r10000 http://0.0.0.0:8080/
# I've got this
#=> Requests/sec: 13692.03
# Then you can add some CPU :) by changing `worker_processes` in rainbows.rb
# On my two core CPU with 2 workers I've got
#=> Requests/sec: 23642.73
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment