Comments (6)
This made think. Actually page caching for css/js might be incorrect. It works fine if you run a single site from the installation, but it might be a problem if you have multiple. Meaning 'default' layout from site A, will conflict with 'default' layout from site B.
As far as the actual page content goes it's 'cached' on the database. Application doesn't do any parsing of tags and so on, just serves content directly from Db. I think there are only 2 SQL calls to serve a page. Recently I deployed an app with Sofa for a pretty busy site and it was generally completing requests in 15ms or so.
The reason there's no real page caching for cms content is because of possibility of dynamic content served via helpers/partials/etc. But I recognize there's a need for proper caching..
from comfortable-mexican-sofa.
Thanks for your thoughtful answer. I did see that the cms serves the content field from the db after the page is rendered, which works very well, but we are interested in also implementing page caching (i.e. static files served up by apache or nginx without touching the rails app) with some dynamic content via ajax callbacks for some partials (or even server side includes), for e.g. see:
http://railscasts.com/episodes/169-dynamic-page-caching
While we do have page caching working with dynamic contant for non cms actions, a simple attempt to add render_html to the caches_page line of cms_content_controller on my fork just blows things up with a hard to trace exception:
NoMethodError in Cms contentController#render_html
undefined method `after' for true:TrueClass
Rails.root: /Users/ramie/heatwave_rails3
Application Trace | Framework Trace | Full Trace
activesupport (3.0.3) lib/active_support/callbacks.rb:314:in send' activesupport (3.0.3) lib/active_support/callbacks.rb:314:in
_callback_after_13501'
activesupport (3.0.3) lib/active_support/callbacks.rb:476:in _run__1625381097__process_action__1055742085__callbacks' activesupport (3.0.3) lib/active_support/callbacks.rb:409:in
send'
activesupport (3.0.3) lib/active_support/callbacks.rb:409:in _run_process_action_callbacks' activesupport (3.0.3) lib/active_support/callbacks.rb:93:in
send'
activesupport (3.0.3) lib/active_support/callbacks.rb:93:in run_callbacks' actionpack (3.0.3) lib/abstract_controller/callbacks.rb:17:in
process_action'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:30:in process_action' activesupport (3.0.3) lib/active_support/notifications.rb:52:in
instrument'
activesupport (3.0.3) lib/active_support/notifications/instrumenter.rb:21:in instrument' activesupport (3.0.3) lib/active_support/notifications.rb:52:in
instrument'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:29:in process_action' actionpack (3.0.3) lib/action_controller/metal/rescue.rb:17:in
process_action'
newrelic_rpm (2.13.4) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:34:in process_action' newrelic_rpm (2.13.4) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:252:in
perform_action_with_newrelic_trace'
newrelic_rpm (2.13.4) lib/new_relic/agent/method_tracer.rb:141:in trace_execution_scoped' newrelic_rpm (2.13.4) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:247:in
perform_action_with_newrelic_trace'
newrelic_rpm (2.13.4) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:33:in process_action' actionpack (3.0.3) lib/abstract_controller/base.rb:120:in
process'
actionpack (3.0.3) lib/abstract_controller/rendering.rb:40:in process' actionpack (3.0.3) lib/action_controller/metal.rb:138:in
dispatch'
actionpack (3.0.3) lib/action_controller/metal/rack_delegation.rb:14:in dispatch' actionpack (3.0.3) lib/action_controller/metal.rb:178:in
action'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in call' actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in
dispatch'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:27:in call' rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in
call'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:in recognize' rack-mount (0.6.13) lib/rack/mount/code_generation.rb:68:in
optimized_each'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:in recognize' rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in
call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:492:in call' newrelic_rpm (2.13.4) lib/new_relic/rack/developer_mode.rb:20:in
call'
hoptoad_notifier (2.3.0) lib/hoptoad_notifier/rack.rb:27:in call' warden (1.0.3) lib/warden/manager.rb:35:in
call'
warden (1.0.3) lib/warden/manager.rb:34:in catch' warden (1.0.3) lib/warden/manager.rb:34:in
call'
actionpack (3.0.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in call' actionpack (3.0.3) lib/action_dispatch/middleware/head.rb:14:in
call'
rack (1.2.1) lib/rack/methodoverride.rb:24:in call' actionpack (3.0.3) lib/action_dispatch/middleware/params_parser.rb:21:in
call'
actionpack (3.0.3) lib/action_dispatch/middleware/flash.rb:182:in call' actionpack (3.0.3) lib/action_dispatch/middleware/session/abstract_store.rb:149:in
call'
actionpack (3.0.3) lib/action_dispatch/middleware/cookies.rb:295:in call' activerecord (3.0.3) lib/active_record/query_cache.rb:32:in
call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in cache' activerecord (3.0.3) lib/active_record/query_cache.rb:12:in
cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:31:in call' activerecord (3.0.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in
call'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:46:in call' activesupport (3.0.3) lib/active_support/callbacks.rb:415:in
_run_call_callbacks'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:44:in call' rack (1.2.1) lib/rack/sendfile.rb:107:in
call'
actionpack (3.0.3) lib/action_dispatch/middleware/remote_ip.rb:48:in call' actionpack (3.0.3) lib/action_dispatch/middleware/show_exceptions.rb:46:in
call'
railties (3.0.3) lib/rails/rack/logger.rb:13:in call' rack (1.2.1) lib/rack/runtime.rb:17:in
call'
rack (1.2.1) lib/rack/lock.rb:11:in call' rack (1.2.1) lib/rack/lock.rb:11:in
synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in call' actionpack (3.0.3) lib/action_dispatch/middleware/static.rb:30:in
call'
railties (3.0.3) lib/rails/application.rb:168:in call' railties (3.0.3) lib/rails/application.rb:77:in
send'
railties (3.0.3) lib/rails/application.rb:77:in method_missing' thin (1.2.7) lib/thin/connection.rb:76:in
pre_process'
thin (1.2.7) lib/thin/connection.rb:74:in catch' thin (1.2.7) lib/thin/connection.rb:74:in
pre_process'
thin (1.2.7) lib/thin/connection.rb:57:in process' thin (1.2.7) lib/thin/connection.rb:42:in
receive_data'
eventmachine (0.12.10) lib/eventmachine.rb:256:in run_machine' eventmachine (0.12.10) lib/eventmachine.rb:256:in
run'
thin (1.2.7) lib/thin/backends/base.rb:57:in start' thin (1.2.7) lib/thin/server.rb:156:in
start'
thin (1.2.7) lib/thin/controllers/controller.rb:80:in start' thin (1.2.7) lib/thin/runner.rb:177:in
send'
thin (1.2.7) lib/thin/runner.rb:177:in run_command' thin (1.2.7) lib/thin/runner.rb:143:in
run!'
thin (1.2.7) bin/thin:6
/Users/ramie/.rvm/gems/ruby-1.8.7-p174@rails3/bin/thin:19:in `load'
/Users/ramie/.rvm/gems/ruby-1.8.7-p174@rails3/bin/thin:19
Request
Parameters:
None
Show session dump
Show env dump
Response
Headers:
None
from comfortable-mexican-sofa.
Argh! ^&%&^% github UI this is not the first time I closed an issue when all I wanted was to add a comment. Can you re-open so others can comment?
Thanks,
Ramie
from comfortable-mexican-sofa.
Re-opening... and that's a really bizarre error. Googling for something similar just gives a StackOverflow question with no solution.
from comfortable-mexican-sofa.
I think I found the issue which would break any of the page caching for css or js, see pull request. You need to pass a Proc on the :if option of caches_page. That is:
, :if => Proc.new { |c| ComfortableMexicanSofa.config.enable_caching }
from comfortable-mexican-sofa.
Closing as it's a duplicate of #64 now.
from comfortable-mexican-sofa.
Related Issues (20)
- 'around action' breaking admin CMS HOT 1
- Passwords cannot be changed by admin users [Bug?] HOT 1
- Feature Request: Work with UUID ID column...
- ERB exposed in JSON response but not HTML HOT 1
- Documentation on Hostname Aliases Unclear
- render cms_layout throws ActionView::MissingTemplate HOT 1
- Wysiwyg file chooser pagination
- undefined method `service_name' for #<ActiveStorage::Blob:0x00007fa1d3eec970> HOT 2
- Rails 6.1 Active Storage's ImageProcessing transformer doesn't support :combine_options HOT 4
- Rails 6.1: support ActiveStorage::Blob#service_name
- Pages index page performance issues
- How to migrate JS and CSS code from 1.x to 2.0
- cms_site_detect fails if request is nil
- Any Updates? HOT 1
- Redirect to 404 page on page not found
- Ruby 3 Support HOT 4
- Content does not get rendered in the layout
- Adding a new Category from the Pages admin view results in an error
- CodeMirror style is broken
- Support for Rails 7? Any maintainers needed? HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from comfortable-mexican-sofa.