0

I have a Rails 4 application that returns a large amount of data that is rendered as JSON (23K records/2.8MB document). Testing this call on my laptop using the WEBrick server, the request completes in 573ms.

Completed 200 OK in 573ms (Views: 0.1ms | ActiveRecord: 51.2ms)

If I switch over to Apache with Phusion Passenger the same exact request takes 3025ms to complete.

Completed 200 OK in 3025ms (Views: 0.1ms | ActiveRecord: 53.9ms)

I can't figure out why Passenger would be so much slower. Any thoughts out there?

My development environment is running OS X 10.7.5. I have Apache 2.2.24 and Passenger 4.0.23 installed.

1 Answer 1

1

I would check out

http://dtrace.org/blogs/brendan/2011/10/10/top-10-dtrace-scripts-for-mac-os-x/

and in particular, the section on "dtruss" (#5). Use the -e option for the elapsed times and look at all the system calls that Apache w/ Phusion Passenger is making. What you will hope to find is that the slower route is searching a bunch of extra directories, or loading a bunch of other libraries etc., or making a bunch of strange DNS calls. It is unlikely, as you might guess, that Phusion Passenger is somehow slower at the actual computations. Does the difference scale linearly with the number of records?

Sorry this is not Apache / Phusion Passenger specific...I am not familiar with PP but in my experience, as they are two separate servers, the calls from Apache to Phusion Passenger might be adding more latency than with Webrick since it's integrated. The cool part about dtruss is that you run it against both servers and see which is (more) responsible for the latency. Post the results if you do try this utility, I'm very curious.

Not the answer you're looking for? Browse other questions tagged .