Last Friday I travelled down to Vancouver for the Couchbase Vancouver Developer Day. Just having joined the PayrollHero dev team, I was keen to learn about the NoSQL style of database, and Couchbase in particular since we currently use it in PayrollHero.
The goal of the day was to introduce developers to Couchbase 2.0, give them a basic understanding of how to set it up and use it, and then tackle some tougher areas such as how to query the data using views. The seminar was run by 3 developers from Couchbase – Technical Evangelists Tugdual Grall & Jasdeep Jaitla, and .NET Developer Advocate John Zablocki. It was interesting to see the mix of developers attending the seminar – most mainstream programming languages were represented including Java, .NET, Ruby, PHP, Python and even node.js and Go. Amazingly there was some form of SDK for each of these languages, whether official or community created, proving just how much open source community support Couchbase has.
The morning was spent going through the features found in Couchbase 2.0 with Tugdual. He ran us through the core principles of Couchbase Server – easy scalability, consistent high performance, no downtime and a flexible data model, before discussing the new architecture and features of Couchbase 2.0.
One of the features I found particularly impressive was how Couchbase handles server faults by replicating across nodes in a server cluster. The Couchbase client library detects when requests to a server within your cluster are failing, automatically promotes replicas of the requested documents on the remaining servers in the cluster to be active documents, and then rebalances the documents across the remaining servers. Added to this is the ease in which you can replicate your data across data centers using Cross Data Center Replication (XDCR), meaning if your data center on the west coast of the country goes down entirely, you can ramp up your clusters on the east coast of the country without losing any data whatsoever. An extension of XDCR is the ability to set up an Elastic Search cluster for providing scalable, real-time searching of documents. You can see that a lot of work has gone into making this as painless to set up as possible.
Installing Couchbase 2.0 was just as painless – well at least for us Ruby guys. The PHP guys seemed to have a fair bit more trouble (the price paid for still using PHP!) and any guys running 32-bit Windows were pretty much out of luck. WIth Rails, its as simple as downloading and running the server, installing the libcouchbase library, and installing the couchbase gem. Done.
After everyone had Couchbase 2.0 installed and set up for their various environments, we started to run through some labs to teach us the basics of Couchbase – connecting to the database, setting and retrieving documents, using atomic counters and optimistic locking, and observing when data has been pushed to disk and replicated.
Jasdeep – definitely the most vocal and opinionated of the three – used some of this time to proclaim the virtues of a NoSQL solution vs a Relational Database solution. A line that stuck in my head was “I don’t care about duplicate data – I have 10 times the performance!”. And he is definitely right about that. Couchbase, like other NoSQL databases, is blindingly fast compared to MySQL or MS SQL. By caching as many documents as it can in memory, and only caching to disk those that are the least requested, it can maintain request throughput at amazing rates. “No need to write migrations, I can change the schema at anytime through my models since there is no schema”, he proclaims, before following with, “And no more joins! I hate joins.”
After lunch, John stepped up to take us through the most difficult area of the day – views. By using Map-Reduce views, Couchbase can create indexes of documents for quick querying. He used the ASP .NET MVC framework to take us a through a fairly standard scenario, explaining how to construct views on Couchbase server to pull back subsets of data based on ranges, groupings, counts and more. This was definitely the most brain-intensive part of the seminar, and late in the day few people had made it through the labs unscathed. For most people who are heavily experienced in relational databases, it does take a while to shift your mind into thinking the NoSQL way.
All up it was a very well run and interesting day. I particularly enjoyed hearing how the NoSQL movement evolved and how passionate the Couchbase guys are about their product. PayrollHero already has Couchbase implemented as part of our clocking capture process, and will be looking to use it in other places where we require fast performance due to heavy traffic. I look forward to using Couchbase more and further learning what makes NoSQL such a popular movement.