Skip to content

Instantly share code, notes, and snippets.

@ox
Created March 18, 2012 19:15
Show Gist options
  • Save ox/2079960 to your computer and use it in GitHub Desktop.
Save ox/2079960 to your computer and use it in GitHub Desktop.
ruby_benchmarker for pissing contest
require 'sinatra'
require 'sequel'
# $ gem install thin mysql sequel
# the mysql gem is a MASSIVE pain in the ass, would rather
# use something saner like Postgres or Mongo or Redis
# thin is required, WEBRick is terrible
set :server, :thin
get '/' do
'Hello World'
end
get '/db' do
Sequel.connect('mysql://root@localhost:3306/DB') do |db|
stream do |out|
db[:users].each do |user|
out << user + '\n'
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment