Does Mezzanine Scale?

June 16, 2011  /  Home

The question of scalability with regard to Mezzanine and Django recently came on up on the mezzanine-users mailing list, to which I offered the following reply: Mezzanine and Django itself are fantastic choices for someone concerned with scaling for high traffic.

The Mozilla add-ons site that hosts all Firefox plugins, and Disqus which is currently the world’s highest traffic commenting system, both run on Django. Each of these have been quoted at 500 million hits per day and 1 billion per month respectively.

One of the keys to scaling sites like these is the wealth of options available for caching in the Django ecosystem, and the ability to then scale out the number of both application servers running Django, and caching servers typically running memcached, with very little modification to your application code. Django comes out-of-the-box with the ability to switch on site-wide caching, per page caching and template fragment caching. Beyond that there are also third-party Django applications that implement object level caching such as Django Cache Machine and Johnny Cache, for even finer-grained control with little modification to your code.

Both Mezzanine and Cartridge have been designed from the ground up with scalability in mind. Particular care has been taken to avoid any n+1 queries, for example rendering out multiple instances of Mezzanine’s navigation tree containing any number of nested levels of navigation will only ever run a single database query. Same with Cartridge’s products. What this means is that you can go very far traffic- wise, using a single server without even thinking about caching. Once you do then the ability to add application and cache servers is trivial, and will take you incredibly far using a single database. Once you start needing multiple database servers Django also comes with the built-in ability to route models across different databases, so there are extra options there beyond your typical master/slave database replication scenario.

I’ve only touched on the topic to provide an overview of what’s available, and you should certainly research it further for your particular scenario, but as you can see scalability is a core concern baked into Django and Mezzanine, so you can choose these with confidence.