Hi there, I''ve been trying to optimise a page in a little app I''ve developed and, looking at the log, it seems most of the DB access the page is making is getting column information from the database. This is pretty reasonable I suppose, as it has to navigate through quite a few relationships to get the info it needs. The thing is, I''d read (e.g. in a comment in http://dev.rubyonrails.com/ticket/723) that ActiveRecord is supposed to cache column definitions, so why does it have to do this on every request? Are the definitions only cached per-request (I''m using WEBrick), and would this changed if I switched to fastcgi? I am (don''t hate me :) using sql server here, so maybe that''s it? thanks! Michael
Michael O''Brien wrote:>Hi there, > >I''ve been trying to optimise a page in a little app I''ve developed >and, looking at the log, it seems most of the DB access the page is >making is getting column information from the database. This is pretty >reasonable I suppose, as it has to navigate through quite a few >relationships to get the info it needs. > >The thing is, I''d read (e.g. in a comment in >http://dev.rubyonrails.com/ticket/723) that ActiveRecord is supposed >to cache column definitions, so why does it have to do this on every >request? Are the definitions only cached per-request (I''m using >WEBrick), and would this changed if I switched to fastcgi? > >I am (don''t hate me :) using sql server here, so maybe that''s it? > >thanks! >Michael >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > >I think WEBrick always fetches columns, this to support changes during development, without the need for application restarts. Since you should neever run WEBrick in production, the caching is probably working there. // JoNtE, running production environments on Textdrive with lighttpd and fastcgi.
Michael O''Brien wrote:>The thing is, I''d read (e.g. in a comment in >http://dev.rubyonrails.com/ticket/723) that ActiveRecord is supposed >to cache column definitions, so why does it have to do this on every >request? Are the definitions only cached per-request (I''m using >WEBrick), and would this changed if I switched to fastcgi? > >Column definitions are fetched only in development mode (defined in environment.rb) When you switch to Lighttpd/Apache+FastCGI and change development mode to production, AR will use cached definitions (it will no longer query database on each request) Karol
thanks guys, I guess I''ll have to finally roll my sleeves up and get stuck into the apache/lighty configuration... On 01/06/05, Karol Hosiawa <hosiawak-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Michael O''Brien wrote: > > >The thing is, I''d read (e.g. in a comment in > >http://dev.rubyonrails.com/ticket/723) that ActiveRecord is supposed > >to cache column definitions, so why does it have to do this on every > >request? Are the definitions only cached per-request (I''m using > >WEBrick), and would this changed if I switched to fastcgi? > > > > > Column definitions are fetched only in development mode > (defined in environment.rb) > When you switch to Lighttpd/Apache+FastCGI and change development > mode to production, AR will use cached definitions (it will no longer > query database on each request) > > Karol >