On Thu, Jan 14, 2010 at 10:36 PM, Conrad Taylor <[email protected]> wrote: > Ben, I have the following numbers: > Configuration: Mac OS X 10.5.8 (PowerMac G5 2.5 GHz Quad) > Ruby: 1.9.1p376 > Rails: 2.3.5 with MySQL adapter: > 25000 finds (16.475510) # without Model.transaction ... end > 25000 finds (16.259721) # with Model.transaction do ... end > 25000 creates (35.011375) # with Model.transaction do ... end > 25000 creates (3.031440) # without Model.transaction ... end, using > AR-Extensions to perform a bulk import > Next, if your tests were actually modeling this in a real world scenario, > you would be using the following techniques within your app:
Sorry, I should have explained intent a bit more. Our goal with this test wasn't to model a real world scenario (we're not doing 25,000 creates in the test suite or app obviously). The point is that AR::B.find & AR::B.create certainly appear significantly slower in 2.3.5 than in 2.1.2. > a) ActiveRecord::Extensions for bulk imports > b) Memcached for caching because you shouldn't be performing the same query > that returns the same resultset. For example, if > 100,000 people generated this query, then your database would be hit > 100,000 times instead once. > c) Wrap your bulk operations that can hit the database using > Model.transaction do ... end - because without it a transaction is > being generated for each create operation. > d) Queries may be also concurrent instead of just sequential as they appear > in your example code. Thus, using something like Thanks for these. They're all things we're actually doing in the app already. Of course there are still things which we could optimize more (there always are), but I wanted to find out whether this apparent slow down in AR::B.find & AR::B.create was known. -Ben
-- 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.

