Skip to content

@mattetti /gist:1d3e432cd9bc237528b0 secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
1. generate the app:
merb-gen app pooltesting --orm datamapper
2. add the setup string to config/environments/development.rb
Merb::BootLoader.after_app_loads do
DataMapper.setup(:default, 'mysql://root@localhost/test')
end
3. generate a resource
merb-gen resource tester
4. add route to config/router.rb:
resources :testers
5. define model in tester.rb
property :id, Serial, :key => true
property :name, String
6. automigrate
rake dm:db:automigrate
7. add some data
$ merb -i
Tester.create(:name => "mattetti")
8. start the merb cluster
$ merb -c2 -n
9. test with a browser
http://localhost:4000/testers/
FAIL undefined method `link_to' for #<Testers:0x1212784>
10. edit init.rb
uncomment dependency "merb-assets"
11. restart the server
$ ctrl + c
$ merb -c2 -n
12. browser testing
http://localhost:4000/testers/
13. put under load
$ ab -c 2 -n 5000 http://0.0.0.0:4000/testers/ (in a different shell)
14. change a model
in your editor save the model a few times (10-15 times in a row)
15. look at merb console:
merb: worker (port 4000) ~ Starting Mongrel at port 4000
merb: worker (port 4000) ~ Couldn't bind to port 4000.
merb: worker (port 4000) ~ Waiting for it to become available
Fri Oct 03 18:23:53 -0700 2008: Reaping 1 threads for slow workers because of 'shutdown'
Waiting for 1 requests to finish, could take 60.0 seconds.
Fri Oct 03 18:23:59 -0700 2008: Reaping 1 threads for slow workers because of 'shutdown'
Waiting for 1 requests to finish, could take 60.0 seconds.
Fri Oct 03 18:24:05 -0700 2008: Reaping 1 threads for slow workers because of 'shutdown'
Waiting for 1 requests to finish, could take 60.0 seconds.
Fri Oct 03 18:24:11 -0700 2008: Reaping 1 threads for slow workers because of 'shutdown'
Waiting for 1 requests to finish, could take 60.0 seconds.
Fri Oct 03 18:24:17 -0700 2008: Reaping 1 threads for slow workers because of 'shutdown'
Waiting for 1 requests to finish, could take 60.0 seconds.
Fri Oct 03 18:24:23 -0700 2008: Reaping 1 threads for slow workers because of 'shutdown'
Waiting for 1 requests to finish, could take 60.0 seconds.
Fri Oct 03 18:24:29 -0700 2008: Reaping 1 threads for slow workers because of 'shutdown'
Waiting for 1 requests to finish, could take 60.0 seconds.
Fri Oct 03 18:24:35 -0700 2008: Reaping 1 threads for slow workers because of 'shutdown'
Waiting for 1 requests to finish, could take 60.0 seconds.
merb: worker (port 4000) ~ Exiting port 4000
merb: worker (port 4000) ~ Successfully bound to port 4000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.