Performance in a typical Cocoon application

June 30, 2006

cocoon-app-200607-small.jpgHow do you get good performance out of a Cocoon-based application? Generating each page on the fly is often costly, especially when pages are built from an aggregate of different data sources, which is a common case.

The drawing at the right (full-size version here) shows the structure of a typical Cocoon application. It comes from my what you need to know about Cocoon presentation at the Cocoon GetTogether 2004. Not cutting-edge stuff then, but it’s still valid as ever.

The key to performance with dynamically-generated websites is caching. Might sound obvious…I should maybe say intelligent caching instead.

In the case of nouvo.ch and archives.tsr.ch, which both run on live Cocoon instances, we’ve based many of our technical decisions on the cacheability of the pages. These websites do not have very high traffic on average, but we get big peaks of load when something’s announced on TV, so we need to be able handle sudden large bursts. It’s quite fun to see the peaks in bandwidth right after a TV announcement about these sites. At least when it works….but we’ve been doing quite good since the launch of nouvo in 2004.

Many “page gadgets” will kill the cacheability, but a website design where as much of the page as possible is stateless is the key to being able to efficiently cache things.

Do your website visitors really need personalized pages? Often not…and if you really need it, there are clever ways of implemeting personalization, like sending small chunks of javascript for the parts that need to be different for each visitor, or using Ajax or AHAH to send very smalll parts of personalized content. We’re using the latter technique on nouvo.ch, sending small chunks of XML via XmlHttpRequest when a visitor is logged in.

Once your pages are cacheable, using the Apache mod_cache module as the front-end of your website (you don’t want to put Cocoon or servlets directly on the Web, right?) will do wonders, effectively serving static pages that can be each updated at different intervals, based on the HTTP headers of your Cocoon response.

In the end, this allows you to fine-tune the caching of each page or page part, directly from your Cocoon application, just by generating the appropriate HTTP headers and configuring the front-end cache correctly. Serving cached pages, you can then easily get several hundred pages per second from a “normal” Linux box, in our case we’re at 800 pages per second when tested locally from the (dual Xeon 2GHz Linux) server.

To summarize, structuring your site to have as much stateless content as possible, using a front-end cache controlled by HTTP headers, and including the caching tests in your final testing, will allow you to get the best performance for your dynamically-generated site. Minimizing the number of hits to your page-generating application will allow it to efficiently handle the really dynamic things.

In our case we don’t even use the internal caching features of Cocoon, or only very little. This would be the next step if we had more transaction traffic, by allowing us to cache partial pipelines as needed. But we haven’t needed yet, applying the above principles is more than good enough in our case.

You can find more information about configuring mod_proxy and generating HTTP headers for caching on the Cocoon wiki.

Update: fixed a few typos


Guess where?

April 26, 2006

some-planes-somewhere.jpgMaking cryptic statements about certain parts of the world seems to be commonplace for Cocoonistas these days, so here’s my mystery picture. You won’t break any neurons on it…

Having a busy but fun week!


Cocoon 2.1.9 is out

April 10, 2006

Thanks Carsten for making the release happen, and congratulations to all involved, the 2.1.9 release of Cocoon is available.

There are no revolutions in this release, but the many small changes still make a significant difference. The 2.1 branch is stable and for most of us it’s been the workhorse for quite some time, so no real need for revolutions there.

A not so small change is the rewriting of some of the CForms samples to use dojo for Ajax stuff. The Ajaxified dynamic repeater is a good example, where Ajax makes a big difference to the UI without being obnoxious.

I have contributed almost nothing to this release, between a hectic end of year 2005 and lots of teaching in this beginning of 2006 I didn’t have much time. I’ll hopefully be more active in the next months.

Update: we found out (too late) that the samples of the Ajax block are broken when using the default settings in this release. The new “template” block must be enabled (as described in INSTALL.txt) for these samples to work.


Congratulations Hippo!

March 29, 2006

Arjé Cahn announces the first Open Source release of their Cocoon-based Hippo CMS.

The Amsterdam Plot is now fully solved! Well, almost – there are signs of more exciting announcements in the pipeline, I’m staying tuned to their weblog!

Together with Daisy and Apache Lenya, this makes (at least) three important OpenSource CMSes based on Cocoon! User expectations vary a lot when you talk CMS, so in my opinion it’s good to have diversity – also because these guys know each other well enough to take advantage of the friendly competition to improve their products.

And don’t forget the Apache Forrest publishing system, which is also built on Cocoon and works wonders in publishing and organizing content from very diverse sources.

Activity in the Cocoon project itself has slowed down in the last year, and these news show that it’s more a sign of maturity than anything else. Cocoon 2.1.x is “done” in many ways, future versions will bring big improvements, especially in terms of ease of development, but the power and stability of these CMSes is a testimony to the quality and maturity of the 2.1.x code.


Behind the scenes of the ASF zones server

March 8, 2006

Mads Toftum was recently interviewed by Tim Bray about the ASF zones server, and gives some insights about its administration.

The server they’re talking about is the one that powers (among others) the Cocoon zone.

This is a very useful addition to the ASF’s infrastructure, many thanks to Sun (and to our other donators)! And don’t forget that there are many ways to help the ASF if you feel like you should.

Update: more links about the interview on Mads new soulfood.dk weblog


Cocoon supports Ajax – and this time it’s the real thing

February 23, 2006

Thanks Ugo and friends! Cocoon‘s Ajax support is up a big step from what it was! And this time it’s the real thing.


Apache Lenya runs Wired News! (and more CMS-related Cocoon news in the pipeline)

January 27, 2006

As mentioned on Wired News itself, that site now runs on Apache Lenya (which as you all know is based on Cocoon) now (via Gregor). Congratulations to Wyona for landing the gig!

And if you’ve been reading between the lines of some Cocoonista’s blogs recently, it seems like another Cocoon-based CMS is going to make some noise soon.

I’m not talking about nouvo.ch where fun stuff is also happening (more on that later), but something which sounds much bigger according to the faint traces left here and there. How come Amsterdam is suddenly so attractive in winter?

Well, 2006 is just beginning but it sounds exciting already ;-)


Cocoon 2.2 is starting to look really good, but I’m a bit lost!

January 11, 2006

Not working actively on Cocoon at the moment (busy with my Flash stuff, and a lot of teaching to do between now and April), I’m doing my best to follow what’s happening.

Daniel, Jorg, Reinhard, Carsten and Giacomo (hope I’m not forgetting anyone) are actively working on M10N, the Mavenization of Cocoon, along with the new blocks system.

From what I’ve been able to see in the very limited time that I can allocate to it currently, there are Good Things in the making: a much more modular Cocoon, improved build and distribution process, and much improved management of dependencies. At the moment it’s moving so fast that it’s very hard to follow, but it all looks like things will be simpler ever after.

At the same time, users working at the sitemap level should see very little differences. These guys are basically changing the engine in flight ;-)

I’m a bit frustrated about not being able to help more (and pick those bright guy’s brains in the process…), but that’s life. I might start an important new project with Cocoon around April, if this happens 2.2 would be a serious option to consider.


Cocoon 2.1.8 is out!

November 21, 2005

The Cocoon 2.1.8 release is out, find out more from the official announcement. Congratulations everybody, and hopefully we’ll go back to faster release cycles.

The full list of changes (and it’s a loooooooooooooooong one) is available on the Cocoon website.


Cocoon GT slides and audio online

October 10, 2005

PDF slides and audio recordings of Friday’s presentations are available at cocoongt.org.

Big thanks to Jack Ivers for the audio recordings! This adds a lot of value to the event.

Make sure to have a look at Andrew Savory‘s simplifying Cocoon slides – beautiful, and food for thought.