Skip to content

christiannelson/humongous

Repository files navigation

== Welcome to Humongous

This application is a little experiment to see what all the fuss over mongo db is about.

== Installing MongoDB on Mac OS X

This application requires mongod to be installed and running on localhost.  Thankfully
this is quite easy if you're using port (or brew).  I use port and this is what it takes:

$ sudo port install mongodb

Now, if you want to configure mongo to automatically start-up and run in the background,
it's pretty easy.  Check out the files referred to in http://gist.github.com/543411.
There's a mongod.conf file that should live in /opt/local/etc and the OS X
startup plist (org.mongodb.mongod.plist) which belongs in
Library/LaunchDaemons/org.mongodb.mongod.plist.  Then:

$ sudo launchctl load /Library/LaunchDaemons/org.mongodb.mongod.plist

Mongo should be running, check out http://localhost:28017/ to see if it is.

== Fabricated Data

There's no real good way to add new data to this application as a user, but the seed.rb
script will populate mongo with 50 inspections (the primary domain object in this
application).  It also clears out all of the existing data. :)

== Deploying to Heroku

The application will deploy to heroku and is already configured to use MongoHQ once it's
enabled:

$ heroku addons:add mongohq:free

== Benchmarking

If you're going to run any benchmarks against this application, you'll probably want to do
something like this:

$ export MONGOHQ_URL=mongodb://localhost/humongous_production 
$ RAILS_ENV=production && rake db:seed
$ unicorn -E production -c etc/unicorn.conf.rb

This populates the production database and brings up the app with all of the optimizations
you'd expect for production.

Fire up apache bench for the index page:

$ ab -c 10 -n 500 http://0.0.0.0:8080/

Repeat for one of the larger inspection's show action as well.  On my laptop:

c = 10: index 11.7 req/s
c = 10: show  27.0 req/s
c = 1:  index 152.0 ms per request
c = 1:  show  67.4 ms per request

To see how much time it takes to get the data from mongo, I tweaked the controller so
that it would access the inspection (or all inspections for index), but then simply
render a text response and bypass the erbs.  Look here:

c = 10: index 12.8 req/s
c = 10: show  257.5 req/s (holy jesus!)
c = 1:  index 127.6 ms per request
c = 1:  show  6.434 ms per request (and mary too!)

Index isn't much faster, but show is way-way-way faster.  Rendering partials recursively
is brutal in rails (apparently).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published