Aryk Grosz
2007-Nov-03 11:34 UTC
model caching reloading in development is making things slow
In my development env, I was working on a module in my rails app. This action was taking approximately 7 seconds to complete. I was adding in tracing marks to figure out where which actions were taking the longest. All of a sudden, almost literally out of nowhere, the action starts taking 15-19 seconds to complete. I investigated this issue by Benchmarking virtually the entire scope of AR save and callbacks. It turns out that in my callbacks I reference other AR model classes. And apparently because rails reloads model classes on each action in development, it takes about .25 seconds just to run g = Photo. Normally this action should take 0.0 seconds. Im sure I was in development the entire time because prod and test don''t work on my dev workstation. This is very odd. The behavior of this really was out of nowhere because all I was doing was adding Benchmark.realtime to do some harmless benchmarking, and now I can''t get it so that AR models dont have to reload each time a AR model is called, or atleast not take .25 seconds each time it is called. How can I get my rails app to working so it doesnt take so long just to call "Photo" or "Book" AR model. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2007-Nov-03 14:46 UTC
Re: model caching reloading in development is making things slow
> > This is very odd. The behavior of this really was out of nowhere > because all I was doing was adding Benchmark.realtime to do some > harmless benchmarking, and now I can''t get it so that AR models dont > have to reload each time a AR model is called, or atleast not take .25 > seconds each time it is called. > > How can I get my rails app to working so it doesnt take so long just > to > call "Photo" or "Book" AR model.Change config.cache_classes in development.rb Fred