Skip to content

Instantly share code, notes, and snippets.

@adamlwatson
Created November 15, 2011 18:19
Show Gist options
  • Save adamlwatson/1367854 to your computer and use it in GitHub Desktop.
Save adamlwatson/1367854 to your computer and use it in GitHub Desktop.
Testing throughput bottlenecks in Goliath from Mongoid gem
0. gem install goliath (should be v0.9.4 as of writing this)
1. gem install mongoid (should be v2.3.3 as of writing this)
2. create and save test.rb file (see below)
3. % ruby test.rb -sv
4. % ab -n500 -c10 http://localhost:9000/status
5. note the req/s results (somewhere around 80-90 req/s on my machine)
6. edit the test.rb file, remove the 'require mongoid' line
7. repeat steps 3 and 4.
8. note the req/s results (somewhere aaround 550 req/s on my machine)
Conclusion: Mongoid is patching something in its initialization that is causing severe performance bottlenecks in Goliath.
$:<< '../lib' << 'lib'
require 'goliath'
require 'mongoid'
class HelloWorld < Goliath::API
use Goliath::Rack::Heartbeat
def response(env)
[200, {}, ""]
end
end
@sujal
Copy link

sujal commented Nov 16, 2011

(the short version of what I'm puzzling through is how do I know that MongoDB calls are really async... that's where this all started)

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