Today I had the pleasure to attend code.talks Hamburg, a not-so-corporate conference for developers taking place for the 3rd time in a large cinema in the center of my original hometown. The event attracts more than 1.500 people to join the talks and consume loads of popcorn and Nachos and thus is one of the biggest developer conferences in Europe. Together with thePHP.cc's Arne Blankerts I gave a talk called "Two Stack CMS", explaining the concept of the same title coined by Martin Fowler.
In its core it is about inverting the direction of who triggers the content rendering: Traditionally, a request from a visitor's browser will ask the CMS, shop, or any other system, to render HTML. This markup is either returned from a page cache, or, if no cached version exists at that point, is generated by the CMS. On the second hit, the generated page can be delivered from the cache directly, until it expires. But it's exactly this last part which makes the scenario complex: when is content stale and needs to be refreshed?
The Two Stack approach replaces a cache by a durable content aggregation storage. Instead of generating the ready-to-deliver markup on request, the content creation stack pushes it into the storage whenever it changes. In Neos terms this means that, whenever an editor presses the "publish" button, all content which has been modified is pushed into the content storage. Separate from the content creation stack, a second stack is responsible for delivering content to the browser – the content delivery stack. This second layer has very few responsibilities and is highly scalable. Its task is to fetch either a ready-made page from the content storage or combine smaller artefacts into one page (for example a layout, a list of products and their respective prices) and return the result to the visitor.
Of course there's more to it than only this principle, but if you didn't think of it before, inverting the direction of this process can be an eye-opener. Pretty much like with Dependency Injection – rather simple in its implementation, but powerful when truly embraced.
I enjoyed the following discussions and conversations with attendees of the talk and really wondered why I didn't make it to the last year's editions of code.talks :-)
You find the slides for our talk at Slideshare.