简体   繁体   中英

How can I figure out why my JRuby rails app takes too long to serve a page?

I'm using Tomcat to hold my rails application, but I found it took too long to serve a request for example:

Completed 200 OK in 11141ms (Views: 204.0ms | ActiveRecord: 218.0ms)

I'm wondering why it took about 11 seconds to complete the request. Views and ActiveRecord just took 400ms, what was rails doing in other 10 seconds?

There is no better way to debug performance problems than using a profiler. Yes, you can probably get away with logging stuff but it's painful to set up and it's not always possible, especially when problems are not in your code but someone else's. There's also BTrace but you need to know lots of internals which is time consuming and unnecessary.

So grab a profiler, run Tomcat and see for yourself. I prefer YourKit which costs $$$, but there's VisualVM which is free.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM