Captain Codeman Captain Codeman

Benefits of NoSQL (MongoDb) for the Query-side of CQRS

Contents

Introduction

As you may know I’ve been researching CQRS and the benefits of using this approach to developing systems. My focus at the moment is on the Query side of things and for this I’ve been comparing a SQL Server / NHibernate solution with a NoSQL alternative using MongoDb. For this, I’ve been using a simple forum app that I’ve been working on with a database of around 4m posts and 200k topics.

I’ll post more detailed results when I have time to show things in more detail (with some example code) but basically, the performance difference I’ve been seeing is huge.

The SQL Server / NHibernate solution was generating about 10 requests per second and had SQL Server at about 50% of the CPU. The MongoDB backed solution was running at around 50 requests per second and MongoDb was sat at around 3-4% of CPU time.

Right now, I’m very excited about the possibilities of improving app performance (especially now that Google are taking this into account when calculating page-rank) but also, the difference in the complexity of the code between the two systems is also refreshing with the MongoDb solution very, very simple and quick to develop.