I''ve been working on getting a pretty simple caching scheme to work. However, it doesn''t seem that Rails is using the cached pages: Processing PageController#show (for 127.0.0.1 at Mon Apr 18 22:49:24 EEST 2005) Parameters: {"action"=>"show", "action_prefix"=>"shoecare", "controller"=>"page", "lang"=>"en"} [4;33mPage Load (0.002584) [1;37mSELECT * FROM pages WHERE url = ''shoecare'' LIMIT 1 [4;35mPage Load (0.002456) [0;37mSELECT * FROM pages WHERE show_p = 1 [4;33mCollection Load (0.000808) [1;37mSELECT * FROM collections WHERE show_p = 1 Rendering page/show (200 OK) Cached page: /en/page/shoecare/show.html Completed in 0.048617 (20 reqs/sec) | Rendering: 0.009249 (19%) | DB: 0.005848 (12%) This happens no matter how many times I hit the reload button in the browser. So, a few questions: 1. First, and foremost, why doesn''t Rails use the cached page file on subsequent requests? 2. Why is the page saved in the file system even when memorystore is according to the docs the default? Filesystem is used even when memorystore is selected explicitly in environment/production.rb: ActionController::Base.fragment_cache_store ActionController::Caching::Fragments::MemoryStore.new 3. Why are the cached pages saved to myapp/public even when I specify some other path in fragment_cache_store? So, have I missed something obvious or are the docs in http://rails.rubyonrails.com/classes/ActionController/Caching/ Fragments.html outdated? //jarkko -- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Any ideas on this? When I use action caching, it works just fine (and I get as much as 150 reqs/sec). //jarkko On 18.4.2005, at 23:08, Jarkko Laine wrote:> I''ve been working on getting a pretty simple caching scheme to work. > However, it doesn''t seem that Rails is using the cached pages: > > Processing PageController#show (for 127.0.0.1 at Mon Apr 18 22:49:24 > EEST 2005) > Parameters: {"action"=>"show", "action_prefix"=>"shoecare", > "controller"=>"page", "lang"=>"en"} > [4;33mPage Load (0.002584) [1;37mSELECT * FROM pages WHERE > url = ''shoecare'' LIMIT 1 > [4;35mPage Load (0.002456) [0;37mSELECT * FROM pages WHERE > show_p = 1 > [4;33mCollection Load (0.000808) [1;37mSELECT * FROM > collections WHERE show_p = 1 > Rendering page/show (200 OK) > Cached page: /en/page/shoecare/show.html > Completed in 0.048617 (20 reqs/sec) | Rendering: 0.009249 (19%) | DB: > 0.005848 (12%) > > This happens no matter how many times I hit the reload button in the > browser. > > So, a few questions: > > 1. First, and foremost, why doesn''t Rails use the cached page file on > subsequent requests? > 2. Why is the page saved in the file system even when memorystore is > according to the docs the default? Filesystem is used even when > memorystore is selected explicitly in environment/production.rb: > ActionController::Base.fragment_cache_store > ActionController::Caching::Fragments::MemoryStore.new > 3. Why are the cached pages saved to myapp/public even when I specify > some other path in fragment_cache_store? > > So, have I missed something obvious or are the docs in > http://rails.rubyonrails.com/classes/ActionController/Caching/ > Fragments.html outdated? > > //jarkko > > -- > Jarkko Laine > http://jlaine.net > http://odesign.fi_______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Page Caching stores them on the public so that the webserver will bypass rails completely and just render the cached file. It doesn''t use the same cache store as Action/Fragment caching. I''m not sure, but Webrick may not support Page Caching like Apache or Lighttpd. If it works, you wouldn''t even see a log entry on it. On 4/19/05, Jarkko Laine <jarkko-k1O+Gnc6WpmsTnJN9+BGXg@public.gmane.org> wrote:> Any ideas on this? When I use action caching, it works just fine (and I > get as much as 150 reqs/sec). > > //jarkko > > > On 18.4.2005, at 23:08, Jarkko Laine wrote: > > > I''ve been working on getting a pretty simple caching scheme to work. > > However, it doesn''t seem that Rails is using the cached pages: > > > > Processing PageController#show (for 127.0.0.1 at Mon Apr 18 22:49:24 > > EEST 2005) > > Parameters: {"action"=>"show", "action_prefix"=>"shoecare", > > "controller"=>"page", "lang"=>"en"} > > [4;33mPage Load (0.002584) [1;37mSELECT * FROM pages WHERE > > url = ''shoecare'' LIMIT 1 > > [4;35mPage Load (0.002456) [0;37mSELECT * FROM pages WHERE > > show_p = 1 > > [4;33mCollection Load (0.000808) [1;37mSELECT * FROM > > collections WHERE show_p = 1 > > Rendering page/show (200 OK) > > Cached page: /en/page/shoecare/show.html > > Completed in 0.048617 (20 reqs/sec) | Rendering: 0.009249 (19%) | DB: > > 0.005848 (12%) > > > > This happens no matter how many times I hit the reload button in the > > browser. > > > > So, a few questions: > > > > 1. First, and foremost, why doesn''t Rails use the cached page file on > > subsequent requests? > > 2. Why is the page saved in the file system even when memorystore is > > according to the docs the default? Filesystem is used even when > > memorystore is selected explicitly in environment/production.rb: > > ActionController::Base.fragment_cache_store > > ActionController::Caching::Fragments::MemoryStore.new > > 3. Why are the cached pages saved to myapp/public even when I specify > > some other path in fragment_cache_store? > > > > So, have I missed something obvious or are the docs in > > http://rails.rubyonrails.com/classes/ActionController/Caching/ > > Fragments.html outdated? > > > > //jarkko > > > > -- > > Jarkko Laine > > http://jlaine.net > > http://odesign.fi_______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > -- > Jarkko Laine > http://jlaine.net > http://odesign.fi > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >-- rick http://techno-weenie.net
On 19.4.2005, at 17:40, Rick Olson wrote:> Page Caching stores them on the public so that the webserver will > bypass rails completely and just render the cached file. It doesn''t > use the same cache store as Action/Fragment caching. I''m not sure, > but Webrick may not support Page Caching like Apache or Lighttpd. If > it works, you wouldn''t even see a log entry on it.A-ha. Interesting. Actually I''m now beginning to understand what might be the problem: For this url: :controller => "page", :action => "show", :action_prefix => "shoecare", :lang => "en" the generated file is /public/en/page/shoecare/show.html However, the url requested is actually mydomain.com/en/shoecare . All the other attributes are specified in the routes file. Because of that, the cached page and the requested url never match in the eyes of lighttpd. So the problem seems to be that routing and page caching don''t really play together at the moment. Action caching seems to be working a lot better, so I''ll stick to it for now. //jarkko -- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails