Hi List, I've been struggling with a particular dynamic bit of JSON rendering that's fairly slow on my website. A typical render would be:
Completed 200 OK in *1408ms* (Views: 279.4ms | ActiveRecord: 148.8ms | Sphinx: 0.0ms) The view and ActiveRecord aren't too bad but the total time is awful. Nearly 1.5 seconds. I thought for a while that it might have been my JSON encoding so I added the "yajl-ruby" gem to my Gemfile under the assumption that Rails would pick this up and use it automatically (it uses C bindings instead of pure Ruby for encoding) but it didn't seem to have an effect. I've also bumped my Rails version to 3.0.7, using MySQL in the backend hoping that later point release might have helped. If you want to see the behaviour in action, you can load up: http://beta.knowyourgenre.com and have a play flicking backwards and forwards in the popular genres section down the bottom of the page. You'll also notice that the unpopular genres section, which has no songs, is quite a bit faster, so whatever is causing it is related to the number of songs. I've dumped out a log of the queries etc used to generate that chunk. For all I know that could be the problem but I don't think it is due to AR only report 100ms or so to run. www.richardson.co.nz/render.txt What I'm after here is what should I be looking at for debugging? JSON encoding, slow ActiveRecord or something else? Samuel Richardson www.richardson.co.nz | 0405 472 748 -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
