ErlangInside

9

maa

Interview with Marc Worrell: Zotonic Rethinks the CMS with Erlang

I took a minute from getting ready for my talk at Erlang Factory (and working on the day job) to talk with Marc Worrell, Lead Architect of Zotonic – a new Content Management System written entirely in Erlang. This is a brief overview of the system focused on the ‘why’ – the technical details are well covered on their site, but I wanted to understand the motivations behind a company taking on a project like this. Marc also runs his own programming consultancy, WhatWebWhat.

I’m excited to experiment with Zotonic, but I frankly don’t have a downloaded copy of Postgres lying around. I’m planning on getting that installed in order to try it out and will report back.

Here is the interview, as usual, emphasis mine.

EI: Hi Marc, can you tell me the impetus for Zotonic?

MW: I used to be the CTO at Mediamatic. Mediamatic built and maintains the community management system Anymeta. Anymeta grew from a simple library to a full fledged community management system. For that we added more and more interactivity and connectivity. Which brought us in a head-on collision with PHP.

PHP is far from stellar in handling many small requests, can’t keep connections open and gets really slow when your codebase grows. Though we need open connections to user agents, XMPP connectivity and quick turnaround on Ajax requests. All are challenging for PHP. So we ended up adding more and more system services to make PHP perform and have the system support our requirements.

Growing a site with PHP starts with opcode caches, memcached, a modified memcached with dependency checking, extra servers and then more servers. Finally adding XMPP server and client processes written in Python. A whole lot of extra software.

And then we were still rewriting PHP tables into code so that it performed better on application load.

Frustration, especially considering my background with building embedded development platforms. Embedded systems and the programming language C show what you can do with the available CPU power.

After I left Mediamatic I started ask myself how to do this better, how to support those multi-core cpus, how to use those gigabytes of memory and how to have all the connectivity a modern website (information hub) needs.

I checked out Ruby on Rails, I checked Django and some other frameworks. They promise a lot. They fall short when you benchmark their efficiency on modern cpus and server systems.

That is when I rediscovered Erlang. The book from Joe really brought me to the realisation that Erlang could solve most, if not all, the problems I was encountering. And his approach to failure was nothing short of a revelation to me.

This lay the seed for Zotonic, as there was nothing else.

EI: The Zotonic team seems to have a lot of experience, what brought you together, and what do you do now? Is Zotonic your full-time venture or are you doing something else?

MW: We all know each other from Mediamatic. Tim and Arjan still work for Mediamatic, Peet is a former colleague and now works for Mirabeau. I am currently a freelancer. Zotonic is my tool to deliver great looking web sites that perform well. You could say that it is my full time occupation. Tim and Arjan are part time working on Zotonic.

We get more and more project requests, so we are happy that we did make the right decision to start Zotonic and make it Open Source as well.

EI: Why Erlang? How does it make a CMS easier if most will be non-distributed/one-box systems, and Erlang isn’t known for Raw I/O performance? How are you taking advantage of Erlang’s sweet-spot of easy distributed message passing?

MW: We are now using Erlang’s excellent failure handling and multiprocessing capabilities. I think that the failure handling and with it the possibility to make robust systems is one of the often overlooked features of Erlang, when not the most important.

We don’t use the distributed nature of Erlang, yet. But that might change quite soon.

That text processing is essential for web apps is a misconception. Most web apps only parse requests, fetch some data, concatenate a whole lot of text chunks and then output them over a socket back to the user agent. You don’t need text processing for that. In fact on low end machines Erlang is quite capable of saturating a gigabit connection. Informal benchmarks gave more than 6000 page requests per second (famous helloworld templates) on a low end server. That should be enough.

To achieve this performance we made some rather big changes to Webmachine. Basho will be looking into incorporating those changes into the mainstream Webmachine code.

And programming in a functional language is fun :-)

EI: NoSQL support? is it important for a CMS? Are there plans to support Riak or Couch or MongoDB?

MW: NoSQL is really the story of the day. A lot of people see it as a means to an end. Some think you need it for performance. That is not true. An external party did some benchmarking on Zotonic and expected the database to be the main bottle neck. It was not, by far.

As I often say, the best way to achieve high performance is to not hit the database. Add some caching and the current RDBMS products can bring you a long way, especially on modern hardware. When you don’t need millions of objects and 99.99% uptime guarantees then I suggest that you just use a RDBMS. Your data will be safe and the administrators of your customer will be happy that they can access the data easily.

Having said that, we are looking into Riak and some other distributed stores. We have some projects at hand that require a scale and uptime that will make us move to a distributed system with elegant failure handling. Only with these requirements a distributed store becomes important.

EI: How do you guys use Zotonic yourselves? From an end-user perspective, how does it differ from WordPress or Drupal?

MW: A first impression is important. And the first impression of Zotonic is its speed. I had people asking things like “stop… did I really see five pages just now?” They are used to the slowness of WordPress and Drupal, at least when not using Google, Yahoo or one of the other big sites.

Over time there will be another big difference: realtime. We are in the process of adding more and more realtime features. They enable realtime communicationa and federation of data. It doesn’t matter where your data (profile, blog etc.) is, it matters that it is up to date and can be published where you want it.

For ourselves, we are moving all our sites, blogs, and whatnot to Zotonic. It is more fun in Zotonic and we are eager to use the PubSub capabilities Arjan just added.

EI: From the IT-guy perspective, why should he roll out Zotonic?

MW: You need less hardware for more visitors. Let’s give an example.

We made the site for the New Island Festival, a cultural festival in New York. At some point we were seeing sustained traffic of 2 mbit. What made that traffic impressive was that the site was hosted on a small VPS and only using 5-10% cpu. We have seen other requirements for PHP sites :)

EI: What are the largest deployments so far?

MW: The New Island Festival was a nice test bed for the number of visitors. A bit bigger, content-wise, site we just finished is the site for the Mediafonds in the Netherlands. This site has around 25000 pages.

We are now working on a project with a projected page count of around a million and later we will have a project that requires a ten fold higher page count.

EI: Roadmap – what are your plans for the future of Zotonic?

MW: We have now scheduled or are planning:
- redesign of the admin environment.
- redesign of the access permission system to better support user generated content.
- extended support of XMPP PubSub, also sharing images and other metadata.
- realtime tools for server monitoring.
- support for distributed Zotonic nodes (still with a central store).
- support for a distributed, fault tolerant data and file store.

And many smaller changes that will make the system better for building the websites our customers and programmers love.

EI: MySQL Support? Is it planned?

MW: No, we don’t plan MySQL support. Though it should be do-able with the new binary driver. Right now we are focusing on the distributed version with a k/v store.

Thanks, Marc!

Edit: Only July 21, I took out ‘destroys WordPress’ from the title; upon reflection, I realized my Erlang zeal got the better of me..

Leave a comment