Good screencast. I'd like to see more information on how you can optimize things once you narrow down the culprits. Maybe a checklist of 'gotchas' or something like that. Especially any that are common and not well known.
@Carl, I did some previous episodes on optimization, but they don't cover everything so you can expect some more in the future. You can find them out here.
http://railscasts.com/tags/1
I'm able to run a script, but the files don't contain useful numbers. On Ubuntu (32bit), the first column of profile-flat contains a mix of inf and nan. I'll dig into this, but if you have some guidance, it would be greatly appreciated.
I've tried it on 32-bit Vista, 64-bit Ubuntu & 32-bit Ubuntu. They all report some sort of error. On 64-bit Ubuntu, it aborts with an Integer range error. On Vista, it complains that the files (txt & html) don't exist (though I can open them and see listings for all the methods with no timings). On 32bit Ubuntu, it complains twice about "Could not get a file descriptor referring to the console." These last two create files though the content lacks timings.
I had the same problem as everyone above and also failed to get it working with jeremy's gem. I did however get it to work after some investigation.
I took a look at the rails source and it requires ruby-prof 0.6.1. After installing Jeremy's gem I realized it had a slightly different name (jeremy-ruby-prof vs. ruby-prof.) That's probably a github thing but it wasn't satisfying the gem command inside of rails.
So I built the gem from ruby forge source (rake gem, and install manually from the pkg location) and it worked!
gotcha : if you are using this with Rails 2.3.2, the request has been discreetly removed so it won't work, as per http://github.com/rails/rails/commit/41af606db385abe429888c5aca8b2e86c8830c24
To add it again manually, follow the instructions at: http://github.com/rails/request_profiler/tree/master
Good luck and thanks again to Ryan for these great contributions!
Wow, lots of spam above. Anyway, I just came across this and it was great because I was trying to figure out what all of that data was in the profiling trace and how to use it. I also thought I'd share that you can install:
sudo gem install newrelic_rpm
sudo gem install ruby-prof
- add a config/newrelic.yml file, which you can get by singing up for a free/lite newrelic account
- start up your app and click around
or
- go to http://127.0.0.1:3000/newrelic/ and click 'start profiling' then click around and go back to http://127.0.0.1:3000/newrelic/ to see the profiling traces
Here's a link for the newrelic developer mode stuff http://support.newrelic.com/kb/docs/developer-mode
I came to this cast by looking for benchmark tests with rspec, and I was wondering if a chapter on rspec testing and benchmarking apis would be in your plans, if not then I guess this is a suggestion...
Good screencast. I'd like to see more information on how you can optimize things once you narrow down the culprits. Maybe a checklist of 'gotchas' or something like that. Especially any that are common and not well known.
Great screencast! Thank you very much for all this great information.
Thanks
Eddie Moses
Little typo detected
should be:
sudo gem install ruby-prof
Great podcast, thanks for the info
@Sam:
its ruby-perf only. (perf => performance)
Nice screencast. I really need to measure performance issues of my app and tutorials like this are of great help. :)
@Carl, I did some previous episodes on optimization, but they don't cover everything so you can expect some more in the future. You can find them out here.
http://railscasts.com/tags/1
@Sam, thanks. Fixed.
Hey Ryan, Passenger (mod_rails) is looking for someone to redo there screencast before they release. I think you would be the perfect person for it.
check it out here...
http://izumi.plan99.net/blog/
@Taylor, thanks for the link. I'll look into doing it. :)
I'm able to run a script, but the files don't contain useful numbers. On Ubuntu (32bit), the first column of profile-flat contains a mix of inf and nan. I'll dig into this, but if you have some guidance, it would be greatly appreciated.
I've tried it on 32-bit Vista, 64-bit Ubuntu & 32-bit Ubuntu. They all report some sort of error. On 64-bit Ubuntu, it aborts with an Integer range error. On Vista, it complains that the files (txt & html) don't exist (though I can open them and see listings for all the methods with no timings). On 32bit Ubuntu, it complains twice about "Could not get a file descriptor referring to the console." These last two create files though the content lacks timings.
How do you get ruby-prof installed under osx? I've tried under both Tiger and Leopard and I get
No definition for prof_get_cpu_frequency
No definition for prof_set_cpu_frequency
on both
I get the same message No definition for prof_get_cpu_frequency both under OS X (Leopard) & Linux (CentOS 5).
When I run the request script I get following:
Warming up once
0.03 sec, 1 requests, 29 req/sec
Profiling 100x
`gem install ruby-prof` to use the profiler
same here... maybe a gems 1.2 issue
Only thing i found is this:
Please use Jeremy Kamper's ruby-prof :http://github.com/jeremy/ruby-prof/tree/master
gem sources -a http://gems.github.com
sudo gem install jeremy-ruby-prof
but does not work for me either...
I had the same problem as everyone above and also failed to get it working with jeremy's gem. I did however get it to work after some investigation.
I took a look at the rails source and it requires ruby-prof 0.6.1. After installing Jeremy's gem I realized it had a slightly different name (jeremy-ruby-prof vs. ruby-prof.) That's probably a github thing but it wasn't satisfying the gem command inside of rails.
So I built the gem from ruby forge source (rake gem, and install manually from the pkg location) and it worked!
Thanks Sean!! that fixed it for me too.
For integration testing you can define session[:user] by adding a second hash, for the session.
get "users/1/edit", {}, {:user_id => 1}
... but this doesn't seem to work for profiling, for some reason.
gotcha : if you are using this with Rails 2.3.2, the request has been discreetly removed so it won't work, as per http://github.com/rails/rails/commit/41af606db385abe429888c5aca8b2e86c8830c24
To add it again manually, follow the instructions at: http://github.com/rails/request_profiler/tree/master
Good luck and thanks again to Ryan for these great contributions!
I need graph gem.what should i use for graph.Please tell me which gem is available for graph.
Thanks,
Manish Kumar
Wow, lots of spam above. Anyway, I just came across this and it was great because I was trying to figure out what all of that data was in the profiling trace and how to use it. I also thought I'd share that you can install:
sudo gem install newrelic_rpm
sudo gem install ruby-prof
- add a config/newrelic.yml file, which you can get by singing up for a free/lite newrelic account
- start up your app and click around
or
- go to http://127.0.0.1:3000/newrelic/ and click 'start profiling' then click around and go back to http://127.0.0.1:3000/newrelic/ to see the profiling traces
Here's a link for the newrelic developer mode stuff http://support.newrelic.com/kb/docs/developer-mode
Greg
I came to this cast by looking for benchmark tests with rspec, and I was wondering if a chapter on rspec testing and benchmarking apis would be in your plans, if not then I guess this is a suggestion...
Awesome screencasts as always, thank you!