250x Speed Improvements with Microcaching (and No New Code)
"If you have personalized pages (ie: majority logged-in users) this approach isn't going to work. "I've considered this problem, and am working on a solution for nirvana[1].  The biggest challenge to this project has been to take a language (coffeescript) that is sequential and run it in a distributed environment, without the programmer having to know distributed programming.  One of the techniques I'm applying is making a response (in this case, a web page) the result of a collection of components, which are rendered separately in the same context.  (EG: The context is the headers of the request, plus the user record if the user is logged in, etc.)So, the request comes in, the components are loaded from the cache, they are executed (in parallel) all with a copy of the state, their results are aggregated and that result can run thru templating to produce a webpage that is returned.The idea then becomes, instead of executing the code for every component in every request, if the component has no context specific requirements (e.g.: it is the same for every user, it's a static element, or it's dynamic, and but doesn't need to be generated every time) .. then it can be flagged as cacheable.  The caching would also have a staleness factor (Eg: 1m, 5m 10m).[2]My hope is that you can have pages that are custom per user, but that also contain heavy impact results (say a graph produced by an expensive operation), where the results come form cache, the static components come from cache, but the user specific parts are dynamically generated each request.This component approach not only lets the code be rendered in parallel, and often not even rendered, but instead pulled from cache, but it should allow for more convenient re-use of common elements and features across a site.I hadn't considered caching for just 1s, though. Will have to think about that.[1] Nirvana is CoffeeScript web development backed by erlang and Riak. Instantly distributed coffeescript.  It will be open source, hopefully soon.  Follow @nirvanacore on Twitter if you're interested in being notified.[2] Planned. There are some implications of this that will require tradeoffs, so initially it may just be a flag of Yes/No for "Cache for up to 1 minute." or some value like that.