How can I profile a Rails app in its entirety, not

2019-04-14 01:31发布

问题:

Possible Duplicate:
What tools do you recommend to profile Rails apps?

My rails app is taking ~2 seconds to respond to POST requests, and I can't figure out why. When I use traditional profiling tools like newrelic or things that hook into unit tests, they tell me that all of my requests are fast, taking under 20 ms. But when I actually time the requests, they are taking 2 seconds. GET requests are fast. This happens in both development and production mode, using mongrel. So my suspicion is that some gem is doing needless work. How can I track this down? If this was some other sort of server rather than Rails, I would just profile the running server, but the Rails profiling solutions all seem to just profile the controller code.

回答1:

The well know ruby-prof may help you. The config.ru file of your rails app will give you some hints on running the app manually.

For other alternatives take a look at this question.