From: khaines@... Date: 2007-03-07T20:24:34+09:00 Subject: Re: High ActiveRecord CPU Utilization On Wed, 7 Mar 2007, Brian Adkins wrote: > When running a test that primarily involves loading up a few MySQL tables > with ActiveRecord objects, I was surprised to see the Ruby CPU utilization at > 93% and the MySQL CPU utilization at 7%. I would expect this workload to be > heavier on MySQL than that. > > I would think inserts (particularly with updating several foreign key > indices) would tax the database more than Ruby. > > Has this been other folks' experience? Is running in the test environment > incredibly different than production with respect to CPU utilization? I > suppose my next step is to run in production to see what kind of results I > get. No, that isn't surprising. Any ORM trades CPU utilization outside of the database for convenience in the data representation. AR is fairly heavyweight in that regard, so it's doing a lot of work to give you the API that it does. Latency to a database can be a significant bottleneck to some applications, but relatively speaking, CPU utilization by the db will usually be a small fraction of the CPU utilization of the ORM using application that is talking with the db. Kirk Haines