ActiveBlog

Implementing a CouchDB Service on Stackato: Project Overview
by Joseph Hou

Joseph Hou, December 05, 2013
BCITActiveState has been a long time supporter of colleges and universities by providing development tools as part of the ActiveState Education Partner Program. In line with this initiative, we have recently provided four students from the British Columbia Institute of Technology (BCIT) access to Stackato for a class project. In the first of a two part series, Joseph Hou provides an overview of their project: Developing a CouchDB Big Data Service on Stackato.
 
We had the privilege of working with ActiveState Software on developing a CouchDB Big Data service on their Stackato Platform-as-a-Service offering. Below is an overview of our project.
 
What is CouchDB?
CouchDB is an open-source NoSQL database that stores all its data as JSON files with an API that is completely accessed through HTTP.  What it offers is a simplified database structure with no schemas, fast read performance, and automatic, two-way replication.  This allows high availability and crash-tolerance.
 
What is Stackato?
Stackato is a platform-as-a-service based on Cloud Foundry. It is enterprise-ready with hardened security features, yet it offers developers incredible ease of use on a standardized Ubuntu operating system. Stackato handles all the application dependencies.  For example, if you need to deploy a PHP script, Stackato will automatically set up an Apache server with MySQL and generate credentials for your application to use.  Or if you are deploying a Java web application, Stackato will set up an application server of your choice and deploy it on the cloud.  
 
What did we do?
We did the backend work to connect a CouchDB service to Stackato.  Developers can quickly utilize CouchDB as a service if it is needed in their application. The CouchDB service will generate unique credentials, username, password, and database URL for the application.  We did this using Ruby and Sinatra.
 
What else did we do?
We created a simple tasklist application in PHP, JavaScript, and CouchDB, as a proof of concept that our CouchDB Stackato service worked as advertised.  We can demonstrate deployment of our application with a single command line on the Stackato client.  
 
What did we learn?
We learned that we could develop a back-end database service for a leading cloud platform-as-a-service.  At the start of this project, we were a bit unsure of ourselves, but thanks to the great support from ActiveState, as well as our supervising instructors at BCIT, we were able to pull it off within one semester.
 
We learned a lot about CouchDB and NoSQL databases.  In my opinion, this was an important supplement to our education at BCIT.  Even in the database option, there is no structured curriculum on NoSQL databases. I had heard a lot about NoSQL but this was my first time to work with it and see what the strengths and weaknesses are.  
 
CouchDB is a fascinating piece of software.  In many ways, I would argue that it represents one extreme of the NoSQL database landscape.  It is a pure document store with an HTTP API.  Its simplicity is both a strength and a weakness.  Its simplicity means that it is simple to learn.  However, it really does not support SQL at all unless you use some kind of helper library.  For developers who are trained to work in MySQL, this comes as a big shock, and it forces them to rewrite their code and rethink their database architecture.  How can they flatten the schemas? There are use cases where CouchDB would be a good fit, but there are also many use cases with complex schemas that just won’t work with CouchDB. If you can make CouchDB work for you in your scenario though, it offers compelling advantages with its replication feature and revision history.  
 
I believe a big part of why MongoDB became so popular was because it still supports SQL-like concepts in its API. Developers didn’t need to throw away everything they know about databases.  
 
Why didn’t we implement a Cassandra service or Hadoop service?
Well, we heard that another team was working on a Cassandra service for Stackato, so we didn’t want to duplicate work.Cassandra is an increasingly popular, high performance NoSQL database.
 
As for Hadoop, we did look at HBase and Hive.  Perhaps in the future, if we have the opportunity, we can give it a shot. Hadoop and Hadoop-based databases seemed to require significantly more developer resources to get started.
 
There is already a MongoDB service available on Stackato.  What’s the benefit of a CouchDB service?
MongoDB is the leading NoSQL document store database.  CouchDB offers a HTTP API and master-master replication. Basically, it is for variety so that developers can have a selection of different databases to choose from.There is also a difference in the licenses.  MongoDB is GNU AGPL v3.0, whereas CouchDB is Apache 2.0.  
 
 
 
 

Subscribe to ActiveState Blogs by Email

Category: stackato
About the Author: RSS

Joseph Hou is a second-year Computer Systems Technology student at the British Columbia Institute of Technology. He was a technical writer intern at SAP Vancouver, where he worked on SAP Lumira Server, Business Objects BI Suite, and Analytics, edition for OLAP. As the founding chair of the SAP Vancouver Intern Committee, he inspired other interns to get engaged with the culture and people at SAP. Joseph is passionate about mobile app development, student empowerment, and environmental issues. Joseph enjoys hiking, cycling, and fresh-brewed coffee.