I'm finally upgrading one of my apps to Rails 2.3.5 from 2.1. One thing
I've noticed is that I'm getting terrible performance with MySQL under Rails
2.3. The 2.3 version runs 10x slower than the 2.1 version. Same database,
almost the same code, different version of Rails.
Looking at the output from Rails-footnotes, which gives me the time for each
query, after about 20 queries in 2.3, the time for each query jumps to
100ms, instead of 1ms or 2ms. After the first 20, all queries take longer,
until the next request when it starts all over again. Below are the timings
running under 2.3 (I'm only showing the section where the transition
occurs).
*SELECT* (explain <javascript:Footnotes.toggle('qtable_17')> |
trace<javascript:Footnotes.toggle('qtrace_17')>
)
SQL (0.001050s)
SELECT count(*) AS count_all FROM event_registrations WHERE (process_state =
'accepted' AND archived_on IS NULL) AND
(event_registrations.event_workshop_id = 168)
*SELECT* (explain <javascript:Footnotes.toggle('qtable_18')> |
trace<javascript:Footnotes.toggle('qtrace_18')>
)
SQL (0.000953s)
SELECT count(*) AS count_all FROM event_registrations WHERE (process_state =
'pending' AND archived_on IS NULL) AND
(event_registrations.event_workshop_id = 168)
*SELECT* (explain <javascript:Footnotes.toggle('qtable_19')> |
trace<javascript:Footnotes.toggle('qtrace_19')>
)
SQL (0.001084s)
SELECT count(*) AS count_all FROM event_registrations WHERE (process_state =
'waitlisted' AND archived_on IS NULL) AND
(event_registrations.event_workshop_id = 168)
*SELECT* (explain <javascript:Footnotes.toggle('qtable_20')> |
trace<javascript:Footnotes.toggle('qtrace_20')>
)
SQL (0.071566s)
SELECT count(*) AS count_all FROM event_registrations WHERE (process_state =
'rejected' AND archived_on IS NULL) AND
(event_registrations.event_workshop_id = 168)
*SELECT* (explain <javascript:Footnotes.toggle('qtable_21')> |
trace<javascript:Footnotes.toggle('qtrace_21')>
)
SQL (0.069581s)
SELECT count(*) AS count_all FROM event_registrations WHERE (process_state =
'canceled' AND archived_on IS NULL) AND
(event_registrations.event_workshop_id = 168)
*SELECT* (explain <javascript:Footnotes.toggle('qtable_22')> |
trace<javascript:Footnotes.toggle('qtrace_22')>
)
SQL (0.070729s)
SELECT count(*) AS count_all FROM event_registrations WHERE (process_state =
'noshow' AND archived_on IS NULL) AND (event_registrations.event_workshop_id
= 168)
Notice that the 6 queries are basically the same, but after the third one,
the time increases significantly. btw, for this set of data, there are
actually no records that match any of the conditions, so it's not from a
variation in the returned data set.
I'm totally stumped. Is there some new setting in ActiveRecord that could
cause this? I can't debug my app - it takes between 20 and 80 seconds to
load a page, based on the data. Under Rails 2.1, it's never more than 10
seconds.
I hope someone has an idea.
Thanks,
Brett
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en.